From 1e80d9705de3b54404bc8a701ba1bbd761e75b6e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 5 Jun 2011 10:32:19 +0000 Subject: [PATCH] added parameter to run a command after copying checkout to buildroot, eg. to apply a patch or replace some files --- doc/rpm-build/checkout-build-archives.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/rpm-build/checkout-build-archives.php b/doc/rpm-build/checkout-build-archives.php index 3b7862eae4..355305898e 100755 --- a/doc/rpm-build/checkout-build-archives.php +++ b/doc/rpm-build/checkout-build-archives.php @@ -11,7 +11,7 @@ if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling setup-cli as web-page { - die('

checkout-build-tgz.php must NOT be called as web-page --> exiting !!!

'); + die('

checkout-build-archives.php must NOT be called as web-page --> exiting !!!

'); } date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings @@ -46,7 +46,8 @@ $config = array( 'release' => 'root@download.stylite.de:/var/www/html/stylite-epl/stylite-epl-$version/', 'copychangelog' => 'root@download.stylite.de:/var/www/html/stylite-epl/stylite-epl-$version/changelog.txt', 'skip' => array(), - 'run' => array('editsvnchangelog','svntag','checkout','copy','virusscan','create','sign','obs') + 'run' => array('editsvnchangelog','svntag','checkout','copy','virusscan','create','sign','obs'), + 'patchCmd' => '# run cmd after copy eg. "cd $egw_buildroot; patch -p1 /path/to/patch"', ); // process config from command line @@ -558,6 +559,17 @@ function do_copy() $cmd = '/usr/bin/rsync -r --delete --exclude .svn '.$config['svndir'].'/'.$config['aliasdir'].' '.$config['egw_buildroot']; 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 echo "Fixing permissions\n"; chdir($config['egw_buildroot'].'/'.$config['aliasdir']);