Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "narinfo: Change NAR URLs to be addressed on the NAR hash inst…
…ead of the compressed hash"
  • Loading branch information
grahamc committed Feb 9, 2021
1 parent ee3846b commit f224509
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/libstore/binary-cache-store.cc
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/binary-cache.sh
Expand Up @@ -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
Expand Down

0 comments on commit f224509

Please sign in to comment.