diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-02-10 15:35:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 15:35:03 +0100 |
commit | 4e98f0345c144b9d85bed1f6b0bc509bf7ddc000 (patch) | |
tree | 556b9f599556d76b8fa0db7acc14c80b8e7b5b1f | |
parent | 2d4e1025f9ae6516ecb8483e05ff1abd80e6b303 (diff) | |
parent | f2245091d033a8037aeb29ae701d20611500af6d (diff) |
Merge pull request #4535 from NixOS/revert-4464-nar-narhash-addressed
Revert "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, 6 insertions, 2 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 15163ead5..4f5f8607d 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -176,7 +176,11 @@ ref<const ValidPathInfo> BinaryCacheStore::addToStoreCommon( auto [fileHash, fileSize] = fileHashSink.finish(); narInfo->fileHash = fileHash; narInfo->fileSize = fileSize; - narInfo->url = "nar/" + info.narHash.to_string(Base32, false) + ".nar"; + narInfo->url = "nar/" + narInfo->fileHash->to_string(Base32, false) + ".nar" + + (compression == "xz" ? ".xz" : + compression == "bzip2" ? ".bz2" : + compression == "br" ? ".br" : + ""); 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 f8d47170f..6697ce236 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 | head -n1) +nar=$(ls $cacheDir/nar/*.nar.xz | head -n1) mv $nar $nar.good mkdir -p $TEST_ROOT/empty nix-store --dump $TEST_ROOT/empty | xz > $nar |