diff options
-rwxr-xr-x | rpmbuildupdate | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 94210f7..c549d3d 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -121,7 +121,7 @@ sub build my $pkg = shift; my $newversion = shift; my $pkgrpm = shift; - my $rpm; + my ($rpm, $log); my $found = 0; my ($version, $release); @@ -162,21 +162,31 @@ sub build { $version = $2; $release = $3; $found = 1;} } + if($config{log}) + { + my $basename; + ( $basename = $pkgrpm ) =~ s!.*/!!; + system("mkdir -p $top/log"); + $log = " >> $top/log/${basename}.log 2>&1"; + } else { + $log = ""; + } + if($config{deps}) { - system_die("sudo /usr/sbin/urpmi --auto --force ".$config{srpms}."/".$pkgrpm); + system_die("sudo /usr/sbin/urpmi --auto --force $pkgrpm $log"); wait; } - if($config{src}) + if($config{src}) { - system_die("$rpm -ivh $pkgrpm"); + system_die("$rpm -ivh $pkgrpm $log"); wait; $config{src} = 0; } elsif(!$config{nosource}) { - system_die("/usr/sbin/urpmi --install-src --force ".$config{srpms}."/".$pkgrpm); + system_die("/usr/sbin/urpmi --install-src --force $config{srpms} $log"); wait; } @@ -320,11 +330,11 @@ sub build return; } - if(system("$rpm -ba ../SPECS/".$pkg.".spec")) + if(system("$rpm -ba ../SPECS/".$pkg.".spec $log")) { wait; print "Binary build fails: building source only\n"; - system("$rpm -bs --nodeps ../SPECS/".$pkg.".spec"); + system("$rpm -bs --nodeps ../SPECS/$pkg.spec $log"); } wait; } @@ -347,7 +357,6 @@ sub parse_argv $conf->define("release", { ARGS => "=s", - ALIAS => "l", DEFAULT => "1mdk", ARGCOUNT => AppConfig::ARGCOUNT_ONE } ); @@ -396,6 +405,11 @@ sub parse_argv ARGCOUNT => AppConfig::ARGCOUNT_NONE } ); + $conf->define("log", + { ALIAS => "l", + DEFAULT => 0, + ARGCOUNT => AppConfig::ARGCOUNT_NONE } + ); $conf->args(); $config{rpmmon} = $conf->get("rpmmon"); $config{deps} = $conf->get("deps"); @@ -406,6 +420,7 @@ sub parse_argv $config{fedora} = $conf->get("fedora"); $config{top} = $conf->get("top"); $config{nobuild} = $conf->get("nobuild"); + $config{log} = $conf->get("log"); } @@ -422,6 +437,7 @@ sub usage print " --src <src.rpm file> <new version>: build new version from this source RPM\n"; print " --release <mdk_release>: release version of package (default: 1mdk)\n"; print " --deps: install builds dependencies\n"; + print " --log: log builds\n"; print " --nosource: do not install source from (urpmi x.src.rpm)\n"; print " --top <dir>: specify rpm top dir (default: `rpm --eval %_topdir`)\n"; print " --nobuild|-c: do not build the package. Only download files.\n"; |