Skip to content

Commit 437ba28

Browse files
committed
simplify the tarball lock protocol
We will prune the query string in fastly instead. #76 (comment)
1 parent 24d0dc1 commit 437ba28

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

mirror-nixos-branch.pl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,25 +342,16 @@ sub fetch {
342342
my $cache_control = "maxage=600,stale-while-revalidate=1800,public";
343343

344344
sub redirect {
345-
my ($from, $to, $immutable_flake_tarball) = @_;
345+
my ($from, $to) = @_;
346346
$to = "https://releases.nixos.org/" . $to;
347347
print STDERR "redirect $from -> $to\n";
348-
my $object_metadata = { "x-amz-website-redirect-location" => $to, "cache-control" => $cache_control };
349-
if ($immutable_flake_tarball // 0) {
350-
# Optionally sets a header for the "Lockable HTTP Tarball Protocol".
351-
# See <https://github.com/NixOS/nix/blob/61f49de7ae0b3899abdcc102832523153dd40d35/doc/manual/source/protocols/tarball-fetcher.md>.
352-
# AWS S3 does not not allow setting the "Link" header directly.
353-
# Instead, we prefix the header with "x-amz-meta" and let Fastly
354-
# rename the header for us.
355-
$object_metadata->{'x-amz-meta-link'} = "<$to?rev=$rev>; rel=\"immutable\"";
356-
}
357-
$bucketChannels->add_key($from, "", $object_metadata)
348+
$bucketChannels->add_key($from, "", { "x-amz-website-redirect-location" => $to, "cache-control" => $cache_control })
358349
or die $bucketChannels->err . ": " . $bucketChannels->errstr;
359350
}
360351

361352
# Update channels on channels.nixos.org.
362353
redirect($channelName, $releasePrefix);
363-
redirect("$channelName/nixexprs.tar.xz", "$releasePrefix/nixexprs.tar.xz", 1);
354+
redirect("$channelName/nixexprs.tar.xz", "$releasePrefix/nixexprs.tar.xz?rev=$rev");
364355
redirect("$channelName/git-revision", "$releasePrefix/git-revision");
365356
redirect("$channelName/packages.json.br", "$releasePrefix/packages.json.br");
366357
redirect("$channelName/store-paths.xz", "$releasePrefix/store-paths.xz");

0 commit comments

Comments
 (0)