forked from extern/egroupware
parameter to copy changelog automatically eg. to sf.net
This commit is contained in:
parent
98954c82f0
commit
ac6919df09
@ -44,6 +44,7 @@ $config = array(
|
||||
'editor' => '/usr/bin/vi',
|
||||
'svntag' => 'tags/Stylite-EPL-$version.$packaging', // eg. '$version.$packaging'
|
||||
'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')
|
||||
);
|
||||
@ -87,10 +88,11 @@ while(($arg = array_shift($argv)))
|
||||
|
||||
case 'svntag':
|
||||
case 'release':
|
||||
case 'copychangelog':
|
||||
$config[$name] = $value;
|
||||
array_unshift($config['run'],$name);
|
||||
break;
|
||||
|
||||
|
||||
case 'editsvnchangelog':
|
||||
$config[$name] = $value ? $value : true;
|
||||
if (!in_array('editsvnchangelog',$config['run']))
|
||||
@ -147,6 +149,25 @@ function do_release()
|
||||
passthru($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy changelog by rsync'ing it to a distribution / download directory
|
||||
*/
|
||||
function do_copychangelog()
|
||||
{
|
||||
global $config,$verbose;
|
||||
|
||||
$changelog = __DIR__.'/debian.changes';
|
||||
$target = $config['copychangelog'];
|
||||
if (strpos($target,'$') !== false) // allow to use config vars like $svnbranch in module
|
||||
{
|
||||
$translate = array();
|
||||
foreach($config as $name => $value) $translate['$'.$name] = $value;
|
||||
$target = strtr($target,$translate);
|
||||
}
|
||||
$cmd = $config['rsync'].' '.$changelog.' '.$target;
|
||||
passthru($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query changelog from svn and let user edit it
|
||||
*/
|
||||
@ -204,7 +225,7 @@ function do_editsvnchangelog()
|
||||
|
||||
/**
|
||||
* Read changelog for given branch from (last) tag or given revision from svn
|
||||
*
|
||||
*
|
||||
* @param string $branch_url='svn+ssh://svn@svn.stylite.de/egroupware/branches/Stylite-EPL-10.1'
|
||||
* @param string $log_pattern=null a preg regular expression or start of line a log message must match, to be returned
|
||||
* if regular perl regular expression given only first expression in brackets \\1 is used,
|
||||
@ -216,7 +237,7 @@ function get_changelog_from_svn($branch_url,$log_pattern=null,&$revision,$prefix
|
||||
{
|
||||
//echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n";
|
||||
global $config,$verbose,$svn;
|
||||
|
||||
|
||||
if (is_null($revision))
|
||||
{
|
||||
list($tags_url,$branch) = explode('/branches/',$branch_url);
|
||||
@ -239,7 +260,7 @@ function get_changelog_from_svn($branch_url,$log_pattern=null,&$revision,$prefix
|
||||
run_cmd($cmd,$output);
|
||||
$verbose = $v;
|
||||
array_shift($output); // remove the command
|
||||
|
||||
|
||||
$xml = simplexml_load_string($output=implode("\n",$output));
|
||||
$message = '';
|
||||
$pattern_len = strlen($log_pattern);
|
||||
@ -269,7 +290,7 @@ function get_changelog_from_svn($branch_url,$log_pattern=null,&$revision,$prefix
|
||||
|
||||
/**
|
||||
* Get revision of last svn tag matching a given pattern in the log message
|
||||
*
|
||||
*
|
||||
* @param string $tags_url
|
||||
* @param string $pattern which has to be contained in the log message (NOT the tag itself)
|
||||
* or (perl) regular expression against which log message is matched
|
||||
@ -279,8 +300,8 @@ function get_changelog_from_svn($branch_url,$log_pattern=null,&$revision,$prefix
|
||||
function get_last_svn_tag($tags_url,$pattern,&$matches=null)
|
||||
{
|
||||
global $config,$verbose,$svn;
|
||||
|
||||
$cmd = $svn.' log --xml --limit 10 '.escapeshellarg($tags_url);
|
||||
|
||||
$cmd = $svn.' log --xml --limit 20 '.escapeshellarg($tags_url);
|
||||
if (($v = $verbose))
|
||||
{
|
||||
echo "Querying SVN for last tags\n$cmd\n";
|
||||
@ -290,7 +311,7 @@ function get_last_svn_tag($tags_url,$pattern,&$matches=null)
|
||||
run_cmd($cmd,$output);
|
||||
$verbose = $v;
|
||||
array_shift($output); // remove the command
|
||||
|
||||
|
||||
$xml = simplexml_load_string($output=implode("\n",$output));
|
||||
foreach($xml as $log)
|
||||
{
|
||||
@ -339,7 +360,7 @@ function do_obs()
|
||||
++$n;
|
||||
}
|
||||
// updating dsc, spec and changelog files
|
||||
if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec' ||
|
||||
if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec' ||
|
||||
!empty($config['changelog']) && basename($path) == 'debian.changes')
|
||||
{
|
||||
$content = $content_was = file_get_contents($path);
|
||||
@ -391,13 +412,13 @@ function do_obs()
|
||||
function update_changelog($content)
|
||||
{
|
||||
global $config,$verbose;
|
||||
|
||||
|
||||
list($new_header) = explode("\n",$content);
|
||||
$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)',$new_header);
|
||||
if (substr($config['changelog'],0,2) != ' ') $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog']));
|
||||
$content = $new_header."\n\n".$config['changelog'].
|
||||
"\n\n -- ".$config['changelog_packager'].' '.date('r')."\n\n".$content;
|
||||
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
@ -565,7 +586,7 @@ function do_checkout()
|
||||
throw new Exception("svn checkout directory '{$config['svndir']} exists and is NO directory or NOT writable!");
|
||||
}
|
||||
chdir($config['svndir']);
|
||||
|
||||
|
||||
// do we use a just created tag --> list of taged modules
|
||||
if ($config['svntag'] && isset($config['modules']))
|
||||
{
|
||||
@ -641,7 +662,7 @@ function do_checkout()
|
||||
|
||||
/**
|
||||
* Get module name per svn repro
|
||||
*
|
||||
*
|
||||
* @return array with $repro_url => array(module1, ..., moduleN) pairs
|
||||
*/
|
||||
function get_modules_per_repro()
|
||||
|
Loading…
Reference in New Issue
Block a user