aboutsummaryrefslogtreecommitdiffstats
path: root/rpmbuildupdate
diff options
context:
space:
mode:
Diffstat (limited to 'rpmbuildupdate')
-rwxr-xr-xrpmbuildupdate43
1 files changed, 26 insertions, 17 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate
index 1a86dfb..b81bc81 100755
--- a/rpmbuildupdate
+++ b/rpmbuildupdate
@@ -15,7 +15,6 @@
# TODO
# do not hardcode sudo urpmi command ( to use --deps on cluster )
# rework configuration option
-# add more dwimess ( ie, autodetect if we give a spec, a src.rpm, or a package name )
use strict;
use AppConfig;
@@ -548,22 +547,32 @@ sub main {
if ($config{rpmmon}) {
print($config{srpms});
parse_rpmmon($config{rpmmon})
- } elsif ($config{src} && $ARGV[0]) {
- build_from_src($config{src}, $ARGV[0])
- } elsif ($config{spec} && $ARGV[0]) {
- build_from_spec($config{spec}, $ARGV[0])
- } elsif ($ARGV[0] && $ARGV[1]) {
- check_dir($config{srpms});
- build_from_repository($ARGV[0], $ARGV[1])
- } elsif ($config{src}) {
- build_from_src($config{src})
- } elsif ($config{spec}) {
- build_from_spec($config{spec})
- } elsif ($ARGV[0]) {
- check_dir($config{srpms});
- build_from_repository($ARGV[0])
- } else {
- usage
+ } else {
+ my ($new_version,$name);
+ if ($config{src} or $config{spec})
+ {
+ $new_version = $ARGV[0] || undef;
+ }
+ elsif ($ARGV[0])
+ {
+ $name= $ARGV[0]; $new_version = $ARGV[1];
+ if (-f $name)
+ {
+ $name =~ /.spec$/ and $config{spec} = $name;
+ # FIXME better auto detection with nosrc.rpm ?
+ $name =~ /.src.rpm$/ and $config{src} = $name;
+ }
+ }
+ if ($config{src}) {
+ build_from_src($config{src}, $new_version)
+ } elsif ($config{spec}) {
+ build_from_spec($config{spec},$new_version)
+ } elsif ($name) {
+ check_dir($config{srpms});
+ build_from_repository($name,$new_version)
+ } else {
+ usage
+ }
}
}