aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.com>2004-10-24 17:31:30 +0000
committerMichael Scherer <misc@mandriva.com>2004-10-24 17:31:30 +0000
commitc9b960ea2db17725b8f9ac0270cee2dedf67aec1 (patch)
tree7dc5c1168028382d5b7fc88b089f4734a4b9b2da
parent0b66d96352ca4b3923735053642a65783d61e69a (diff)
downloadbootsplash-c9b960ea2db17725b8f9ac0270cee2dedf67aec1.tar
bootsplash-c9b960ea2db17725b8f9ac0270cee2dedf67aec1.tar.gz
bootsplash-c9b960ea2db17725b8f9ac0270cee2dedf67aec1.tar.bz2
bootsplash-c9b960ea2db17725b8f9ac0270cee2dedf67aec1.tar.xz
bootsplash-c9b960ea2db17725b8f9ac0270cee2dedf67aec1.zip
- DWIM, ie autodetection of the argument ( if a spec, build from spec, etc )
-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
+ }
}
}