hydra-queue-runner: Compress binary cache NARs using xz
[?]
Feb 15, 2016, 8:56 PM
3FQ65IXOIAWKEV67IXY7WRUX4OGMDYRA3RZJ2XPZ42AZXUANQ74QCDependencies
- [2]
73YR46NJhydra-queue-runner: Write directly to a binary cache
Change contents
- edit in src/hydra-queue-runner/local-binary-cache.cc at line 4
#include "compression.hh" - edit in src/hydra-queue-runner/local-binary-cache.cc at line 36
Path narInfoFile = narInfoFileFor(info.path);if (pathExists(narInfoFile)) return; - edit in src/hydra-queue-runner/local-binary-cache.cc at line 47
/* Compress the NAR. */string narXz = compressXZ(nar);Hash narXzHash = hashString(htSHA256, narXz); - replacement in src/hydra-queue-runner/local-binary-cache.cc at line 53
string narFileRel = "nar/" + printHash(narHash) + ".nar";string narFileRel = "nar/" + printHash32(narXzHash) + ".nar.xz"; - replacement in src/hydra-queue-runner/local-binary-cache.cc at line 55
if (!pathExists(narFile)) atomicWrite(narFile, nar);if (!pathExists(narFile)) atomicWrite(narFile, narXz); - replacement in src/hydra-queue-runner/local-binary-cache.cc at line 58
Path narInfoFile = narInfoFileFor(info.path);Strings refs;for (auto & r : info.references)refs.push_back(baseNameOf(r)); - replacement in src/hydra-queue-runner/local-binary-cache.cc at line 62
if (!pathExists(narInfoFile)) {std::string narInfo;narInfo += "StorePath: " + info.path + "\n";narInfo += "URL: " + narFileRel + "\n";narInfo += "Compression: xz\n";narInfo += "FileHash: sha256:" + printHash32(narXzHash) + "\n";narInfo += "FileSize: " + std::to_string(narXz.size()) + "\n";narInfo += "NarHash: sha256:" + printHash32(narHash) + "\n";narInfo += "NarSize: " + std::to_string(narSize) + "\n";narInfo += "References: " + concatStringsSep(" ", refs) + "\n"; - replacement in src/hydra-queue-runner/local-binary-cache.cc at line 72
Strings refs;for (auto & r : info.references)refs.push_back(baseNameOf(r));std::string narInfo;narInfo += "StorePath: " + info.path + "\n";narInfo += "URL: " + narFileRel + "\n";narInfo += "Compression: none\n";narInfo += "FileHash: sha256:" + printHash(narHash) + "\n";narInfo += "FileSize: " + std::to_string(narSize) + "\n";narInfo += "NarHash: sha256:" + printHash(narHash) + "\n";narInfo += "NarSize: " + std::to_string(narSize) + "\n";narInfo += "References: " + concatStringsSep(" ", refs) + "\n";// FIXME: add signature - replacement in src/hydra-queue-runner/local-binary-cache.cc at line 74
// FIXME: add signatureatomicWrite(narInfoFile, narInfo);}atomicWrite(narInfoFile, narInfo); - edit in src/hydra-queue-runner/local-binary-cache.cc at line 117
else if (name == "Compression") {res.compression = value;} - edit in src/hydra-queue-runner/local-binary-cache.cc at line 145
/* Decompress the NAR. FIXME: would be nice to have the remoteside do this. */if (res.compression == "none");else if (res.compression == "xz")nar = decompressXZ(nar);elsethrow Error(format("unknown NAR compression type ‘%1%’") % nar); - edit in src/hydra-queue-runner/local-binary-cache.hh at line 27
std::string compression = "none";