diff options
author | Michael Scherer <misc@mandriva.com> | 2004-10-08 23:52:32 +0000 |
---|---|---|
committer | Michael Scherer <misc@mandriva.com> | 2004-10-08 23:52:32 +0000 |
commit | 37b6e75f784881dfa7eb26834325f1aaac678847 (patch) | |
tree | e983b7397bfa879925a6ae85c11855fa386f75da | |
parent | ddb0a6720fb124f38ff940e3615c3aa4803c831a (diff) | |
download | bootsplash-37b6e75f784881dfa7eb26834325f1aaac678847.tar bootsplash-37b6e75f784881dfa7eb26834325f1aaac678847.tar.gz bootsplash-37b6e75f784881dfa7eb26834325f1aaac678847.tar.bz2 bootsplash-37b6e75f784881dfa7eb26834325f1aaac678847.tar.xz bootsplash-37b6e75f784881dfa7eb26834325f1aaac678847.zip |
- some perl_checker fix
- allow to update php code ( no tarball in the spec )
-rwxr-xr-x | rpmbuildupdate | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 8f6591a..417209a 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -27,7 +27,7 @@ my %config; sub system_die { my ($command, $message) = @_; - $message = "$command failed" if ! $message; + $message ||= "$command failed"; # do not forget , return value of 1 means failure in unix system($command) and die $message; } @@ -42,17 +42,17 @@ sub build_from_src { sub file_not_found { my ($basename) = @_; - ! -f $basename && return 1; + ! -f $basename and return 1; # sometimes, the webserver return a webpage when the file is not found, instead of letting wget fails # see wget http://www.wesnoth.org/files/wesnoth-0.7.1.tar.bz2 # So if the file is a html page, then it is a error and it should be removed. - is_html($basename) && do { rm_rf($basename); return 1 }; + is_html($basename) and do { rm_rf($basename); return 1 }; return 0; } sub is_html { my ($basename) = @_; - `file $basename` =~ /HTML/i && return 1; + `file $basename` =~ /HTML/i and return 1; return 0; } @@ -79,7 +79,7 @@ sub fetch_svn { $basename = basename($url); ($repos = $url) =~ s|/$basename$||; $repos =~ s/^svn/http/; - $basename =~ /^(.*)-([^-]*rev)(\d\d*).tar.bz2$/; + die "Cannot extract revision number from the name." if $basename !~ /^(.*)-([^-]*rev)(\d\d*).tar.bz2$/; my ($name, $prefix, $release) = ($1, $2, $3); my $dir="$ENV{TMP}/rpmbuildupdate-$$"; my $current_dir = cwd(); @@ -138,7 +138,7 @@ sub build { my $pkge = $pkg; - $pkge =~ s/\+/\\\+/; + $pkge =~ s/\+/\\+/; # Search for file if we do not use --src if (!$config{src}) @@ -206,7 +206,7 @@ sub build { return; } - my $tar_ball; + my $tar_ball=''; while (<$SPECFILE>) { # Doing a s/// version @@ -217,7 +217,7 @@ sub build { $spec .= $_; push(@url, $2) if /(Source[0-9]*)\s*:\s+((?:ftp|svns?|https?):\S+)/i; - $tar_ball=$2 if /(Source[0-9]*)\s*:\s+([^:\s]+)/i and ! $tar_ball; + $tar_ball=$2 if /(Source[0-9]*)\s*:\s+([^:\s]+)/i && ! $tar_ball; # For %vars ! $specvars{$1} = $2 if /\%define\s+(\S+?)\s+(\S+)/g; @@ -234,7 +234,7 @@ sub build { chomp($packager); # if macro is undefined $packager =~ s/\%packager//g; - my $email = $packager ? $packager : $l[6] . ( $ENV{EMAIL} ? " <$ENV{EMAIL}>" : " <$l[0]\@mandrakesoft.com>"); + 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 .= "$message\n\n"; } @@ -242,10 +242,10 @@ sub build { close($SPECFILE); - if (!$url[0]) + if (!$url[0] ) { print "URL of sources was not found ! Trying to guess it with url tag ...\n"; - my $url=$specvars{url}; + my $url = $specvars{url}; if ($url =~ m!http://(.*)\.((?:sourceforge|sf)\.net)/(.*)!) { $url="http://prdownloads.$2/$1/$3" unless $1 eq 'prdownloads'; @@ -330,6 +330,9 @@ sub build { chmod(0644, "${top}/SOURCES/$basename"); } + # some specs have no source ( php ) + $found++ if ! $tar_ball; + # TODO use output ? open($SPECFILE, ">../SPECS/$pkg.spec") or die "Unable to open $pkg.spec"; print $SPECFILE $spec; @@ -358,7 +361,7 @@ sub wget_check { } sub parse_argv { - my $conf = AppConfig->new({ CASE => 1,ERROR =>\&usage }); + my $conf = AppConfig->new({ CASE => 1, ERROR => \&usage }); $conf->define("rpmmon", { ARGS => "=s", @@ -430,9 +433,9 @@ sub parse_argv { ARGCOUNT => AppConfig::ARGCOUNT_ONE } ); - foreach my $f ('/etc/rpmbuildupdate.conf',"$ENV{HOME}/.rpmbuildupdate.conf") + foreach my $f ('/etc/rpmbuildupdate.conf', "$ENV{HOME}/.rpmbuildupdate.conf") { - -f $f && $conf->file($f) ; + -f $f && $conf->file($f); } $conf->args; $config{rpmmon} = $conf->get("rpmmon"); |