From cd0d8e0bd50d7259057ac138a7227907f88b91d5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 8 May 2023 09:57:05 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Valentin Gagarin --- src/build-remote/build-remote.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 1467761c9..7366a7c27 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -312,9 +312,12 @@ connected: // See the very large comment in `case wopBuildDerivation:` in // `src/libstore/daemon.cc` that explains the trust model here. // - // This condition mirrors that: that code enforces the "rules"; + // This condition mirrors that: that code enforces the "rules" outlined there; // we do the best we can given those "rules". - if (std::optional trust = sshStore->isTrustedClient(); (!trust || *trust) || drv.type().isCA()) { + std::optional trusted = sshStore->isTrustedClient(); + // for backward compatibility (use existing comments here) + bool trustedOrLegacy = !trusted || *trusted; + if (trustedOrLegacy || drv.type().isCA()) { // Hijack the inputs paths of the derivation to include all // the paths that come from the `inputDrvs` set. We don’t do // that for the derivations whose `inputDrvs` is empty @@ -331,9 +334,9 @@ connected: if (!result.success()) throw Error("build of '%s' on '%s' failed: %s", store->printStorePath(*drvPath), storeUri, result.errorMsg); } else { - copyPaths(*store, *sshStore, StorePathSet {*drvPath}, NoRepair, NoCheckSigs, substitute); + copyClosure(*store, *sshStore, StorePathSet {*drvPath}, NoRepair, NoCheckSigs, substitute); auto res = sshStore->buildPathsWithResults({ DerivedPath::Built { *drvPath, OutputsSpec::All {} } }); - // One path to build should mean one result back + // One path to build should produce exactly one build result assert(res.size() == 1); optResult = std::move(res[0]); }