From 2b7a985f912c4ba9df6d06dfbd4cf57a2d29e6ee Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 14 May 2004 14:29:52 +0000 Subject: - add a test to not try to bzip2 error html pages --- rpmbuildupdate | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'rpmbuildupdate') 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 -- cgit v1.2.1