From 55f7ace4a1b60f3476ce6dc64f786e50a78490cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Wed, 21 Feb 2007 17:29:14 +0000 Subject: [PATCH] Set skipdownload=0 if checkdownload==1 and if the file does not exist. Otherwise, if a previous file exists (with checkdownload==1), skipdownload would be 1 and the missing files would not be downloaded... Fixes spurious FAILs because of missing data. --- .../xref_mapping/XrefParser/BaseParser.pm | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm index 7cbb79fd6a..9b368624af 100644 --- a/misc-scripts/xref_mapping/XrefParser/BaseParser.pm +++ b/misc-scripts/xref_mapping/XrefParser/BaseParser.pm @@ -193,21 +193,28 @@ sub run { print "Using $file_from_archive from $file\n"; } - if ( $checkdownload ) { - - my $check_file = "$dir/$file" ; - $check_file =~s/\.gz//; - $check_file =~s/\.Z//; - print "checking for file $check_file\n" ; - if (-e "$check_file" ) { - print "SKIPPING $file because file $check_file already exists\n" ; - $skipdownload = 1 ; - $file =~s/\.gz//; - $file=~s/\.Z//; - } else { - print "File $check_file does not exist. \n scheduling $dir/$file for download ..........\n" ; + if ($checkdownload) { + my $check_file = $dir . '/' . $file; + $check_file =~ s/\.gz$//; + $check_file =~ s/\.Z$//; + + print "Checking for file '$check_file'\n"; + + if ( -e "$check_file" ) { + print "SKIPPING $file because file " + . "'$check_file' already exists\n"; + + $skipdownload = 1; + + $file =~ s/\.gz$//; + $file =~ s/\.Z$//; + } else { + print "File '$check_file' does not exist.\n" + . "Scheduling '$dir/$file' for download...\n"; + + $skipdownload = 0; } - } + } $file =~ s/[&=]//g; @@ -239,7 +246,9 @@ sub run { my $num_attempts = 0; my $missing = 1; while($num_attempts < 5 and $missing){ - my $result = system("wget", "--quiet","--directory-prefix=$dir", "--output-document=$dir/$file", $urls ); + my $result = + system( "wget", "--quiet", "--directory-prefix=$dir", + "--output-document=$dir/$file", $urls ); # check that the file actually downloaded; may not (e.g. if too many anonymous users) if ($result != 0) { -- GitLab