From 5eb2804cdbc5d288bebc534066577e7e1bff2409 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 Dec 2015 14:28:22 +0100 Subject: [PATCH] copy-tarballs.pl: Create redirects before uploading file This makes the script more robust to interruption. --- maintainers/scripts/copy-tarballs.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/maintainers/scripts/copy-tarballs.pl b/maintainers/scripts/copy-tarballs.pl index 0098061d0f86..b1233827ad88 100755 --- a/maintainers/scripts/copy-tarballs.pl +++ b/maintainers/scripts/copy-tarballs.pl @@ -63,12 +63,6 @@ sub uploadFile { my $mainKey = "sha512/$sha512_16"; - # Upload the file as sha512/. - print STDERR "uploading $fn to $mainKey...\n"; - $bucket->add_key_filename($mainKey, $fn, { 'x-amz-meta-original-name' => $name }) - or die "failed to upload $fn to $mainKey\n"; - $cache{$mainKey} = 1; - # Create redirects from the other hash types. sub redirect { my ($name, $dest) = @_; @@ -82,6 +76,12 @@ sub uploadFile { redirect "sha256/$sha256_32", $mainKey; redirect "sha256/$sha256_16", $mainKey; redirect "sha512/$sha512_32", $mainKey; + + # Upload the file as sha512/. + print STDERR "uploading $fn to $mainKey...\n"; + $bucket->add_key_filename($mainKey, $fn, { 'x-amz-meta-original-name' => $name }) + or die "failed to upload $fn to $mainKey\n"; + $cache{$mainKey} = 1; } my $op = shift @ARGV;