diff options
author | Michael Scherer <misc@mandriva.com> | 2005-02-10 15:42:49 +0000 |
---|---|---|
committer | Michael Scherer <misc@mandriva.com> | 2005-02-10 15:42:49 +0000 |
commit | 73ad3229acf851e0be67bd77ed5ab53dd251f47b (patch) | |
tree | 89c6aacf57daa1b1b5201189ae53ca8ae1478b0e | |
parent | e44c918e5d6b060d3a62e523848cf64f8b414395 (diff) | |
download | bootsplash-73ad3229acf851e0be67bd77ed5ab53dd251f47b.tar bootsplash-73ad3229acf851e0be67bd77ed5ab53dd251f47b.tar.gz bootsplash-73ad3229acf851e0be67bd77ed5ab53dd251f47b.tar.bz2 bootsplash-73ad3229acf851e0be67bd77ed5ab53dd251f47b.tar.xz bootsplash-73ad3229acf851e0be67bd77ed5ab53dd251f47b.zip |
- still try to download, even for rebuild ( in case we only supply a spec file )
-rwxr-xr-x | rpmbuildupdate | 134 |
1 files changed, 66 insertions, 68 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index f0da7c2..1724e8a 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -307,85 +307,83 @@ sub build { push(@url, "$url/$tar_ball") } - - if ($version ne $newversion) { - 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 $found = 0; - my $basename = basename($_); - rm_rf("$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!; - } + foreach (@url) { + # Replace variable from spec (%blabla) + while (/\%/) { + s/\%\{?(\w+)\}?/$specvars{$1}/g; + s/\%\{name\}/$pkg/g; + s/\%\{version\}/$newversion/g; + } + + my $basename = basename($_); + rm_rf("$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); - # 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 $bname", "rpm recompression failed"); - } - } - # download from sourceforge mirrors - if (m!http://prdownloads.sourceforge.net!) { - foreach my $site ("http://ovh.dl.sourceforge.net/sourceforge/", - "http://heanet.dl.sourceforge.net/sourceforge/", - "http://aleron.dl.sourceforge.net/sourceforge/", - "http://keihanna.dl.sourceforge.net/sourceforge/", - "http://belnet.dl.sourceforge.net/sourceforge/", - "http://unc.dl.sourceforge.net/sourceforge/", - "http://twtelecom.dl.sourceforge.net/sourceforge/", - ) - { - (my $dest = $_) =~ s!http://prdownloads.sourceforge.net/!$site!; - last if fetch_http($dest); + my $pkgrpmrh; + + foreach (@rpmsrh) { + if (/^\Q$pkg\E-[^-]+-[^-]+\.\w+\.rpm/) { + $pkgrpmrh = $_; + last; } } - # download specified url + + 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") { - fetch($_); + (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 $bname", "rpm recompression failed"); } - $found++ if -e $basename; - chmod(0644, "$config{sourcedir}/$basename"); } + # download from sourceforge mirrors + if (m!http://prdownloads.sourceforge.net!) { + foreach my $site ("http://ovh.dl.sourceforge.net/sourceforge/", + "http://heanet.dl.sourceforge.net/sourceforge/", + "http://aleron.dl.sourceforge.net/sourceforge/", + "http://keihanna.dl.sourceforge.net/sourceforge/", + "http://belnet.dl.sourceforge.net/sourceforge/", + "http://unc.dl.sourceforge.net/sourceforge/", + "http://twtelecom.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; + # some specs have no source ( php ) + $found++ if ! $tar_ball; - unless ($found) { - print "Unable to download file: URL is not valid ! :-(\n\n"; - return; - } + unless ($found) { + print "Unable to download file: URL is not valid ! :-(\n\n"; + return; } + unless ($config{noupdate}) { # TODO use output ? |