diff options
-rwxr-xr-x | rpmbuildupdate | 33 | ||||
-rw-r--r-- | rpmbuildupdate.bash-completion | 4 |
2 files changed, 32 insertions, 5 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; } diff --git a/rpmbuildupdate.bash-completion b/rpmbuildupdate.bash-completion index 4efb285..6c88289 100644 --- a/rpmbuildupdate.bash-completion +++ b/rpmbuildupdate.bash-completion @@ -1,4 +1,4 @@ -# bash completion for rpmctl +# bash completion for rpmbuildupdate # $Id$ _rpmbuildupdate() @@ -24,7 +24,7 @@ _rpmbuildupdate() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--rpmmon --srpms --rpmoption \ --release --changelog --deps --log --nosource \ - --noupdate --top --nobuild --execute -c' -- $cur ) ) + --noupdate --top --nobuild --execute -c --execafterbuild' -- $cur ) ) else # get source rpm path for file in /etc/rpmbuildupdate $HOME/.rpmbuildupdaterc; do |