From ec4cb12267eefa258f2f66f14e58c608bdd1da77 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 12 Nov 2004 18:41:57 +0000 Subject: - fix the usage of spec file with a regular path is given. - add more magic for project hosted on gna and other sourceforgelike sites. --- rpmbuildupdate | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'rpmbuildupdate') diff --git a/rpmbuildupdate b/rpmbuildupdate index ca92155..0db0a03 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -134,6 +134,7 @@ sub build_from_spec { my $rpm_tag = (split(/\n/,`rpm -q $config{rpmoption} --queryformat '%{NAME} %{VERSION} %{RELEASE}\n' --specfile $spec_path`))[0]; my ($pkg, $version, $release) = split(/ /, $rpm_tag); fill_global_variable($pkg); + $spec_path = File::Spec->rel2abs($spec_path); chdir("$top/SOURCES") or die "Unable to chdir to $top/SOURCES"; build($spec_path,$pkg,$version,$release,$newversion); } @@ -222,7 +223,7 @@ sub build { my $SPECFILE; if (!open($SPECFILE, $spec_path)) { - print STDERR "Unable to open spec file !\n"; + print STDERR "Unable to open spec file $spec_path.\n"; return; } @@ -255,7 +256,7 @@ sub build { # if macro is undefined $packager =~ s/\%packager//g; my $email = $packager ? $packager : $l[6] . ($ENV{EMAIL} ? " <$ENV{EMAIL}>" : " <$l[0]\@mandrakesoft.com>"); - $spec .= "* " . `LC_TIME=C date '+%a %b %e %Y'|tr -d '\n'` . " $email $newversion-$newrelease\n"; + $spec .= "* " . `LC_TIME=C date '+%a %b %d %Y'|tr -d '\n'` . " $email $newversion-$newrelease\n"; $spec .= "$message\n\n"; } } @@ -267,16 +268,41 @@ sub build { print "URL of sources was not found ! Trying to guess it with url tag ...\n"; my $url = $specvars{url}; - #TODO some factorisation - # add gna.org, savanah, jabberstudio - if ($url =~ m!http://(.*)\.((?:sourceforge|sf)\.net)/(.*)!) + # add jabberstudio, collabnet, http://www.sourcefubar.net/, http://sarovar.org/ + my @sf_like = ( { + download => 'http://prdownloads.sourceforge.net/$1/$2' , + regexp => 'http://(.*)\.(?:sourceforge|sf)\.net/?(.*)' + }, + { # to test + download => 'http://download.gna.org/$1/$2', + regexp => 'https?://gna.org/projects/([^/]*)/(.*)' + }, { - $url="http://prdownloads.$2/$1/$3" unless $1 eq 'prdownloads'; - } - if ($url =~ m!http://(.*)\.berlios.de/(.*)!) + download => 'http://download.berlios.de/$1/$2' , + regexp => 'http://(.*)\.berlios.de/(.*)' + }, + { # to test , and to merge with regular savanah ? + download => 'http://savannah.nongnu.org/download//$1/$2', + regexp => 'https?://savannah.nongnu.org/projects/([^/]*)/(.*)' + }, + { # to test + download => 'http://savannah.gnu.org/download//$1/$2', + regexp => 'https?://savannah.gnu.org/projects/([^/]*)/(.*)' + }, + ); + + # http://jabberstudio.org/files/ejogger/ + # http://jabberstudio.org/projects/ejogger/project/view.php + foreach my $sf (@sf_like) { - $url="http://download.berlios.de/$1/$2" unless $1 eq 'download'; + if ( $url =~ m/$sf->{regexp}/ ) + { + $sf->{download} =~ s/^/"/; + $sf->{download} =~ s/$/"/; + $url =~ s/$sf->{regexp}/"$sf->{download}"/eeg; + } } + push(@url, "$url/$tar_ball") } -- cgit v1.2.1