diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-02-09 14:47:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 14:47:39 +0100 |
commit | ee3846b5870f23064925e2d36439d9a3ec1688d1 (patch) | |
tree | 907d49e33f9a2fdb0091c6ab4d2297bd971cb7b5 | |
parent | fd6eaa17660732c98a000cb92399d04f003654a6 (diff) | |
parent | 144cad906991015e997a6b3e7cc69412eb2b8ab1 (diff) |
Merge pull request #4464 from tweag/nar-narhash-addressed
narinfo: Change NAR URLs to be addressed on the NAR hash instead of the compressed hash
-rw-r--r-- | src/libstore/binary-cache-store.cc | 6 | ||||
-rw-r--r-- | tests/binary-cache.sh | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 4f5f8607d..15163ead5 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -176,11 +176,7 @@ ref<const ValidPathInfo> BinaryCacheStore::addToStoreCommon( auto [fileHash, fileSize] = fileHashSink.finish(); narInfo->fileHash = fileHash; narInfo->fileSize = fileSize; - narInfo->url = "nar/" + narInfo->fileHash->to_string(Base32, false) + ".nar" - + (compression == "xz" ? ".xz" : - compression == "bzip2" ? ".bz2" : - compression == "br" ? ".br" : - ""); + narInfo->url = "nar/" + info.narHash.to_string(Base32, false) + ".nar"; auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count(); printMsg(lvlTalkative, "copying path '%1%' (%2% bytes, compressed %3$.1f%% in %4% ms) to binary cache", diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh index 6697ce236..f8d47170f 100644 --- a/tests/binary-cache.sh +++ b/tests/binary-cache.sh @@ -60,7 +60,7 @@ basicDownloadTests # Test whether Nix notices if the NAR doesn't match the hash in the NAR info. clearStore -nar=$(ls $cacheDir/nar/*.nar.xz | head -n1) +nar=$(ls $cacheDir/nar/*.nar | head -n1) mv $nar $nar.good mkdir -p $TEST_ROOT/empty nix-store --dump $TEST_ROOT/empty | xz > $nar |