cvs: SVNROOT / run-conversion.php

[email protected] ("Gwynne Raskind") Fri, 03 Jul 2009 06:35:16 -0000
Newsgroups svn.migration
Message-ID <cvsgwynne1246602916@cvsserver>
gwynne		Fri Jul  3 06:35:16 2009 UTC

  Modified files:              
    /SVNROOT	run-conversion.php 
  Log:
  consolidate the cvs2svn passes, cleanup code a bit, remove no-longer-needed code, copy the PECL-symlinked exts instead of external-ing them, ignore phpdoc-po (at Philip's request)
gwynne-20090703063516.txt (text/plain, 12.7 KB)
http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.64&r2=1.65&diff_format=u
Index: SVNROOT/run-conversion.php
diff -u SVNROOT/run-conversion.php:1.64 SVNROOT/run-conversion.php:1.65
--- SVNROOT/run-conversion.php:1.64	Wed Jun 24 13:25:47 2009
+++ SVNROOT/run-conversion.php	Fri Jul  3 06:35:16 2009
@@ -7,14 +7,11 @@
 
 // -----------------------------------------------------------------------------------------------------------------------------
 // Constants
-$version = substr('$Revision: 1.64 $', strlen('$Revision: '), -2);
+$version = substr('$Revision: 1.65 $', strlen('$Revision: '), -2);
 
 $passes = array(
-    'processcvs',       // Process CVS modules
     'svncreate',        // Create various SVN repositories
-    'cvs2svn',          // Run conversion for each repository
-    'ignores',          // Convert .cvsignore to svn:ignore
-    'link',             // Setup svn:externals
+    'cvs2svn',          // Run conversion for the repository
     'install',          // Install hook scripts, authz databases, etc.
 );
 
@@ -45,7 +42,7 @@
 // Returns true if either 1) We're running all passes, or 2) running the specific pass given
 function is_running_pass($pass)
 {
-    return $GLOBALS['options']['pass'] === NULL || $GLOBALS['options']['pass'] == $pass || ($pass == 'processcvs' && $GLOBALS['options']['pass'] == 'cvs2svn');
+    return $GLOBALS['options']['pass'] === NULL || $GLOBALS['options']['pass'] == $pass;
 }
 
 function scandir_is_meta($value)
@@ -310,11 +307,27 @@
 }
 
 // -----------------------------------------------------------------------------------------------------------------------------
+// svncreate pass
+function pass_svncreate()
+{
+    $svnPath = "{$GLOBALS['options']['svnroot']}/repository";
+    if (file_exists($svnPath)) {
+        if (!is_readable($svnPath) || !is_writable($svnPath)) {
+            error("Directory '{$svnPath}' is in the way.\n");
+        }
+        // Repo already exists
+        v(2, "SVN repository already exists. Not creating.\n");
+        return;
+    }
+    v(1, "Creating SVN repository in {$svnPath}...\n");
+    $command = "exec svnadmin create " . escapeshellarg($svnPath) . " 2>&1";
+    run_command($command);
+}
+
+// -----------------------------------------------------------------------------------------------------------------------------
 // processcvs pass
