From e3717b728c6fe55409ad249b2b372b231c72c425 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 16 May 2025 13:16:18 +0200 Subject: [PATCH] libstore: trivialize DerivationType::ContentAddressed only FODs can be content-addressed now, and those are always fixed. FODs are also never sandboxed, so we do not need that field either. Change-Id: I1be62b3ec85e08ec003cc8769723328d19777728 --- lix/libstore/build/derivation-goal.cc | 2 +- lix/libstore/derivations.cc | 15 +++++---------- lix/libstore/derivations.hh | 19 +------------------ 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/lix/libstore/build/derivation-goal.cc b/lix/libstore/build/derivation-goal.cc index feb790b9d..850fe33d4 100644 --- a/lix/libstore/build/derivation-goal.cc +++ b/lix/libstore/build/derivation-goal.cc @@ -533,7 +533,7 @@ try { return ia.deferred; }, [&](const DerivationType::ContentAddressed & ca) { - return !fullDrv.inputDrvs.empty() && !ca.fixed; + return false; }, }, drvType.raw); diff --git a/lix/libstore/derivations.cc b/lix/libstore/derivations.cc index aa53251e6..74e978222 100644 --- a/lix/libstore/derivations.cc +++ b/lix/libstore/derivations.cc @@ -63,7 +63,7 @@ bool DerivationType::isFixed() const return false; }, [](const ContentAddressed & ca) { - return ca.fixed; + return true; }, }, raw); } @@ -75,7 +75,7 @@ bool DerivationType::hasKnownOutputPaths() const return !ia.deferred; }, [](const ContentAddressed & ca) { - return ca.fixed; + return true; }, }, raw); } @@ -88,7 +88,7 @@ bool DerivationType::isSandboxed() const return true; }, [](const ContentAddressed & ca) { - return ca.sandboxed; + return false; }, }, raw); } @@ -550,10 +550,7 @@ DerivationType BasicDerivation::type() const throw Error("only one fixed output is allowed for now"); if (*fixedCAOutputs.begin() != "out") throw Error("single fixed output must be named \"out\""); - return DerivationType::ContentAddressed { - .sandboxed = false, - .fixed = true, - }; + return DerivationType::ContentAddressed {}; } if (inputAddressedOutputs.empty() @@ -641,9 +638,7 @@ try { return DrvHash::Kind::Regular; }, [](const DerivationType::ContentAddressed & ca) { - return ca.fixed - ? DrvHash::Kind::Regular - : DrvHash::Kind::Deferred; + return DrvHash::Kind::Regular; }, }, drv.type().raw); diff --git a/lix/libstore/derivations.hh b/lix/libstore/derivations.hh index e66ac2f62..cc10af2a7 100644 --- a/lix/libstore/derivations.hh +++ b/lix/libstore/derivations.hh @@ -147,24 +147,7 @@ struct DerivationType { * Content-addressed derivation types */ struct ContentAddressed { - /** - * Whether the derivation should be built safely inside a sandbox. - */ - bool sandboxed; - /** - * Whether the derivation's outputs' content-addresses are "fixed" - * or "floating". - * - * - Fixed: content-addresses are written down as part of the - * derivation itself. If the outputs don't end up matching the - * build fails. - * - * - Floating: content-addresses are not written down, we do not - * know them until we perform the build. - */ - bool fixed; - - GENERATE_CMP(ContentAddressed, me->sandboxed, me->fixed); + GENERATE_CMP(ContentAddressed); }; typedef std::variant<