diff options
-rwxr-xr-x | rpmbuildupdate | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 63f802b..d7fd5bb 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -143,7 +143,7 @@ sub build $spec .= $_; $spec =~ s/\%define(\s+)release(\s+)(.*)/\%define release $config{release}/; - $spec =~ s/Release:(\s+)(.*mdk)/Release:\1$config{release}/; + $spec =~ s/Release:(\s+)(.*mdk)/Release:$1$config{release}/; push(@url, $2) if(/(Source[0-9]*):\s+((?:ftp|http):\S+)/i); # For %vars ! @@ -181,8 +181,19 @@ sub build } my $basename = `basename $_`; chomp($basename); + + system("rm -f ${top}/SOURCES/$basename"); - # download from Fedora + # GNOME: add the major version to the URL automatically + # for example: ftp://ftp://ftp.gnome.org/pub/GNOME/sources/ORbit2/ORbit2-2.10.0.tar.bz2 + # is rewritten in ftp://ftp.gnome.org/pub/GNOME/sources/ORbit2/2.10/ORbit2-2.10.0.tar.bz2 + if (m@ftp.gnome.org/pub/GNOME/sources/@) + { + (my $major = $newversion) =~ s/([^.]+\.[^.]+).*/$1/; + s@(.*/)(.*)@$1$major/$2@; + } + + # download from Fedora rpms if(/ftp\.redhat\.com/) { opendir(MP, $config{fedora}) or die "$config{fedora} is not a directory"; @@ -239,7 +250,13 @@ sub build if(!$found) - { print "Unable to download file: URL is not valid ! :-(\n\n"; return; } + { + print "Unable to download file: URL is not valid ! :-(\n\n"; + return; + } elsif ($config{nobuild}) { + print "All files downloaded\n"; + return; + } if(system("$rpm -ba ../SPECS/".$pkg.".spec")) { @@ -311,6 +328,11 @@ sub parse_argv DEFAULT => 0, ARGCOUNT => AppConfig::ARGCOUNT_ONE } ); + $conf->define("nobuild", + { ALIAS => "c", + DEFAULT => 0, + ARGCOUNT => AppConfig::ARGCOUNT_NONE } + ); $conf->args(); $config{rpmmon} = $conf->get("rpmmon"); @@ -321,24 +343,26 @@ sub parse_argv $config{nosource} = $conf->get("nosource"); $config{fedora} = $conf->get("fedora"); $config{top} = $conf->get("top"); + $config{nobuild} = $conf->get("nobuild"); } sub usage { print "rpmbuildupdate v0.4 helps you build up to date RPMs.\n\n"; - print "By Julien Danjou <jdanjou\@mandrakesoft.com>\n"; + print "By Julien Danjou\n"; print "Copyright (c) 2003-2004 by MandrakeSoft.\n"; print "This is free software under the GPL License.\n"; print "Usage: rpmbuildupdate [options] [pkg] [newversion]\n\n"; - print " --rpmmon <file>: Parse output of rpmmon from file\n"; - print " --srpms <path_to_srpms>: Specify SRPMS path\n"; - 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 " --nosource: Do not install source from (urpmi x.src.rpm)\n"; + print " --rpmmon <file>: parse output of rpmmon from file\n"; + print " --srpms <path_to_srpms>: specify SRPMS path\n"; + 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 " --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"; exit 0; } |