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
This commit is contained in:
@@ -533,7 +533,7 @@ try {
|
||||
return ia.deferred;
|
||||
},
|
||||
[&](const DerivationType::ContentAddressed & ca) {
|
||||
return !fullDrv.inputDrvs.empty() && !ca.fixed;
|
||||
return false;
|
||||
},
|
||||
}, drvType.raw);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<
|
||||
|
||||
Reference in New Issue
Block a user