1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-02 05:11:47 +02:00

Make names more consistent

This commit is contained in:
John Ericson 2020-08-05 14:44:39 +00:00
parent 839f0fe095
commit e7b0847f2d
7 changed files with 39 additions and 33 deletions

View file

@ -13,12 +13,12 @@ std::optional<StorePath> DerivationOutput::pathOpt(const Store & store, std::str
[](DerivationOutputInputAddressed doi) -> std::optional<StorePath> {
return { doi.path };
},
[&](DerivationOutputFixed dof) -> std::optional<StorePath> {
[&](DerivationOutputCAFixed dof) -> std::optional<StorePath> {
return {
store.makeFixedOutputPath(dof.hash.method, dof.hash.hash, drvName)
};
},
[](DerivationOutputFloating dof) -> std::optional<StorePath> {
[](DerivationOutputCAFloating dof) -> std::optional<StorePath> {
return std::nullopt;
},
}, output);
@ -27,7 +27,7 @@ std::optional<StorePath> DerivationOutput::pathOpt(const Store & store, std::str
bool derivationIsCA(DerivationType dt) {
switch (dt) {
case DerivationType::Regular: return false;
case DerivationType::InputAddressed: return false;
case DerivationType::CAFixed: return true;
case DerivationType::CAFloating: return true;
};
@ -38,7 +38,7 @@ bool derivationIsCA(DerivationType dt) {
bool derivationIsFixed(DerivationType dt) {
switch (dt) {
case DerivationType::Regular: return false;
case DerivationType::InputAddressed: return false;
case DerivationType::CAFixed: return true;
case DerivationType::CAFloating: return false;
};
@ -47,7 +47,7 @@ bool derivationIsFixed(DerivationType dt) {
bool derivationIsImpure(DerivationType dt) {
switch (dt) {
case DerivationType::Regular: return false;
case DerivationType::InputAddressed: return false;
case DerivationType::CAFixed: return true;
case DerivationType::CAFloating: return false;
};
@ -156,7 +156,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, std::istrings
return hash != ""
? DerivationOutput {
.output = DerivationOutputFixed {
.output = DerivationOutputCAFixed {
.hash = FixedOutputHash {
.method = std::move(method),
.hash = Hash::parseNonSRIUnprefixed(hash, hashType),
@ -164,7 +164,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, std::istrings
}
}
: DerivationOutput {
.output = DerivationOutputFloating {
.output = DerivationOutputCAFloating {
.method = std::move(method),
.hashType = std::move(hashType),
},
@ -321,11 +321,11 @@ string Derivation::unparse(const Store & store, bool maskOutputs,
s += ','; printUnquotedString(s, "");
s += ','; printUnquotedString(s, "");
},
[&](DerivationOutputFixed dof) {
[&](DerivationOutputCAFixed dof) {
s += ','; printUnquotedString(s, dof.hash.printMethodAlgo());
s += ','; printUnquotedString(s, dof.hash.hash.to_string(Base16, false));
},
[&](DerivationOutputFloating dof) {
[&](DerivationOutputCAFloating dof) {
s += ','; printUnquotedString(s, makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType));
s += ','; printUnquotedString(s, "");
},
@ -390,10 +390,10 @@ DerivationType BasicDerivation::type() const
[&](DerivationOutputInputAddressed _) {
inputAddressedOutputs.insert(i.first);
},
[&](DerivationOutputFixed _) {
[&](DerivationOutputCAFixed _) {
fixedCAOutputs.insert(i.first);
},
[&](DerivationOutputFloating dof) {
[&](DerivationOutputCAFloating dof) {
floatingCAOutputs.insert(i.first);
if (!floatingHashType) {
floatingHashType = dof.hashType;
@ -408,7 +408,7 @@ DerivationType BasicDerivation::type() const
if (inputAddressedOutputs.empty() && fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
throw Error("Must have at least one output");
} else if (! inputAddressedOutputs.empty() && fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
return DerivationType::Regular;
return DerivationType::InputAddressed;
} else if (inputAddressedOutputs.empty() && ! fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
if (fixedCAOutputs.size() > 1)
// FIXME: Experimental feature?
@ -474,7 +474,7 @@ DrvHashModulo hashDerivationModulo(Store & store, const Derivation & drv, bool m
case DerivationType::CAFixed: {
std::map<std::string, Hash> outputHashes;
for (const auto & i : drv.outputs) {
auto & dof = std::get<DerivationOutputFixed>(i.second.output);
auto & dof = std::get<DerivationOutputCAFixed>(i.second.output);
auto hash = hashString(htSHA256, "fixed:out:"
+ dof.hash.printMethodAlgo() + ":"
+ dof.hash.hash.to_string(Base16, false) + ":"
@ -483,7 +483,7 @@ DrvHashModulo hashDerivationModulo(Store & store, const Derivation & drv, bool m
}
return outputHashes;
}
case DerivationType::Regular:
case DerivationType::InputAddressed:
break;
}
@ -552,7 +552,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store)
auto hashType = parseHashType(hashAlgo);
return hash != ""
? DerivationOutput {
.output = DerivationOutputFixed {
.output = DerivationOutputCAFixed {
.hash = FixedOutputHash {
.method = std::move(method),
.hash = Hash::parseNonSRIUnprefixed(hash, hashType),
@ -560,7 +560,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store)
}
}
: DerivationOutput {
.output = DerivationOutputFloating {
.output = DerivationOutputCAFloating {
.method = std::move(method),
.hashType = std::move(hashType),
},
@ -628,11 +628,11 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr
[&](DerivationOutputInputAddressed doi) {
out << "" << "";
},
[&](DerivationOutputFixed dof) {
[&](DerivationOutputCAFixed dof) {
out << dof.hash.printMethodAlgo()
<< dof.hash.hash.to_string(Base16, false);
},
[&](DerivationOutputFloating dof) {
[&](DerivationOutputCAFloating dof) {
out << (makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType))
<< "";
},