Support hydra-build-products on binary cache stores
[?]
Feb 26, 2016, 1:45 PM
BAFICF73XUYNAYT6T6X7GQIFHG6CLGPYYNFBMC6ON6SVPNOXO6RACDependencies
- [2]
73YR46NJhydra-queue-runner: Write directly to a binary cache - [3]
NAYQT2GThydra-queue-runner: Use cmdBuildDerivation - [4]
ZK76B5ZZLoad the queue in order of global priority - [5]
DKJFD6JNProcess Nix API changes - [6]
GS4BE6TBAsynchronously compress build logs - [7]
T5BIOVJEAdd support for tracking custom metrics - [8]
WHULPA6SHandle failure with output - [9]
24BMQDZAStart of single-process hydra-queue-runner - [10]
NJJ7H64SVery basic multi-threaded queue runner - [11]
MHVIT4JYSplit hydra-queue-runner.cc more - [12]
YHP5DSOOImprove parsing of hydra-build-products
Change contents
- edit in src/hydra-queue-runner/build-result.cc at line 5
#include "fs-accessor.hh" - edit in src/hydra-queue-runner/build-result.cc at line 8
static std::tuple<bool, string> secureRead(Path fileName){auto fail = std::make_tuple(false, "");if (!pathExists(fileName)) return fail;try {/* For security, resolve symlinks. */fileName = canonPath(fileName, true);if (!isInStore(fileName)) return fail;return std::make_tuple(true, readFile(fileName));} catch (Error & e) { return fail; }} - replacement in src/hydra-queue-runner/build-result.cc at line 10
BuildOutput getBuildOutput(nix::ref<Store> store, const Derivation & drv)BuildOutput getBuildOutput(nix::ref<Store> store,nix::ref<nix::FSAccessor> accessor, const Derivation & drv) - edit in src/hydra-queue-runner/build-result.cc at line 31
#if 0 - replacement in src/hydra-queue-runner/build-result.cc at line 42
if (pathExists(failedFile)) res.failed = true;if (accessor->stat(failedFile).type == FSAccessor::Type::tRegular)res.failed = true; - replacement in src/hydra-queue-runner/build-result.cc at line 45
auto file = secureRead(output + "/nix-support/hydra-build-products");if (!std::get<0>(file)) continue;Path productsFile = output + "/nix-support/hydra-build-products";if (accessor->stat(productsFile).type != FSAccessor::Type::tRegular)continue; - replacement in src/hydra-queue-runner/build-result.cc at line 51
for (auto & line : tokenizeString<Strings>(std::get<1>(file), "\n")) {for (auto & line : tokenizeString<Strings>(accessor->readFile(productsFile), "\n")) { - edit in src/hydra-queue-runner/build-result.cc at line 64
// FIXME: should we disallow products referring to other// store paths, or that are outside the input closure? - replacement in src/hydra-queue-runner/build-result.cc at line 67
try {product.path = canonPath(product.path, true);} catch (Error & e) { continue; }if (!isInStore(product.path) || !pathExists(product.path)) continue;product.path = canonPath(product.path);if (!isInStore(product.path)) continue; - replacement in src/hydra-queue-runner/build-result.cc at line 70
/* FIXME: check that the path is in the input closureof the build? */auto st = accessor->stat(product.path);if (st.type == FSAccessor::Type::tMissing) continue; - edit in src/hydra-queue-runner/build-result.cc at line 74
struct stat st;if (stat(product.path.c_str(), &st))throw SysError(format("getting status of ‘%1%’") % product.path); - replacement in src/hydra-queue-runner/build-result.cc at line 75
if (S_ISREG(st.st_mode)) {if (st.type == FSAccessor::Type::tRegular) { - replacement in src/hydra-queue-runner/build-result.cc at line 77
product.fileSize = st.st_size;product.sha1hash = hashFile(htSHA1, product.path);product.sha256hash = hashFile(htSHA256, product.path);product.fileSize = st.fileSize;auto contents = accessor->readFile(product.path);product.sha1hash = hashString(htSHA1, contents);product.sha256hash = hashString(htSHA256, contents); - edit in src/hydra-queue-runner/build-result.cc at line 86
#endif - replacement in src/hydra-queue-runner/build-result.cc at line 97[3.3665]→[2.1122:1128](∅→∅),[2.1128]→[3.3665:3865](∅→∅),[3.3665]→[3.3665:3865](∅→∅),[3.3865]→[2.1129:1136](∅→∅)
#if 0struct stat st;if (stat(product.path.c_str(), &st))throw SysError(format("getting status of ‘%1%’") % product.path);if (S_ISDIR(st.st_mode))#endifauto st = accessor->stat(product.path);if (st.type == FSAccessor::Type::tMissing)throw Error(format("getting status of ‘%1%’") % product.path);if (st.type == FSAccessor::Type::tDirectory) - edit in src/hydra-queue-runner/build-result.cc at line 105
#if 0 - replacement in src/hydra-queue-runner/build-result.cc at line 108
if (!pathExists(p)) continue;if (accessor->stat(p).type != FSAccessor::Type::tRegular) continue; - replacement in src/hydra-queue-runner/build-result.cc at line 110
res.releaseName = trim(readFile(p));res.releaseName = trim(accessor->readFile(p)); - replacement in src/hydra-queue-runner/build-result.cc at line 117
auto file = secureRead(output + "/nix-support/hydra-metrics");for (auto & line : tokenizeString<Strings>(std::get<1>(file), "\n")) {Path metricsFile = output + "/nix-support/hydra-metrics";if (accessor->stat(metricsFile).type != FSAccessor::Type::tRegular) continue;for (auto & line : tokenizeString<Strings>(accessor->readFile(metricsFile), "\n")) { - edit in src/hydra-queue-runner/build-result.cc at line 129
#endif - edit in src/hydra-queue-runner/build-result.hh at line 7
#include "store-api.hh" - replacement in src/hydra-queue-runner/build-result.hh at line 41
BuildOutput getBuildOutput(nix::ref<nix::Store> store, const nix::Derivation & drv);[3.4741]BuildOutput getBuildOutput(nix::ref<nix::Store> store,nix::ref<nix::FSAccessor> accessor, const nix::Derivation & drv); - replacement in src/hydra-queue-runner/builder.cc at line 129
if (result.success()) res = getBuildOutput(destStore, step->drv);if (result.success()) res = getBuildOutput(destStore, destStore->getFSAccessor(), step->drv); - replacement in src/hydra-queue-runner/queue-monitor.cc at line 162
BuildOutput res = getBuildOutput(destStore, drv);BuildOutput res = getBuildOutput(destStore, destStore->getFSAccessor(), drv);