diff options
Diffstat (limited to 'rpmbuildupdate')
-rwxr-xr-x | rpmbuildupdate | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index d310a7e..f0da7c2 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -23,6 +23,7 @@ use File::Copy; use MDK::Common::File qw(:all); use Cwd; use File::Spec; +use Hdlist; my %config; @@ -397,7 +398,23 @@ sub build { if (system("$rpm -ba $config{rpmoption} $spec_path $log")) { print "Binary build fails: building source only\n"; system("$rpm -bs $config{rpmoption} --nodeps $spec_path $log"); - } + } + } + if ($config{execafterbuild}) + { + if (my $hdlist_spec = Hdlist::specnew($spec_path)) + { + my @rpms_upload; + push(@rpms_upload, $hdlist_spec->srcrpm); + foreach ($hdlist_spec->binrpm()) + { + -f $_ or next; + push(@rpms_upload, $_); + } + system("$config{execafterbuild} @rpms_upload"); + } else { + print "Unable to parse spec to detect builded rpms\n"; + } } } @@ -490,6 +507,13 @@ sub parse_argv { DEFAULT => "", ARGCOUNT => AppConfig::ARGCOUNT_ONE }); + + $conf->define("execafterbuild", { + ARGS => "=s", + DEFAULT => "", + ARGCOUNT => AppConfig::ARGCOUNT_ONE + }); + foreach my $f ('/etc/rpmbuildupdate.conf', "$ENV{HOME}/.rpmbuildupdaterc") { -f $f && $conf->file($f); @@ -508,14 +532,16 @@ sub parse_argv { $config{rpmoption} = $conf->get("rpmoption"); $config{log} = $conf->get("log"); $config{execute} = $conf->get("execute"); + $config{execafterbuild} = $conf->get("execafterbuild"); } sub usage { print <<EOF; -rpmbuildupdate v0.4 helps you build up to date RPMs. +rpmbuildupdate v0.5 helps you build up to date RPMs. + +By Julien Danjou, Michael Scherer, Guillaume Rousse -By Julien Danjou Copyright (c) 2003-2004 by MandrakeSoft. This is free software under the GPL License. Usage: rpmbuildupdate [options] [pkg] [newversion] @@ -532,6 +558,7 @@ Usage: rpmbuildupdate [options] [pkg] [newversion] --top <dir>: specify rpm top dir (default: `rpm --eval \%_topdir`) --nobuild|-c: do not build the package. Only download files. --execute <command>: execute an arbitrary perl command for each line of the spec file + --execafterbuild <command>: execute a shell command after the build, with the source and binary rpm as argument EOF exit 0; } |