-function pass_processcvs()
+function pass_cvs2svn()
 {
-    global $converter, $options;
-    
     v(1, "Running processcvs pass...\n");
 
     $converter = new CVS2SVNConverter;
@@ -337,12 +350,16 @@
     mv("{$cvsPath}/ZendEngine2", "{$cvsPath}/php-src/ZendEngine2");
     mv("{$cvsPath}/pdo-specs", "{$cvsPath}/pecl/pdo/specs");
     
-    // There are several symlinks in php-src to PECL extensions which confuse cvs2svn, so remove them. These will be properly restored later.
-    $links = array('bz2', 'hash', 'oci8', 'pdo', 'pdo_dblib', 'pdo_firebird', 'spl', 'soap', 'sqlite', 'tidy', 'xmlreader', 'xmlwriter', 'filter', 'ircg',
-        'json', 'pdo_mysql', 'pdo_oci', 'pdo_odbc', 'pdo_pgsql', 'pdo_sqlite', 'simplexml', 'fileinfo');
+    // There are several symlinks in php-src to PECL extensions which confuse cvs2svn. As decided on svn-migration@, these extensions will be moved from
+    //  PECL to php-src.
+    $links = array('bz2', 'hash', 'oci8', 'pdo', 'pdo_dblib', 'pdo_firebird', 'spl', 'soap', 'sqlite', 'tidy', 'xmlreader', 'xmlwriter', 'filter', 'json',
+        'pdo_mysql', 'pdo_oci', 'pdo_odbc', 'pdo_pgsql', 'pdo_sqlite', 'simplexml', 'fileinfo');
     foreach ($links as $link) {
         rm("{$cvsPath}/php-src/ext/{$link}");
+        mv("{$cvsPath}/pecl/{$link}", "{$cvsPath}/php-src/ext/{$link}");
     }
+    // This appears to be defunct
+    rm("{$cvsPath}/php-src/ext/ircg");
     
     // Get a base list of CVS modules.
     $cvs_modules = scandir_no_meta($cvsPath);
@@ -362,7 +379,8 @@
         // Raw files in the cvs repo, empty directories (count(scandir()) == 2 (./..)), and selected obsolete modules are not converted.
         if (!is_dir("{$cvsPath}/{$cvs_module}") || count(scandir("{$cvsPath}/{$cvs_module}")) == 2 ||
                 in_array($cvs_module, array('smarty', 'smarty-web', 'php4.fubar', 'php4.unused', 'peardoc.backup', 'php3', 'phpfi', 'livedocs',
-                    'Zend', 'functable', 'dialin', 'docstuff', 'jpgraph', 'phpoc_de', 'phpdoc-fa_IR', 'lxr', 'portal', 'pres', 'embed', 'imapd'))) {
+                    'Zend', 'functable', 'dialin', 'docstuff', 'jpgraph', 'phpoc_de', 'phpdoc-fa_IR', 'lxr', 'portal', 'pres', 'embed', 'imapd',
+                    'phpdoc-po'))) {
             rm("{$cvsPath}/{$cvs_module}");
         // Modules belonging to PHP-GTK go into cvs/gtk/<module>
         } else if (in_array($cvs_module, array('php-gtk', 'php-gtk-doc', 'old-php-gtk-modules', 'php-gtk-web'))) {
@@ -409,32 +427,8 @@
     
     // Strip any .svn dirs that might've been accidentally committed to CVS from other checkouts to avoid confusing the heck out of cvs2svn
     run_command('find ' . escapeshellarg("{$cvsPath}/pear/packages") . " -name '.svn' -type d -print0 | xargs -0 rm -Rf");
-}
-    
-// -----------------------------------------------------------------------------------------------------------------------------
-// svncreate pass
-function pass_svncreate()
-{
-    $svnPath = "{$GLOBALS['options']['svnroot']}/repository";
-    if (file_exists($svnPath)) {
-        if (!is_readable($svnPath) || !is_writable($svnPath)) {
-            error("Directory '{$svnPath}' is in the way.\n");
-        }
-        // Repo already exists
-        v(2, "SVN repository already exists. Not creating.\n");
-        return;
-    }
-    v(1, "Creating SVN repository in {$svnPath}...\n");
-    $command = "exec svnadmin create " . escapeshellarg($svnPath) . " 2>&1";
-    run_command($command);
-}
 
