gwynne Sat Nov 8 20:21:14 2008 UTC
Modified files:
/SVNROOT run-conversion.php
Log:
functionalize running commands, code formatting, special-case php-src to copy
TSRM/ZendEngine2, make systems repo
http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.20&r2=1.21&diff_format=u
Index: SVNROOT/run-conversion.php
diff -u SVNROOT/run-conversion.php:1.20 SVNROOT/run-conversion.php:1.21
--- SVNROOT/run-conversion.php:1.20 Sat Nov 8 06:07:24 2008
+++ SVNROOT/run-conversion.php Sat Nov 8 20:21:14 2008
@@ -6,7 +6,7 @@
//
-----------------------------------------------------------------------------------------------------------------------------
// Constants
-$version = substr('$Revision: 1.20 $', strlen('$Revision: '), -2);
+$version = substr('$Revision: 1.21 $', strlen('$Revision: '), -2);
$passes = array(
'processcvs', // Process CVS modules
@@ -57,6 +57,17 @@
return array_filter($results, 'scandir_is_meta');
}
+function run_command($command)
+{
+ v(2, "Running '{$command}'...");
+ exec($command, $output, $exitstatus);
+ if ($exitstatus != 0) {
+ error("\nAn error occurred. Exit status was {$exitstatus}. Output:\n"
. implode("\n", $output) . "\n");
+ }
+ v(2, " done.\n");
+ return $output;
+}
+
//
-----------------------------------------------------------------------------------------------------------------------------
// Commandline options
$cmdline_parser = new Console_CommandLine(array(
@@ -163,7 +174,8 @@
$modprefix = $moduleName . '/';
foreach(scandir_no_meta($cvspath) as $module) {
if (!is_dir($cvspath . $module) ||
- count(scandir($cvspath . $module)) == 2 || $module ==
'Attic' || ($moduleName == 'pecl' && $module == 'libextractor') ||
+ count(scandir($cvspath . $module)) == 2 || $module ==
'Attic' ||
+ ($moduleName == 'pecl' && $module == 'libextractor') ||
($moduleName == 'pear' && in_array($module,
array('HTML_QuickForm_ComboBox', 'Services_Compete', 'XML_HTMLSax3')))) {
continue; // empty dir
}
@@ -180,6 +192,22 @@
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'] . DIRECTORY_SEPARATOR .
'php-src') .
+
escapeshellarg($GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'php-src') .
+ ' > ' .
escapeshellarg($GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'cp-output');
+ run_command($command);
+ $command = 'exec cp -Rpv ' .
escapeshellarg($GLOBALS['options']['cvsroot'] . DIRECTORY_SEPARATOR .
'ZendEngine2') .
+
escapeshellarg($GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'php-src/') .
+ ' >> ' .
escapeshellarg($GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'cp-output');
+ run_command($command);
+ $command = 'exec cp -Rpv ' .
escapeshellarg($GLOBALS['options']['cvsroot'] . DIRECTORY_SEPARATOR . 'TSRM') .
+
escapeshellarg($GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'php-src/') .
+ ' >> ' .
escapeshellarg($GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 'cp-output');
+ run_command($command);
+ $cvspath = $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR .
'php-src';
+ }
$this->optionsFileContents .= <<<EOEXTRA
run_options.add_project(
'{$cvspath}',
@@ -273,12 +301,7 @@
}
$command = "exec svnadmin create " .
escapeshellarg($this->svnRepositoryPath) . " 2>&1";
v(1, "Creating SVN repository for '{$this->repositoryName}' in
{$this->svnRepositoryPath}...\n");
- v(2, "Running: '{$command}'...");
- exec($command, $output, $exitstatus);
- if ($exitstatus != 0) {
- error("\nAn error occurred. Exit status was {$exitstatus}.
Output:\n" . implode("\n", $output) . "\n", $exitstatus);
- }
- v(2, " done.\n");
+ run_command($command);
}
public function importCVSModules()
@@ -287,7 +310,7 @@
error("SVN repository at {$this->svnRepositoryPath} doesn't exist
or isn't writable.\n");
}
- if (trim(system('svnlook youngest ' .
escapeshellarg($this->svnRepositoryPath))) != 0) {
+ if (trim(end(run_command('svnlook youngest ' .
escapeshellarg($this->svnRepositoryPath)))) != 0) {
return; // Repo isn't empty
}
@@ -303,13 +326,7 @@
private function executeSVNCommand($cmd)
{
$realCommand = "exec svn {$cmd} 2>&1";
- v(2, "Running: '{$realCommand}'...");
- exec($realCommand, $output, $exitstatus);
- if ($exitstatus != 0) {
- error("\nAn error occurred. Exit status was {$exitstatus}.
Output:\n" . implode("\n", $output) . "\n", $exitstatus);
- }
- v(2, " done.\n");
- return $output;
+ return run_command($realCommand);
}
private function mkdirPath($path, $message)
@@ -394,7 +411,7 @@
$repoList['phd'] = new Repository('phd');
$repoList['pear1'] = new Repository('pear');
$repoList['gd'] = new Repository('gd');
- // $repoList['other'] = new Repository('other');
+ $repoList['systems'] = new Repository('systems');
$cvs_modules = scandir_no_meta($options['cvsroot']);
foreach ($cvs_modules as $cvs_module) {
@@ -406,11 +423,14 @@
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',
'SVNROOT'))) {
+ '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);
} else if (in_array($cvs_module, array('php-gtk', 'php-gtk-doc',
'old-php-gtk-modules'))) {
$repoList['gtk']->addCVSModule($cvs_module);
- } else if (in_array($cvs_module, array('TSRM', 'ZendAPI',
'ZendEngine2', 'php-src', 'pecl', 'pecl4win', 'php-objc', 'php-lang',
+ } 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') {
@@ -419,12 +439,10 @@
$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');
- } else if (substr($cvs_module, -3) == "web" || in_array($cvs_module,
array('pres2', 'presentations', 'bugtracker', 'systems'))) {
+ } 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);
- } else {
- // $repoList['other']->addCVSModule($cvs_module);
}
}
@@ -521,12 +539,7 @@
}
if (!file_exists($GLOBALS['options']['svnroot'] . DIRECTORY_SEPARATOR .
'svn.users')) {
$command = 'htpasswd -bcm ' .
escapeshellarg($GLOBALS['options']['svnroot'] . DIRECTORY_SEPARATOR .
'svn.users') . ' svnread svnread';
- v(2, "Executing '{$command}'...");
- exec($command, $output, $exitstatus);
- if ($exitstatus != 0) {
- error("\nAn error occurred. Exit status was {$exitstatus}.
Output:\n" . implode("\n", $output) . "\n");
- }
- v(2, " done.\n");
+ run_command($command);
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php