Revert "scripts/download.pl: read file natively"
This reverts commit 65560de58de7a3cde8f960849e3c7c640b9456d8. Seems to broke CI and require more testing. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
388de64d9f
commit
07159cc25a
@ -32,12 +32,6 @@ my $download_tool;
|
|||||||
|
|
||||||
$url_filename or $url_filename = $filename;
|
$url_filename or $url_filename = $filename;
|
||||||
|
|
||||||
sub cat {
|
|
||||||
open my $fh, '<', $1 or die "Can't open file $!";
|
|
||||||
read $fh, my $file_content, -s $fh;
|
|
||||||
return $file_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub localmirrors {
|
sub localmirrors {
|
||||||
my @mlist;
|
my @mlist;
|
||||||
open LM, "$scriptdir/localmirrors" and do {
|
open LM, "$scriptdir/localmirrors" and do {
|
||||||
@ -209,7 +203,7 @@ sub download
|
|||||||
copy($link, "$target/$filename.dl");
|
copy($link, "$target/$filename.dl");
|
||||||
|
|
||||||
$hash_cmd and do {
|
$hash_cmd and do {
|
||||||
if (system("$hash_cmd '$target/$filename.dl' > '$target/$filename.hash'")) {
|
if (system("cat '$target/$filename.dl' | $hash_cmd > '$target/$filename.hash'")) {
|
||||||
print("Failed to generate hash for $filename\n");
|
print("Failed to generate hash for $filename\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,7 +233,7 @@ sub download
|
|||||||
}
|
}
|
||||||
|
|
||||||
$hash_cmd and do {
|
$hash_cmd and do {
|
||||||
my $sum = cat("$target/$filename.hash");
|
my $sum = `cat "$target/$filename.hash"`;
|
||||||
$sum =~ /^(\w+)\s*/ or die "Could not generate file hash\n";
|
$sum =~ /^(\w+)\s*/ or die "Could not generate file hash\n";
|
||||||
$sum = $1;
|
$sum = $1;
|
||||||
|
|
||||||
@ -305,11 +299,11 @@ projectsmirrors '@OPENWRT';
|
|||||||
|
|
||||||
if (-f "$target/$filename") {
|
if (-f "$target/$filename") {
|
||||||
$hash_cmd and do {
|
$hash_cmd and do {
|
||||||
if (system("$hash_cmd '$target/$filename' > '$target/$filename.hash'")) {
|
if (system("cat '$target/$filename' | $hash_cmd > '$target/$filename.hash'")) {
|
||||||
die "Failed to generate hash for $filename\n";
|
die "Failed to generate hash for $filename\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $sum = cat("$target/$filename.hash");
|
my $sum = `cat "$target/$filename.hash"`;
|
||||||
$sum =~ /^(\w+)\s*/ or die "Could not generate file hash\n";
|
$sum =~ /^(\w+)\s*/ or die "Could not generate file hash\n";
|
||||||
$sum = $1;
|
$sum = $1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user