mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 03:13:40 +01:00
allow to replace archives in obs checkout
This commit is contained in:
parent
876cf07883
commit
c97400f881
@ -35,6 +35,7 @@ $config = array(
|
|||||||
'freshclam' => '/usr/bin/freshclam',
|
'freshclam' => '/usr/bin/freshclam',
|
||||||
'gpg' => '/usr/bin/gpg',
|
'gpg' => '/usr/bin/gpg',
|
||||||
'packager' => 'build@stylite.de',
|
'packager' => 'build@stylite.de',
|
||||||
|
'obs' => false,
|
||||||
'skip' => array(),
|
'skip' => array(),
|
||||||
'run' => array('checkout','copy','virusscan','create','sign')
|
'run' => array('checkout','copy','virusscan','create','sign')
|
||||||
);
|
);
|
||||||
@ -76,6 +77,13 @@ while(($arg = array_shift($argv)))
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'obs':
|
||||||
|
if (!is_dir($value))
|
||||||
|
{
|
||||||
|
usage("Path '$value' not found!");
|
||||||
|
}
|
||||||
|
if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
|
||||||
|
// fall through
|
||||||
default:
|
default:
|
||||||
$config[$name] = $value;
|
$config[$name] = $value;
|
||||||
break;
|
break;
|
||||||
@ -99,6 +107,34 @@ foreach(array_diff($config['run'],$config['skip']) as $func)
|
|||||||
$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
|
* Sign sha1sum file
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user