Skip to content

Commit f224509

Browse files
authoredFeb 9, 2021
Revert "narinfo: Change NAR URLs to be addressed on the NAR hash instead of the compressed hash"
1 parent ee3846b commit f224509

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎src/libstore/binary-cache-store.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ ref<const ValidPathInfo> BinaryCacheStore::addToStoreCommon(
176176
auto [fileHash, fileSize] = fileHashSink.finish();
177177
narInfo->fileHash = fileHash;
178178
narInfo->fileSize = fileSize;
179-
narInfo->url = "nar/" + info.narHash.to_string(Base32, false) + ".nar";
179+
narInfo->url = "nar/" + narInfo->fileHash->to_string(Base32, false) + ".nar"
180+
+ (compression == "xz" ? ".xz" :
181+
compression == "bzip2" ? ".bz2" :
182+
compression == "br" ? ".br" :
183+
"");
180184

181185
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count();
182186
printMsg(lvlTalkative, "copying path '%1%' (%2% bytes, compressed %3$.1f%% in %4% ms) to binary cache",

‎tests/binary-cache.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ basicDownloadTests
6060
# Test whether Nix notices if the NAR doesn't match the hash in the NAR info.
6161
clearStore
6262

63-
nar=$(ls $cacheDir/nar/*.nar | head -n1)
63+
nar=$(ls $cacheDir/nar/*.nar.xz | head -n1)
6464
mv $nar $nar.good
6565
mkdir -p $TEST_ROOT/empty
6666
nix-store --dump $TEST_ROOT/empty | xz > $nar

0 commit comments

Comments
 (0)
Please sign in to comment.