diff options
-rwxr-xr-x | rpmbuildupdate | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index ec5cf45..2563fea 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -49,7 +49,14 @@ sub file_not_found # 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. - `file $basename` =~ /HTML/i && do { rm_rf("$basename") ; return 1 ; }; + is_html($basename) && do { rm_rf("$basename") ; return 1 ; }; + return 0; +} + +sub is_html +{ + my ($basename) = @_; + `file $basename` =~ /HTML/i && return 1 ; return 0; } @@ -60,7 +67,7 @@ sub download my $temp = basename($url); print "Trying to fetch $url...\n"; system("$wget $url;"); - -f "$temp" && ( $temp !~ /.bz2$/ ) && system_die("bzme $temp","Cannot convert $temp"); + -f "$temp" && ( ! is_html($temp) ) && ( $temp !~ /.bz2$/ ) && system_die("bzme $temp","Cannot convert $temp"); } sub fetch |