diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2005-01-09 18:15:06 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2005-01-09 18:15:06 +0000 |
commit | 04bb41fee3ce5f57fe9cff520fcb72be2fd5113b (patch) | |
tree | 83b43aef43ca8420bc7e5a76a2705eda799b9dab | |
parent | b61196ccee5fd6c586113645e31c2c811d3917bf (diff) | |
download | bootsplash-04bb41fee3ce5f57fe9cff520fcb72be2fd5113b.tar bootsplash-04bb41fee3ce5f57fe9cff520fcb72be2fd5113b.tar.gz bootsplash-04bb41fee3ce5f57fe9cff520fcb72be2fd5113b.tar.bz2 bootsplash-04bb41fee3ce5f57fe9cff520fcb72be2fd5113b.tar.xz bootsplash-04bb41fee3ce5f57fe9cff520fcb72be2fd5113b.zip |
don't attempt to download files for simple rebuilds
-rwxr-xr-x | rpmbuildupdate | 148 |
1 files changed, 75 insertions, 73 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 12fd95b..d16e27a 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -305,82 +305,90 @@ sub build { push(@url, "$url/$tar_ball") } - my $found = 0; + if ($version ne $newversion) { + my $found = 0; - foreach (@url) { - # Replace variable from spec (%blabla) - while (/\%/) { - s/\%\{(.*?)\}/$specvars{$1}/g; - s/\%(\w+)/$specvars{$1}/g; - s/\%\{name\}/$pkg/gi; - s/\%\{version\}/$newversion/gi; - } + foreach (@url) { + # Replace variable from spec (%blabla) + while (/\%/) { + s/\%\{(.*?)\}/$specvars{$1}/g; + s/\%(\w+)/$specvars{$1}/g; + s/\%\{name\}/$pkg/gi; + s/\%\{version\}/$newversion/gi; + } - my $basename = basename($_); + my $basename = basename($_); - rm_rf("${top}/SOURCES/$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); + rm_rf("${top}/SOURCES/$basename") if $config{nobuild}; - my $pkgrpmrh; - my $pkge = $pkg; - $pkge =~ s/\+/\\+/; - - foreach (@rpmsrh) { - if (m|^($pkge)-([^-]+)-([^-]+)\.[^\.]+\.rpm|) { - $pkgrpmrh = $_; - last; - } + # 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!; } - closedir(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; + my $pkge = $pkg; + $pkge =~ s/\+/\\+/; + + foreach (@rpmsrh) { + if (m|^($pkge)-([^-]+)-([^-]+)\.[^\.]+\.rpm|) { + $pkgrpmrh = $_; + last; + } + } + + closedir(MP); - print "Trying from fedora($basename): $config{fedora}/$pkgrpmrh\n"; - system_die("cd ${top}/SOURCES; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $basename", "Rpm extraction failed"); + print "Trying from fedora($basename): $config{fedora}/$pkgrpmrh\n"; + system_die("cd ${top}/SOURCES; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $basename", "Rpm extraction failed"); - if (! -f "${top}/SOURCES/$basename") { - (my $bname = $basename) =~ s/bz2/gz/; - print "Trying from fedora($bname): $config{fedora}/$pkgrpmrh\n"; - system("cd ${top}/SOURCES; rpm2cpio $config{fedora}/$pkgrpmrh | cpio -id $bname; bzme $bname", "rpm recompression failed"); + if (! -f "${top}/SOURCES/$basename") { + (my $bname = $basename) =~ s/bz2/gz/; + print "Trying from fedora($bname): $config{fedora}/$pkgrpmrh\n"; + system("cd ${top}/SOURCES; 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); + # 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 "${top}/SOURCES/$basename") { + fetch($_); + } + + $found++ if -e $basename; + chmod(0644, "${top}/SOURCES/$basename"); } - # download specified url - if (! -f "${top}/SOURCES/$basename") { - fetch($_); - } - $found++ if -e $basename; - chmod(0644, "${top}/SOURCES/$basename"); + # some specs have no source ( php ) + $found++ if ! $tar_ball; + + unless ($found) { + print "Unable to download file: URL is not valid ! :-(\n\n"; + return; + } } - # some specs have no source ( php ) - $found++ if ! $tar_ball; unless ($config{noupdate}) { # TODO use output ? @@ -389,17 +397,11 @@ sub build { close($SPECFILE); } - if (!$found) { - 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 $config{rpmoption} $spec_path $log")) { - print "Binary build fails: building source only\n"; - system("$rpm -bs $config{rpmoption} --nodeps $spec_path $log"); + unless ($config{nobuild}) { + if (system("$rpm -ba $config{rpmoption} $spec_path $log")) { + print "Binary build fails: building source only\n"; + system("$rpm -bs $config{rpmoption} --nodeps $spec_path $log"); + } } } |