cvs: SVNROOT / run-conversion.php svn.users users.db

[email protected] ("Gwynne Raskind")
Newsgroups svn.migration
Message-ID <cvsgwynne1228335672@cvsserver>
gwynne		Wed Dec  3 20:21:12 2008 UTC

  Added files:                 
    /SVNROOT	users.db 

  Removed files:               
    /SVNROOT	svn.users 

  Modified files:              
    /SVNROOT	run-conversion.php 
  Log:
  correct filename
gwynne-20081203202112.txt (text/plain, 27.2 KB)
http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.48&r2=1.49&diff_format=u
Index: SVNROOT/run-conversion.php
diff -u SVNROOT/run-conversion.php:1.48 SVNROOT/run-conversion.php:1.49
--- SVNROOT/run-conversion.php:1.48	Mon Nov 17 20:35:26 2008
+++ SVNROOT/run-conversion.php	Wed Dec  3 20:21:11 2008
@@ -7,7 +7,7 @@
 
 // -----------------------------------------------------------------------------------------------------------------------------
 // Constants
-$version = substr('$Revision: 1.48 $', strlen('$Revision: '), -2);
+$version = substr('$Revision: 1.49 $', strlen('$Revision: '), -2);
 
 $passes = array(
     'processcvs',       // Process CVS modules
@@ -76,6 +76,21 @@
     return $output;
 }
 
+function cp($source, $dest)
+{
+    run_command("cp " . escapeshellarg($source) . ' ' . escapeshellarg($dest));
+}
+
+function mv($source, $dest)
+{
+    run_command("cp " . escapeshellarg($source) . ' ' . escapeshellarg($dest));
+}
+
+function rm($path)
+{
+    run_command("rm -Rf " . escapeshellarg($path));
+}
+
 // -----------------------------------------------------------------------------------------------------------------------------
 // Commandline options
 $cmdline_parser = new Console_CommandLine(array(
@@ -98,7 +113,7 @@
     'short_name' => '-s',
     'long_name' => '--svnroot',
     'default' => '/home/svn',
-    'description' => 'Specify the directory for SVN repositories.',
+    'description' => 'Specify the directory for the SVN repository and its administrative files.',
     'action' => 'StoreString'));
 $cmdline_parser->addOption('pass', array(
     'short_name' => '-p',
@@ -135,11 +150,8 @@
 }
 $options['cvsroot'] = realpath($options['cvsroot']);
 
-if (!is_dir($options['svnroot']) || !is_readable($options['svnroot']) || !is_executable($options['svnroot'])) {
-    error("SVN root directory must exist, be a directory, and be readable and searchable.\n");
-}
-if (is_running_pass('svncreate') && !is_writable($options['svnroot'])) {
-    error("SVN root directory must be writable if running the svncreate pass.\n");
+if (!is_dir($options['svnroot']) || !is_readable($options['svnroot']) || !is_executable($options['svnroot']) || !is_writable($options['svnroot'])) {
+    error("SVN root directory must exist, be a directory, and be readable, writable, and searchable.\n");
 }
 $options['svnroot'] = realpath($options['svnroot']);
 
@@ -200,26 +212,6 @@
 EOEXTRA;
             }
         } else {
-            if ($moduleName == 'php-src') {
-                // We special-case php-src so we can move TSRM and ZendEngine2 into it easily. Ugh.
-                $command = 'exec cp -Rpv ' . escapeshellarg($GLOBALS['options']['cvsroot'] . DIR_SEP . 'php-src') . ' ' .
-                                             escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'php-src') .
-                                             ' 2>&1 > ' . escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'cp-output');
-                run_command($command);
-                $command = 'exec cp -Rpv ' . escapeshellarg($GLOBALS['options']['cvsroot'] . DIR_SEP . 'ZendEngine2') . ' ' .
-                                             escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'php-src') .
-                                             ' 2>&1 >> ' . escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'cp-output');
-                run_command($command);
-                $command = 'exec cp -Rpv ' . escapeshellarg($GLOBALS['options']['cvsroot'] . DIR_SEP . 'TSRM') . ' ' .
-                                             escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'php-src') .
-                                             ' 2>&1 >> ' . escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'cp-output');
-                run_command($command);
-                $command = 'exec cp -Rpv ' . escapeshellarg($GLOBALS['options']['cvsroot'] . DIR_SEP . 'CVSROOT') . ' ' .
-                                             escapeshellarg($GLOBALS['temp_path']) .
-                                             ' 2>&1 >> ' . escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'cp-output');
-                run_command($command, TRUE);
-                $cvspath = $GLOBALS['temp_path'] . DIR_SEP . 'php-src';
-            }
             $this->optionsFileContents .= <<<EOEXTRA
 run_options.add_project(
     '{$cvspath}',
@@ -264,188 +256,6 @@
     }
 }
 
