aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.com>2005-12-06 15:17:31 +0000
committerMichael Scherer <misc@mandriva.com>2005-12-06 15:17:31 +0000
commit2f84d9126aa10497cb0578e1899d0627f7e5ddf6 (patch)
tree855413f5b991baacf0ee62d774d816f4f2ac25cc
parentcb953d087f3d5299ebb962541ea2b2c397329583 (diff)
downloadbootsplash-2f84d9126aa10497cb0578e1899d0627f7e5ddf6.tar
bootsplash-2f84d9126aa10497cb0578e1899d0627f7e5ddf6.tar.gz
bootsplash-2f84d9126aa10497cb0578e1899d0627f7e5ddf6.tar.bz2
bootsplash-2f84d9126aa10497cb0578e1899d0627f7e5ddf6.tar.xz
bootsplash-2f84d9126aa10497cb0578e1899d0627f7e5ddf6.zip
- add --nodownload ( oden request )
- remove some tests on config{nobuild} that no one can explain
-rwxr-xr-xrpmbuildupdate159
1 files changed, 84 insertions, 75 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate
index 1c1e0a9..6a9d413 100755
--- a/rpmbuildupdate
+++ b/rpmbuildupdate
@@ -111,7 +111,7 @@ sub fetch_http {
my $basename = basename($url);
my $turl;
- rmtree($basename) if $config{nobuild};
+ rmtree($basename);
download($url);
foreach ('.tar.gz', '.tgz', '.tar.Z', '.zip') {
@@ -341,82 +341,83 @@ sub build {
push(@url, "$url/$tar_ball")
}
my $found = 0;
-
- foreach (@url) {
- # Replace variable from spec (%blabla)
- while (/\%[^(]?/) {
- s/\%\{?(\w+)\}?/$specvars{$1}/g;
- s/\%\{name\}/$pkg/g;
- s/\%\{version\}/$newversion/g;
- }
-
- my $basename = basename($_);
- rmtree("$config{sourcedir}/$basename") if $config{nobuild};
-
- # 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";
- my @rpmsrh = readdir(MP);
-
- my $pkgrpmrh;
-
- foreach (@rpmsrh) {
- if (/^\Q$pkg\E-[^-]+-[^-]+\.\w+\.rpm/) {
- $pkgrpmrh = $_;
- last;
- }
- }
-
- closedir(MP);
-
- print "Trying from fedora($basename): $config{fedora}/$pkgrpmrh\n";
- system_die("cd $config{sourcedir}; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $basename", "Rpm extraction failed");
- if (! -f "$config{sourcedir}/$basename") {
- (my $bname = $basename) =~ s/bz2/gz/;
- print "Trying from fedora($bname): $config{fedora}/$pkgrpmrh\n";
- system("cd $config{sourcedir}; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $bname; bzme -F $bname", "rpm recompression failed");
- }
- }
- # download from sourceforge mirrors
- if (m!http://prdownloads.sourceforge.net!) {
- foreach my $site ("http://ovh.dl.sourceforge.net/sourceforge/",
- "http://mesh.dl.sourceforge.net/sourceforge/",
- "http://switch.dl.sourceforge.net/sourceforge/",
- "http://belnet.dl.sourceforge.net/sourceforge/",
- "http://puzzle.dl.sourceforge.net/sourceforge/",
- "http://heanet.dl.sourceforge.net/sourceforge/",
- "http://kent.dl.sourceforge.net/sourceforge/",
- "http://voxel.dl.sourceforge.net/sourceforge/",
- "http://easynews.dl.sourceforge.net/sourceforge/",
- "http://cogent.dl.sourceforge.net/sourceforge/",
- "http://optusnet.dl.sourceforge.net/sourceforge/",
- "http://jaist.dl.sourceforge.net/sourceforge/",
- "http://nchc.dl.sourceforge.net/sourceforge/",
- "http://citkit.dl.sourceforge.net/sourceforge/",
- )
- {
- (my $dest = $_) =~ s!http://prdownloads.sourceforge.net/!$site!;
- last if fetch_http($dest);
- }
- }
- # download specified url
- if (! -f "$config{sourcedir}/$basename") {
- fetch($_);
- }
- $found++ if -e $basename;
- chmod(0644, "$config{sourcedir}/$basename");
+
+ unless ($config{nodownload}) {
+ foreach (@url) {
+ # Replace variable from spec (%blabla)
+ while (/\%[^(]?/) {
+ s/\%\{?(\w+)\}?/$specvars{$1}/g;
+ s/\%\{name\}/$pkg/g;
+ s/\%\{version\}/$newversion/g;
+ }
+
+ my $basename = basename($_);
+ rmtree("$config{sourcedir}/$basename");
+
+ # 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";
+ my @rpmsrh = readdir(MP);
+
+ my $pkgrpmrh;
+
+ foreach (@rpmsrh) {
+ if (/^\Q$pkg\E-[^-]+-[^-]+\.\w+\.rpm/) {
+ $pkgrpmrh = $_;
+ last;
+ }
+ }
+
+ closedir(MP);
+
+ print "Trying from fedora($basename): $config{fedora}/$pkgrpmrh\n";
+ system_die("cd $config{sourcedir}; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $basename", "Rpm extraction failed");
+ if (! -f "$config{sourcedir}/$basename") {
+ (my $bname = $basename) =~ s/bz2/gz/;
+ print "Trying from fedora($bname): $config{fedora}/$pkgrpmrh\n";
+ system("cd $config{sourcedir}; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $bname; bzme -F $bname", "rpm recompression failed");
+ }
+ }
+ # download from sourceforge mirrors
+ if (m!http://prdownloads.sourceforge.net!) {
+ foreach my $site ("http://ovh.dl.sourceforge.net/sourceforge/",
+ "http://mesh.dl.sourceforge.net/sourceforge/",
+ "http://switch.dl.sourceforge.net/sourceforge/",
+ "http://belnet.dl.sourceforge.net/sourceforge/",
+ "http://puzzle.dl.sourceforge.net/sourceforge/",
+ "http://heanet.dl.sourceforge.net/sourceforge/",
+ "http://kent.dl.sourceforge.net/sourceforge/",
+ "http://voxel.dl.sourceforge.net/sourceforge/",
+ "http://easynews.dl.sourceforge.net/sourceforge/",
+ "http://cogent.dl.sourceforge.net/sourceforge/",
+ "http://optusnet.dl.sourceforge.net/sourceforge/",
+ "http://jaist.dl.sourceforge.net/sourceforge/",
+ "http://nchc.dl.sourceforge.net/sourceforge/",
+ "http://citkit.dl.sourceforge.net/sourceforge/",
+ )
+ {
+ (my $dest = $_) =~ s!http://prdownloads.sourceforge.net/!$site!;
+ last if fetch_http($dest);
+ }
+ }
+ # download specified url
+ if (! -f "$config{sourcedir}/$basename") {
+ fetch($_);
+ }
+ $found++ if -e $basename;
+ chmod(0644, "$config{sourcedir}/$basename");
+ }
}
-
# some specs have no source ( php )
- $found++ if ! $tar_ball;
+ $found++ if ! $tar_ball or $config{'nodownload'};
unless ($found) {
print "Unable to download file: URL is not valid ! :-(\n\n";
@@ -519,6 +520,12 @@ sub parse_argv {
ARGCOUNT => AppConfig::ARGCOUNT_NONE
});
+ $conf->define("nodownload", {
+ DEFAULT => 0,
+ ARGCOUNT => AppConfig::ARGCOUNT_NONE
+ });
+
+
$conf->define("log", {
ALIAS => "l",
DEFAULT => 0,
@@ -565,6 +572,7 @@ sub parse_argv {
$config{nosource} = $conf->get("nosource");
$config{fedora} = $conf->get("fedora");
$config{top} = $conf->get("top");
+ $config{nodownload} = $conf->get("nodownload");
$config{nobuild} = $conf->get("nobuild");
$config{message} = $conf->get("changelog");
$config{rpmoption} = $conf->get("rpmoption");
@@ -595,6 +603,7 @@ Usage: rpmbuildupdate [options] [pkg] [newversion]
--nosource: do not install source from (urpmi x.src.rpm)
--noupdate: do not touch to the spec file
--top <dir>: specify rpm top dir (default: `rpm --eval \%_topdir`)
+ --nodownload: do not download any files.
--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