فهرست منبع

download.pl: check for existing file before the first download attempt

In the build system, flock will prevent multiple concurrent downloads
for the same file. However, if one download request for the same file is
waiting for another one to finish, it will result in downloading the
same file twice consecutively.

Prevent this issue by exiting immediately if the file has already been
downloaded

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 9 سال پیش
والد
کامیت
651bc94df4
1فایلهای تغییر یافته به همراه1 افزوده شده و 2 حذف شده
  1. 1 2
      scripts/download.pl

+ 1 - 2
scripts/download.pl

@@ -246,12 +246,11 @@ push @mirrors, 'http://sources.lede-project.org';
 push @mirrors, 'http://mirror2.openwrt.org/sources';
 push @mirrors, 'http://mirror2.openwrt.org/sources';
 push @mirrors, 'http://downloads.openwrt.org/sources';
 push @mirrors, 'http://downloads.openwrt.org/sources';
 
 
-while (!$ok) {
+while (!-f "$target/$filename") {
 	my $mirror = shift @mirrors;
 	my $mirror = shift @mirrors;
 	$mirror or die "No more mirrors to try - giving up.\n";
 	$mirror or die "No more mirrors to try - giving up.\n";
 
 
 	download($mirror);
 	download($mirror);
-	-f "$target/$filename" and $ok = 1;
 }
 }
 
 
 $SIG{INT} = \&cleanup;
 $SIG{INT} = \&cleanup;