mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
"allow to replace archives in obs checkout"
This commit is contained in:
parent
97d3b59999
commit
f455ca37f1
@ -34,6 +34,7 @@ $config = array(
|
||||
'freshclam' => '/usr/bin/freshclam',
|
||||
'gpg' => '/usr/bin/gpg',
|
||||
'packager' => 'packager@egroupware.org',
|
||||
'obs' => false,
|
||||
'skip' => array(),
|
||||
'run' => array('checkout','copy','virusscan','create','sign')
|
||||
);
|
||||
@ -75,6 +76,13 @@ while(($arg = array_shift($argv)))
|
||||
}
|
||||
break;
|
||||
|
||||
case 'obs':
|
||||
if (!is_dir($value))
|
||||
{
|
||||
usage("Path '$value' not found!");
|
||||
}
|
||||
if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
|
||||
// fall through
|
||||
default:
|
||||
$config[$name] = $value;
|
||||
break;
|
||||
@ -98,6 +106,34 @@ foreach(array_diff($config['run'],$config['skip']) as $func)
|
||||
$func();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy archive files to obs checkout and commit them
|
||||
*
|
||||
*/
|
||||
function do_obs()
|
||||
{
|
||||
global $config,$verbose;
|
||||
|
||||
$n = 0;
|
||||
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path)
|
||||
{
|
||||
if (basename(dirname($path)) != '.osc' &&
|
||||
preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-[0-9.-]+(\.tar\.(gz|bz2))$/',$path,$matches) &&
|
||||
file_exists($new_name=$config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2]))
|
||||
{
|
||||
if (basename($path) != basename($new_name))
|
||||
{
|
||||
unlink($path);
|
||||
if ($verbose) echo "rm $path\n";
|
||||
}
|
||||
copy($new_name,dirname($path).'/'.basename($new_name));
|
||||
if ($verbose) echo "cp $new_name ".dirname($path)."/\n";
|
||||
++$n;
|
||||
}
|
||||
}
|
||||
if ($n) echo "$n files replaced in $config[obs] --> commit them now: osc addremove; osc commit\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign sha1sum file
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user