-// Repository: A collection of related modules
-class Repository
-{
-    private     $repositoryName = NULL;
-    private     $cvsModuleList = array();
-    private     $svnRepositoryPath = NULL;
-    private     $renamingRules = array();
-    
-    public function __construct($repoName)
-    {
-        $this->repositoryName = $repoName;
-        $this->svnRepositoryPath = $GLOBALS['options']['svnroot'] . DIR_SEP . $this->repositoryName;
-    }
-    
-    public function __toString()
-    {
-        $result  = "Repository named '{$this->repositoryName}'.\n";
-        $result .= "\tCVS modules:\n\t\t";
-        $modList = '';
-        foreach ($this->cvsModuleList as $mod => $meta) {
-            $modList .= $mod . " " . ($meta ? "(meta) " : "");
-        }
-        $result .= wordwrap($modList, 80, "\n\t\t") . "\n";
-//      $result .= "\tRenaming rules:\n\t\t";
-//      $result .= wordwrap(str_replace("\n", "\n\t\t", print_r($this->renamingRules, 1)), 80, "\n\t\t");
-        return trim($result);
-    }
-    
-    public function addCVSModule($module, $isMeta = FALSE)
-    {
-        $this->cvsModuleList[$module] = $isMeta;
-    }
-    
-    public function addRenameRule($rule)
-    {
-        $this->renamingRules[] = $rule;
-    }
-    
-    public function createSVNRepository()
-    {
-        if (file_exists($this->svnRepositoryPath)) {
-            if (!is_readable($this->svnRepositoryPath) || !is_writable($this->svnRepositoryPath)) {
-                error("Directory '{$this->svnRepositoryPath}' is in the way.\n");
-            }
-            // Repo already exists
-            return;
-        }
-        $command = "exec svnadmin create " . escapeshellarg($this->svnRepositoryPath) . " 2>&1";
-        v(1, "Creating SVN repository for '{$this->repositoryName}' in {$this->svnRepositoryPath}...\n");
-        run_command($command);
-    }
-    
-    public function importCVSModules()
-    {
-        if (!is_dir($this->svnRepositoryPath) || !is_writable($this->svnRepositoryPath)) {
-            error("SVN repository at {$this->svnRepositoryPath} doesn't exist or isn't writable.\n");
-        }
-        
-        $output = run_command('svnlook youngest ' . escapeshellarg($this->svnRepositoryPath));
-        if (trim(end($output)) != 0) {
-            return; // Repo isn't empty
-        }
-        
-        v(1, "Running cvs2svn for '{$this->repositoryName}'...\n");
-        $converter = new CVS2SVNConverter($this->repositoryName);
-        $converter->setOutputPath($this->svnRepositoryPath);
-        foreach ($this->cvsModuleList as $cvs_module => $isMeta) {
-            $converter->addCVSModule($cvs_module, $isMeta);
-        }
-        $converter->run();
-    }
-    
-    private function executeSVNCommand($cmd)
-    {
-        $realCommand = "exec svn {$cmd} 2>&1";
-        return run_command($realCommand);
-    }
-    
-    private function mkdirPath($path, $message)
-    {
-        $this->executeSVNCommand('mkdir -m ' . escapeshellarg($message) .
-                                 ' file:///' . escapeshellarg($this->svnRepositoryPath) . '/' . escapeshellarg($path));
-    }
-    
-    private function deletePath($path, $message)
-    {
-        $this->executeSVNCommand('rm -m ' . escapeshellarg($message) .
-                                 ' file:///' . escapeshellarg($this->svnRepositoryPath) . '/' . escapeshellarg($path));
-    }
-    
-    private function movePath($srcPath, $dstPath, $message)
-    {
-        $this->executeSVNCommand('mv -m ' . escapeshellarg($message) .
-                                 ' file:///' . escapeshellarg($this->svnRepositoryPath) . '/' . escapeshellarg($srcPath) .
-                                 ' file:///' . escapeshellarg($this->svnRepositoryPath) . '/' . escapeshellarg($dstPath));
-    }
-    
-    private function renameMatchingPaths($base, $match, $replacement, $message)
-    {
-        $basePath = 'file:///' . escapeshellarg($this->svnRepositoryPath) . '/' . escapeshellarg($base);
-        $completeList = $this->executeSVNCommand('ls ' . $basePath);
-        foreach ($completeList as $value) {
-            if (preg_match($match, $value) === 1) {
-                $dstPath = preg_replace($match, $replacement, $value);
-                $this->executeSVNCommand('mv -m ' . escapeshellarg($message) .
-                                         ' ' . $basePath . '/' . escapeshellarg($value) . ' ' . $basePath . '/' . escapeshellarg($dstPath));
-            }
-        }
-    }
-    
-    public function fixupRepository()
-    {
-        v(1, "Executing fixup commands for repository '{$this->repositoryName}'...\n");
-        $message = "[SVN CONVERSION] Reorganization in repository {$this->repositoryName}.";
-        foreach ($this->renamingRules as $rule) {
-            switch ($rule['mode']) {
-                case 'mkdir':
-                    $this->mkdirPath($rule['srcPath'], $message);
-                    break;
-                case 'delete':
-                    $this->deletePath($rule['srcPath'], $message);
-                    break;
-                case 'move':
-                    $this->movePath($rule['srcPath'], $rule['dstPath'], $message);
-                    break;
-                case 'rename':
-                    $this->renameMatchingPaths($rule['basePath'], $rule['match'], $rule['replacement'], $message);
-                    break;
-            }
-        }
-        v(1, "Done fixing up.\n");
-    }
-    
-    public function installAdminFiles()
-    {
-        v(1, "Installing administrative files for repository '{$this->repositoryName}'...\n");
-        v(2, "Installing e-mail post-commit hook...\n");
-        symlink($GLOBALS['options']['svnroot'] . DIR_SEP . 'SVNROOT' . DIR_SEP . 'commit-email.php', 
-            $this->svnRepositoryPath . DIR_SEP . 'hooks' . DIR_SEP . 'post-commit');
-        $authzDB = $this->svnRepositoryPath . DIR_SEP . 'conf' . DIR_SEP . 'authz.db';
-        if (!file_exists($authzDB)) {
-            v(2, "Installing authz database...\n");
-            file_put_contents($authzDB, <<<EOAUTHZ
-[groups]
-
-[aliases]
-
-[/]
-svnread = r
-
-EOAUTHZ
-            );
-        } else {
-            v(2, "Not overwriting existing authz database.\n");
-        }
-        v(2, "Installing Apache 2.2 config file...\n");
-        $usersDB = $GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.users';
-        file_put_contents($this->svnRepositoryPath . DIR_SEP . 'conf' . DIR_SEP . 'httpd.conf', <<<EOHTTPD
-# This file is intended to be Included from inside an Apache 2.2 VirtualHost section.
-    <Location "/{$this->repositoryName}">
-        DAV svn
-        SVNPath "{$this->svnRepositoryPath}"
-        AuthzSVNAccessFile "{$authzDB}"
-        Satisfy All
-        Require valid-user
-        AuthType Digest
-        AuthName "PHP Subversion Repositories"
-        AuthUserFile "{$usersDB}"
-        AuthDigestDomain "/{$this->repositoryName}"
-    </Location>
-
-EOHTTPD
-        );
-        v(1, "Done installing administrative files.\n");
-    }
-    
-    public function getHTTPDConfPath()
-    {
-        return $this->svnRepositoryPath . DIR_SEP . 'conf' . DIR_SEP . 'httpd.conf';
-    }
-}
-
 // -----------------------------------------------------------------------------------------------------------------------------
 // Main
 v(1, "PHP Group CVS->SVN respository conversion.\n");
