diff options
author | Frederic Lepied <flepied@mandriva.com> | 2004-03-07 21:53:32 +0000 |
---|---|---|
committer | Frederic Lepied <flepied@mandriva.com> | 2004-03-07 21:53:32 +0000 |
commit | 9b99f1cb8292fdffb398e4816a8406021c269618 (patch) | |
tree | bbf296a70a763bd796c06f2113175461b2a78791 | |
parent | 04d43a777e3b4470b4192081e4063760c924d931 (diff) | |
download | bootsplash-9b99f1cb8292fdffb398e4816a8406021c269618.tar bootsplash-9b99f1cb8292fdffb398e4816a8406021c269618.tar.gz bootsplash-9b99f1cb8292fdffb398e4816a8406021c269618.tar.bz2 bootsplash-9b99f1cb8292fdffb398e4816a8406021c269618.tar.xz bootsplash-9b99f1cb8292fdffb398e4816a8406021c269618.zip |
added support for sourceforge mirrorsV0_16_1mdk
-rwxr-xr-x | rpmbuildupdate | 86 |
1 files changed, 58 insertions, 28 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 09475c7..b969ddf 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# rpmbuildupdate by Julien Danjou <jdanjou at mandrakesoft dot com> +# rpmbuildupdate by Julien Danjou # # Copyright (c) 2003-2004 by MandrakeSoft # @@ -27,6 +27,44 @@ sub build_from_src { &build($1, $nv, $_); } } +sub fetch +{ + my ($url) = @_; + my $basename = `basename $url`; chomp($basename); + my ($temp, $turl); + my $wget = "wget -N -q"; + + system("rm -f $basename"); + + print "Trying to fetch $url...\n"; + system("$wget $url"); + + if (! -f $basename) + { + ($turl = $url) =~ s/bz2/gz/; + $temp = `basename $turl`; chomp($temp); + print "Trying to fetch $turl...\n"; + system("$wget $turl; [ -f $temp ] && bzme $temp"); + } + + if (! -f $basename) + { + ($turl = $url) =~ s/\.tar\.bz2/.tgz/; + $temp = `basename $turl`; chomp($temp); + print "Trying to fetch $turl...\n"; + system("$wget $turl; [ -f $temp ] && bzme $temp"); + } + + if (! -f $basename) + { + ($turl = $url) =~ s/\.tar\.bz2/.zip/; + $temp = `basename $turl`; chomp($temp); + print "Trying to fetch $turl...\n"; + system("$wget $turl; [ -f $temp ] && bzme $temp"); + } + return (-f $basename); +} + sub build { my $pkg = shift; @@ -143,7 +181,7 @@ sub build my $basename = `basename $_`; chomp($basename); - + # download from Fedora if(/ftp\.redhat\.com/) { opendir(MP, $config{fedora}) or die "$config{fedora} is not a directory"; @@ -170,36 +208,28 @@ sub build wait; } } + # download from sourceforge mirrors + if (m@http://prdownloads.sourceforge.net@) + { + foreach my $site ("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($dest)); + } + } + # download specified url if (! -f "${top}/SOURCES/$basename") { - print "Trying $_...\n"; - - system("wget -N ".$_); - if($basename =~ /gz/) - { - s/gz/bz2/; - $basename = `basename $_`; chomp($basename); - print "Trying to fetch .bz2...\n"; - system("wget -N ".$_); - } - elsif($basename =~ /bz2/) - { - s/bz2/gz/; - print "Trying to fetch .gz...\n"; - system("wget -N ".$_); - $basename = `basename $_`; chomp($basename); - # If gz was downloaded, recompressing it in bz2 - if(-f $basename) - { - system("bzme ".$basename); - $basename =~ s/bz2/gz/; - } - } + fetch($_); } - $found = 1 if(-e $basename); - $basename =~ s/bz2/gz/; - $found = 1 if(-e $basename); + $found++ if(-e $basename); } open(SPECFILE, ">../SPECS/".$pkg.".spec") or die "Unable to open $pkg.spec"; |