Skip to content

Commit

Permalink
Get rid of DerivationType::Impure
Browse files Browse the repository at this point in the history
The point of making `DerivationType::ContentAddressed` a record (and
derivation type no longer an enum) was that we already handled this case
and didn't need a new variant.
  • Loading branch information
Ericson2314 committed Mar 31, 2022
1 parent 27b5d2a commit aa99703
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
3 changes: 0 additions & 3 deletions src/libstore/build/derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ void DerivationGoal::inputsRealised()
drvs. */
: true);
},
[&](const DerivationType::Impure &) {
return true;
}
}, drvType.raw());

if (resolveDrv && !fullDrv.inputDrvs.empty()) {
Expand Down
27 changes: 6 additions & 21 deletions src/libstore/derivations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ bool DerivationType::isCA() const
[](const ContentAddressed & ca) {
return true;
},
[](const Impure &) {
return true;
},
}, raw());
}

Expand All @@ -68,9 +65,6 @@ bool DerivationType::isFixed() const
[](const ContentAddressed & ca) {
return ca.fixed;
},
[](const Impure &) {
return false;
},
}, raw());
}

Expand All @@ -83,9 +77,6 @@ bool DerivationType::hasKnownOutputPaths() const
[](const ContentAddressed & ca) {
return ca.fixed;
},
[](const Impure &) {
return false;
},
}, raw());
}

Expand All @@ -99,9 +90,6 @@ bool DerivationType::isSandboxed() const
[](const ContentAddressed & ca) {
return ca.sandboxed;
},
[](const Impure &) {
return false;
},
}, raw());
}

Expand All @@ -113,10 +101,7 @@ bool DerivationType::isPure() const
return true;
},
[](const ContentAddressed & ca) {
return true;
},
[](const Impure &) {
return false;
return ca.sandboxed || ca.fixed;
},
}, raw());
}
Expand Down Expand Up @@ -396,7 +381,7 @@ std::string Derivation::unparse(const Store & store, bool maskOutputs,
s += ','; printUnquotedString(s, "");
s += ','; printUnquotedString(s, "");
},
[&](const DerivationOutputImpure & doi) {
[&](const DerivationOutput::Impure & doi) {
// FIXME
s += ','; printUnquotedString(s, "");
s += ','; printUnquotedString(s, makeFileIngestionPrefix(doi.method) + printHashType(doi.hashType));
Expand Down Expand Up @@ -557,7 +542,10 @@ DerivationType BasicDerivation::type() const
&& floatingCAOutputs.empty()
&& deferredIAOutputs.empty()
&& !impureOutputs.empty())
return DerivationType::Impure { };
return DerivationType::ContentAddressed {
.sandboxed = false,
.fixed = false,
};

throw Error("can't mix derivation output types");
}
Expand Down Expand Up @@ -638,9 +626,6 @@ DrvHash hashDerivationModulo(Store & store, const Derivation & drv, bool maskOut
? DrvHash::Kind::Regular
: DrvHash::Kind::Deferred;
},
[](const DerivationType::Impure &) -> DrvHash::Kind {
return DrvHash::Kind::Deferred;
}
}, drv.type().raw());

std::map<std::string, StringSet> inputs2;
Expand Down
7 changes: 1 addition & 6 deletions src/libstore/derivations.hh
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,16 @@ struct DerivationType_ContentAddressed {
bool fixed;
};

struct DerivationType_Impure {
};

typedef std::variant<
DerivationType_InputAddressed,
DerivationType_ContentAddressed,
DerivationType_Impure
DerivationType_ContentAddressed
> _DerivationTypeRaw;

struct DerivationType : _DerivationTypeRaw {
using Raw = _DerivationTypeRaw;
using Raw::Raw;
using InputAddressed = DerivationType_InputAddressed;
using ContentAddressed = DerivationType_ContentAddressed;
using Impure = DerivationType_Impure;

/* Do the outputs of the derivation have paths calculated from their content,
or from the derivation itself? */
Expand Down

0 comments on commit aa99703

Please sign in to comment.