-// -----------------------------------------------------------------------------------------------------------------------------
-// cvs2svn pass
-function pass_cvs2svn()
-{
-    global $converter;
-    
+    // Now do the conversion
     $svnPath = "{$GLOBALS['options']['svnroot']}/repository";
     if (!is_dir($svnPath) || !is_writable($svnPath)) {
         error("SVN repository at {$svnPath} doesn't exist or isn't writable.\n");
@@ -450,124 +444,7 @@
     $converter->setOutputPath($svnPath);
     $converter->run();
 }
-
-// -----------------------------------------------------------------------------------------------------------------------------
-// ignores pass
-function pass_ignores()
-{
-/*  This is no longer necessary since cvs2svn 2.2.0.
-
-    // Recursively processes the entire converted SVN repository, converting .cvsignore files to svn:ignore properties.
-    $svnPath = "{$GLOBALS['options']['svnroot']}/repository";
-    $coDir = "{$GLOBALS['temp_path']}/ignore_co";
-    $dirStack = array($svnPath);
-    $oldCwd = getcwd();
-    
-    while (($curDir = array_pop($dirStack)) !== NULL) {
-        $itemList = run_command('svn ls file:///' . escapeshellarg($curDir));
-        if (in_array('.cvsignore', $itemList)) {
-            run_command('svn co --depth immediates file:///' . escapeshellarg($curDir) . ' ' . escapeshellarg($coDir));
-            chdir($coDir);
-            run_command('svn propset svn:ignore -F .cvsignore .');
-            run_command('svn remove .cvsignore');
-            run_command('svn commit -m ' . escapeshellarg("[SVN CONVERSION] Convert .cvsignore to svn:ignore") . ' .');
-            chdir($oldCwd);
-            rm($coDir);
-        }
-        foreach ($itemList as $item) {
-            if (substr($item, -1) == '/' && $item != 'tags/') {
-                array_push($dirStack, "{$curDir}/{$item}");
-            }
-        }
-    }
-*/
-}
-
-// -----------------------------------------------------------------------------------------------------------------------------
-// link pass
-function pass_link()
-{
-    // Re-link the PECL extensions to php-src using svn:externals.
-    // XXX THERE IS A BUG HERE WHICH IS CAUSING EXTENSIONS TO BE LINKED INTO BRANCHES THEY SHOULDN'T BE
-    $svnPath = "{$GLOBALS['options']['svnroot']}/repository/php";
-    
-    // Get a complete list of tags and branches in the converted SVN repository
-    $rawTagList = run_command('exec svn ls file:///' . escapeshellarg("{$svnPath}/php-src/tags"));
-    $rawBranchList = run_command('exec svn ls file:///' . escapeshellarg("{$svnPath}/php-src/branches"));
-    
-    $oldcwd = getcwd();
-
-    // Creates a sparse checkout of the top levels ONLY of php/php-src/trunk, php/php-src/branches/*, and php/php-src/tags/*
-    $sparseCoPath = "{$GLOBALS['temp_path']}/php-src-sparse-co";
-    $tmpfilePath = "{$GLOBALS['temp_path']}/sparse-co-output";
-    if (!file_exists($sparseCoPath)) {
-        // Checkout branches, tags, trunk
-        run_command('exec svn checkout --depth immediates file:///' . escapeshellarg("{$svnPath}/php-src") . ' ' .
-            escapeshellarg($sparseCoPath) . ' > ' . escapeshellarg($tmpfilePath));
-        // Checkout trunk
-        run_command('cd ' . escapeshellarg("{$sparseCoPath}/trunk") . ' && exec svn update --set-depth immediates >> ' . escapeshellarg($tmpfilePath));
-        // Checkout branch list
-        run_command('cd ' . escapeshellarg("{$sparseCoPath}/branches") . ' && exec svn update --set-depth immediates >> ' . escapeshellarg($tmpfilePath));
-        foreach ($rawBranchList as $branch) {
-            run_command('cd ' . escapeshellarg("{$sparseCoPath}/branches/{$branch}") .
-                ' && exec svn update --set-depth immediates >> ' . escapeshellarg($tmpfilePath));
-        }
-        // Checkout tag list
-        run_command('cd ' . escapeshellarg("{$sparseCoPath}/tags") . ' && exec svn update --set-depth immediates >> ' . escapeshellarg($tmpfilePath));
-        foreach ($rawTagList as $tag) {
-            run_command('cd ' . escapeshellarg("{$sparseCoPath}/tags/{$tag}") .
-                ' && exec svn update --set-depth immediates >> ' . escapeshellarg($tmpfilePath));
-        }
-    }
-    
-    chdir($sparseCoPath);
-    
-    // List of extensions that should be linked from PECL.
-    //  Note: This list is accurate as of 2009-06-20
-    $links = array('bz2', 'hash', 'oci8', 'pdo', 'pdo_dblib', 'pdo_firebird', 'spl', 'soap', 'sqlite', 'tidy', 'xmlreader', 'xmlwriter', 'filter', 'json',
-        'pdo_mysql', 'pdo_oci', 'pdo_odbc', 'pdo_pgsql', 'pdo_sqlite', 'simplexml', 'fileinfo');
     
-    // For each link, get its creation date from the ORIGINAL CVS root.
-    //  Then, for each tag and branch, see whether the given link has a same-named directory. If so, make a link. Always make a link for trunk.
-    $props = array();
-    $status = -1;
-    foreach ($links as $link) {
-        foreach ($rawTagList as $tag) {
-            $tag = substr($tag, 0, -1);
-            $externalPath = $svnPath . "/pecl/{$link}/tags/{$tag}";
-            run_command("exec svn ls file:///" . escapeshellarg($externalPath) . " 2>/dev/null", TRUE, $status);
-            if ($status === 0) {
-                v(2, "Tag {$tag} exists in ^/php/pecl/{$link}/tags. Adding external.\n");
-                $path = 'tags' . DIR_SEP . $tag . DIR_SEP . 'ext';
-                $props[$path] = (isset($props[$path]) ? $props[$path] : '') . "^/php/pecl/{$link}/tags/{$tag} {$link}\n";
-            } else {
-                v(2, "Tag {$tag} does NOT exist in ^/php/pecl/{$link}/tags. NOT adding external {$status}.\n");
-            }
-        }
-        foreach ($rawBranchList as $branch) {
-            $branch = substr($branch, 0, -1);
-            $externalPath = $svnPath . "/pecl/{$link}/branches/{$branch}";
-            run_command("exec svn ls file:///" . escapeshellarg($externalPath) . " 2>/dev/null", TRUE, $status);
-            if ($status === 0) {
-                v(2, "Branch {$branch} exists in ^/php/pecl/{$link}/branches. Adding external.\n");
-                $path = 'branches' . DIR_SEP . $branch . DIR_SEP . 'ext';
-                $props[$path] = (isset($props[$path]) ? $props[$path] : '') . "^/php/pecl/{$link}/branches/{$branch} {$link}\n";
-            } else {
-                v(2, "Branch {$branch} does NOT exist in ^/php/pecl/{$link}/branches. NOT adding external.\n");
-            }
-        }
-        $path = 'trunk' . DIR_SEP . 'ext';
-        $props[$path] = (isset($props[$path]) ? $props[$path] : '') . "^/php/pecl/{$link}/trunk {$link}\n";
-    }
-    
-    foreach ($props as $path => $value) {
-        run_command('exec svn propset svn:externals ' . escapeshellarg($value) . ' ' . escapeshellarg($path));
-    }
-    run_command('exec svn commit -m "[SVN CONVERSION] Reorganization in repository php-src (committing externals in php-src)."');
-    
-    chdir($oldcwd);
-}
-
 // -----------------------------------------------------------------------------------------------------------------------------
 // install pass
 function pass_install()