@@ -470,88 +280,66 @@
 // processcvs pass
 function pass_processcvs()
 {
-    global $repoList, $options;
+    global $converter, $options;
     
     v(1, "Running processcvs pass...\n");
 
-    $repoList = array();
-    $repoList['doc'] = new Repository('php-doc');
-    $repoList['gtk'] = new Repository('php-gtk');
-    $repoList['src'] = new Repository('php-src');
-    $repoList['web'] = new Repository('php-web');
-    $repoList['phd'] = new Repository('phd');
-    $repoList['pear1'] = new Repository('pear');
-    $repoList['gd'] = new Repository('gd');
-    $repoList['systems'] = new Repository('systems');
-
-    $cvs_modules = scandir_no_meta($options['cvsroot']);
+    $converter = new CVS2SVNConverter;
+    
+    $cvsPath = "{$GLOBALS['temp_path']}/cvsrepo";
+    cp($GLOBALS['options']['cvsroot'], $cvsPath);
+    
+    mv("{$cvsPath}/phpdoc", "{$cvsPath}/doc-base");
+    mv("{$cvsPath}/doc-base/en", "{$cvsPath}/phpdoc-en");
+    mv("{$cvsPath}/pear", "{$cvsPath}/modules");
+    mv("{$cvsPath}/TSRM", "{$cvsPath}/php-src/TSRM");
+    mv("{$cvsPath}/ZendEngine2", "{$cvsPath}/php-src/ZendEngine2");
+    mv("{$cvsPath}/pdo-specs", "{$cvsPath}/pecl/pdo/specs");
+    
+    mkdir("{$cvsPath}/gtk");
+    mkdir("{$cvsPath}/php");
+    mkdir("{$cvsPath}/pear");
+    mkdir("{$cvsPath)/web");
+    mkdir("{$cvsPath}/phpdoc");
+    
+    $cvs_modules = scandir_no_meta($cvsPath);
     foreach ($cvs_modules as $cvs_module) {
         if ($cvs_module == 'CVSROOT') {
             continue;
         }
         if (!is_dir($options['cvsroot'] . DIR_SEP . $cvs_module) ||
-                count(scandir($options['cvsroot'] . DIR_SEP . $cvs_module)) == 2) {    // empty
-            continue;
-        }
-        if (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',
-                'ZendEngine2', 'TSRM'))) {
-            continue;
-        } else if (in_array($cvs_module, array('systems', 'SVNROOT'))) {
-            $repoList['systems']->addCVSModule($cvs_module);
+                count(scandir($options['cvsroot'] . DIR_SEP . $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'))) {
+            rm("{$cvsPath}/{$cvs_module}");
         } else if (in_array($cvs_module, array('php-gtk', 'php-gtk-doc', 'old-php-gtk-modules'))) {
-            $repoList['gtk']->addCVSModule($cvs_module);
+            mv("{$cvsPath}/{$cvs_module}", "{$cvsPath}/gtk/{$cvs_module}");
+            $converter->addCVSModule("gtk/{$cvs_module}");
         } else if (in_array($cvs_module, array('ZendAPI', 'php-src', 'pecl', 'pecl4win', 'php-objc', 'php-lang',
                 'win-installer', 'bindlib_w32', 'zlib', 'pdo-specs', 'php-internals-win', 'fastcgi-isapi'))) {
-            $repoList['src']->addCVSModule($cvs_module, $cvs_module == 'pecl');
-        } else if ($cvs_module == 'phd') {
-            $repoList['phd']->addCVSModule($cvs_module);
-        } else if ($cvs_module == 'gd') {
-            $repoList['gd']->addCVSModule($cvs_module);
-        } else if (in_array($cvs_module, array('pear', 'pearbot', 'pear-core', 'peardoc'))) {
-            $repoList['pear1']->addCVSModule($cvs_module, $cvs_module == 'pear');
+            mv("{$cvsPath}/{$cvs_module}", "{$cvsPath}/php/{$cvs_module}");
+            $converter->addCVSModule("php/{$cvs_module}", $cvs_module == 'pecl');
+        } else if (in_array($cvs_module, array('modules', 'pearbot', 'pear-core', 'peardoc'))) {
+            mv("{$cvsPath}/{$cvs_module}", "{$cvsPath}/pear/{$cvs_module}");
+            $converter->addCVSModule("pear/{$cvs_module}", $cvs_module == 'modules');
         } else if (substr($cvs_module, -3) == "web" || in_array($cvs_module, array('pres2', 'presentations', 'bugtracker'))) {
-            $repoList['web']->addCVSModule($cvs_module);
-        } else if (strncmp($cvs_module, "phpdoc", 6) == 0) {
-            $repoList['doc']->addCVSModule($cvs_module);
+            if (substr($cvs_module, -4) == '-web') {
+                $dest_cvs_module = substr($cvs_module, 0, -4);
+            } else if (substr($cvs_module, -3) == 'web') {
+                $dest_cvs_module = substr($cvs_module, 0, -3);
+            }
+            mv("{$cvsPath}/{$cvs_module}", "{$cvsPath}/web/{$dest_cvs_module}");
+            $converter->addCVSModule("web/{$dest_cvs_module}");
+        } else if (strncmp($cvs_module, "phpdoc", 6) == 0 || $cvs_module == 'doc-base') {
+            if (substr($cvs_module, 7) == 'phpdoc-') {
+                $dest_cvs_module = substr($cvs_module, 7);
+            }
+            mv("{$cvsPath}/{$cvs_module}", "{$cvsPath}/phpdoc/{$dest_cvs_module}");
+            $converter->addCVSModule("phpdoc/{$dest_cvs_module}");
         }
     }
     
-    // Fixup rules for php-doc
-    $repoList['doc']->addRenameRule(array('mode' => 'mkdir', 'srcPath' => 'en'));
-    $repoList['doc']->addRenameRule(array('mode' => 'mkdir', 'srcPath' => 'en/tags'));
-    $repoList['doc']->addRenameRule(array('mode' => 'mkdir', 'srcPath' => 'en/branches'));
-    $repoList['doc']->addRenameRule(array('mode' => 'move', 'srcPath' => 'phpdoc/trunk/en', 'dstPath' => 'en/trunk'));
-    $repoList['doc']->addRenameRule(array('mode' => 'move', 'srcPath' => 'phpdoc', 'dstPath' => 'doc-base'));
-    $repoList['doc']->addRenameRule(array('mode' => 'rename', 'basePath' => '', 'match' => '/^phpdoc-(.*)$/', 'replacement' => "\\1"));
-    // Fixup rules for php-src
-    $repoList['src']->addRenameRule(array('mode' => 'move', 'srcPath' => 'pdo-specs/trunk', 'dstPath' => 'pecl/pdo/trunk/specs'));
-    $repoList['src']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pdo-specs'));
-    // Fixup rules for pear1
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/tests/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/tests/events/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/tests/html/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/docs/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/examples/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/tags/start/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/tags/start/tests/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/tags/start/tests/events/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/tags/start/tests/html/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/tags/start/docs/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/tags/start/examples/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/branches/shin/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/branches/shin/tests/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/branches/shin/tests/events/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/branches/shin/tests/html/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/branches/shin/docs/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/branches/shin/examples/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/tags/start/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/tags/start/tests/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/tags/start/tests/events/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/tags/start/tests/html/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/tags/start/docs/.svn'));
-    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Testing_Selenium/tags/start/examples/.svn'));
+    run_command('find ' . escapeshellarg("{$cvsPath}/pear/modules") . " -name '.svn' -type d -print0 | xargs -0 rm -Rf");
 
     v(2, "Prepared " . count($repoList) . " SVN repositories.\n");
     foreach ($repoList as $repo) {
@@ -563,38 +351,53 @@
 // svncreate pass
 function pass_svncreate()
 {
-    foreach ($GLOBALS['repoList'] as $repo) {
-        $repo->createSVNRepository();
-    }
+    $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()
 {
-    foreach ($GLOBALS['repoList'] as $repo) {
-        $repo->importCVSModules();
+    global $converter;
+    
+    $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");
     }
-}
-
-// -----------------------------------------------------------------------------------------------------------------------------
-// cleanup pass
-function pass_cleanup()
-{
-    foreach ($GLOBALS['repoList'] as $repo) {
-        $repo->fixupRepository();
+    
+    $output = run_command('svnlook youngest ' . escapeshellarg($svnPath));
+    if (trim(end($output)) != 0) {
+        v(2 "SVN repository isn't empty. Not converting.\n");
+        return; // Repo isn't empty
     }
+    
+    v(1, "Running cvs2svn for '{$this->repositoryName}'...\n");
+    $converter->setOutputPath($svnPath);
+    $converter->run();
 }
 
 // -----------------------------------------------------------------------------------------------------------------------------
 // link pass
 function pass_link()
 {
-    $rawTagList = run_command('exec svn ls file:///' . escapeshellarg($GLOBALS['options']['svnroot'] . '/php-src/php-src/tags'));
-    $rawBranchList = run_command('exec svn ls file:///' . escapeshellarg($GLOBALS['options']['svnroot'] . '/php-src/php-src/branches'));
+    $svnPath = "{$GLOBALS['options']['svnroot']}/repository/php/php-src";
+
+    $rawTagList = run_command('exec svn ls file:///' . escapeshellarg("{$svnPath}/tags"));
+    $rawBranchList = run_command('exec svn ls file:///' . escapeshellarg("{$svnPath}/branches"));
     
     if (!file_exists($GLOBALS['temp_path'] . DIR_SEP . 'php-src-co')) {
-        run_command('exec svn checkout file:///' . escapeshellarg($GLOBALS['options']['svnroot'] . '/php-src/php-src') . ' ' .
+        run_command('exec svn checkout file:///' . escapeshellarg($svnPath) . ' ' .
             escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'php-src-co') . ' 2>&1 > ' .
             escapeshellarg($GLOBALS['temp_path'] . DIR_SEP . 'co-output'));
     }
@@ -605,14 +408,14 @@
     $branchList = array();
     foreach ($rawTagList as $tag) {
         $realTag = substr($tag, 0, -1);
-        $xml = run_command('exec svn info --xml file:///' . escapeshellarg($GLOBALS['options']['svnroot'] . '/php-src/php-src/tags/' . $realTag));
+        $xml = run_command('exec svn info --xml file:///' . escapeshellarg("{$svnPath}/tags/{$realTag}"));
         $xml = implode("\n", $xml);
         $tagList[$realTag] = strtotime(substr($xml, strpos($xml, '<date>') + 6, strlen('0000-00-00T00:00:00.000000Z')));
         run_command('exec svn propdel svn:externals ' . escapeshellarg('tags' . DIR_SEP . $realTag . DIR_SEP . 'ext') . ' 2>&1');
     }
     foreach ($rawBranchList as $branch) {
         $realBranch = substr($branch, 0, -1);
-        $xml = run_command('exec svn info --xml file:///' . escapeshellarg($GLOBALS['options']['svnroot'] . '/php-src/php-src/branches/' . $realBranch));
+        $xml = run_command('exec svn info --xml file:///' . escapeshellarg("{$svnPath}/branches/{$realBranch}"));
         $xml = implode("\n", $xml);
         $branchList[$realBranch] = strtotime(substr($xml, strpos($xml, '<date>') + 6, strlen('0000-00-00T00:00:00.000000Z')));
         run_command('exec svn propdel svn:externals ' . escapeshellarg('branches' . DIR_SEP . $realBranch . DIR_SEP . 'ext') . ' 2>&1');
@@ -655,22 +458,6 @@
 // install pass
 function pass_install()
 {
-    foreach ($GLOBALS['repoList'] as $repo) {
-        $repo->installAdminFiles();
-    }
-    v(1, "Installing global administrative files...\n");
-    $usersDB = $GLOBALS['options']['svnroot'] . DIR_SEP . 'svn.users';
-    if (!file_exists($usersDB)) {
-        v(2, "Installing global user database...\n");
-        $svnreadpass = md5('svnread:PHP Subversion Repositories:svnread');
-        file_put_contents($usersDB, <<<EOUSERS
-svnread:PHP Subversion Repositories:{$svnreadpass}
-
-EOUSERS
-            );
-    } else {
-        v(2, "Not overwriting existing global user database.\n");
-    }
     v(2, "Installing global Apache 2.2 configuration file....\n");
     $svnRoot = $GLOBALS['options']['svnroot'];
     $logsDir = $svnRoot . DIR_SEP . 'logs' . DIR_SEP;
@@ -678,22 +465,29 @@
     $confContents = <<<EOHTTPD
 <VirtualHost *:80>
     ServerName svn.php.net
-    DocumentRoot "{$svnRoot}"
-    <Directory "/">
-        Order allow,deny
-        Allow from all
-    </Directory>
-    LogLevel debug
     CustomLog "|/local/bin/rotatelogs {$logsDir}/svn-svn_log.%Y%m%d 86400" "%t %u %{SVN-ACTION}e" env=SVN-ACTION
     CustomLog "|/local/bin/rotatelogs {$logsDir}/svn-access_log.%Y%m%d 86400" combined
     ErrorLog "|/local/bin/rotatelogs {$logsDir}/svn-error_log.%Y%m%d 86400"
+    <Location "/">
+        DAV svn
+        SVNPath "{$svnRoot}/repository"
+        AuthzSVNAccessFile "{$svnRoot]/SVNROOT/authz.db"
+        Satisfy All
+        Require valid-user
+        AuthType Digest
+        AuthName "PHP Subversion Repositories"
+        AuthUserFile "{$svnRoot}/SVNROOT/users.db"
+        AuthDigestDomain "/"
+    </Location>
+</VirtualHost>
 
 EOHTTPD;
-    foreach ($GLOBALS['repoList'] as $repo) {
-        $confContents .= "    Include " . $repo->getHTTPDConfPath() . "\n";
-    }
-    $confContents .= "</VirtualHost>\n";
     file_put_contents($apacheConf, $confContents);
+
+    v(2, "Installing e-mail post-commit hook...\n");
+    unlink("{$svnRoot}/repository/hooks/post-commit");
+    symlink("{$svnRoot}/SVNROOT/commit-email.php", "{$svnRoot}/repository/hooks/post-commit");
+
     v(1, "Done installing global administrative files.\n");
 }
 

http://cvs.php.net/viewvc.cgi/SVNROOT/users.db?view=markup&rev=1.1
Index: SVNROOT/users.db
+++ SVNROOT/users.db
svnread:PHP Subversion Repositories:cb3d4eb7c0848cbbc8d68acabb0e4c3b
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.