added parameter to run a command after copying checkout to buildroot, eg. to apply a patch or replace some files

This commit is contained in:
Ralf Becker 2011-06-05 10:30:30 +00:00
parent d4d02a09d4
commit d0800ffafa

View File

@ -11,7 +11,7 @@
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling setup-cli as web-page if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling setup-cli as web-page
{ {
die('<h1>checkout-build-tgz.php must NOT be called as web-page --> exiting !!!</h1>'); die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
} }
date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings
@ -42,7 +42,8 @@ $config = array(
'editor' => '/usr/bin/vi', 'editor' => '/usr/bin/vi',
'svntag' => false, // eg. '$version.$packaging' 'svntag' => false, // eg. '$version.$packaging'
'skip' => array(), 'skip' => array(),
'run' => array('checkout','copy','virusscan','create','sign') 'run' => array('checkout','copy','virusscan','create','sign'),
'patchCmd' => '# run cmd after copy eg. "cd $egw_buildroot; patch -p1 /path/to/patch"',
); );
// process config from command line // process config from command line
@ -491,6 +492,17 @@ function do_copy()
$cmd = '/usr/bin/rsync -r --delete --exclude .svn '.$config['svndir'].'/'.$config['aliasdir'].' '.$config['egw_buildroot']; $cmd = '/usr/bin/rsync -r --delete --exclude .svn '.$config['svndir'].'/'.$config['aliasdir'].' '.$config['egw_buildroot'];
run_cmd($cmd); run_cmd($cmd);
if (($cmd = $config['patchCmd']) && $cmd[0] != '#')
{
if (strpos($cmd,'$') !== false) // allow to use config vars like $svnbranch in module
{
$translate = array();
foreach($config as $name => $value) $translate['$'.$name] = $value;
$cmd = strtr($cmd,$translate);
}
echo "Running $cmd\n";
run_cmd($cmd);
}
// fix permissions // fix permissions
echo "Fixing permissions\n"; echo "Fixing permissions\n";
chdir($config['egw_buildroot'].'/'.$config['aliasdir']); chdir($config['egw_buildroot'].'/'.$config['aliasdir']);