mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Sed some names to perhaps avoid conflicts
This commit is contained in:
parent
951415b568
commit
b9ebe373bb
7 changed files with 35 additions and 35 deletions
|
@ -783,7 +783,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
|
||||||
auto outPath = state.store->makeFixedOutputPath(ingestionMethod, h, drvName);
|
auto outPath = state.store->makeFixedOutputPath(ingestionMethod, h, drvName);
|
||||||
if (!jsonObject) drv.env["out"] = state.store->printStorePath(outPath);
|
if (!jsonObject) drv.env["out"] = state.store->printStorePath(outPath);
|
||||||
drv.outputs.insert_or_assign("out", DerivationOutput {
|
drv.outputs.insert_or_assign("out", DerivationOutput {
|
||||||
.output = DerivationOutputFixed {
|
.output = DerivationOutputCAFixed {
|
||||||
.hash = FixedOutputHash {
|
.hash = FixedOutputHash {
|
||||||
.method = ingestionMethod,
|
.method = ingestionMethod,
|
||||||
.hash = std::move(h),
|
.hash = std::move(h),
|
||||||
|
@ -797,7 +797,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
|
||||||
for (auto & i : outputs) {
|
for (auto & i : outputs) {
|
||||||
if (!jsonObject) drv.env[i] = hashPlaceholder(i);
|
if (!jsonObject) drv.env[i] = hashPlaceholder(i);
|
||||||
drv.outputs.insert_or_assign(i, DerivationOutput {
|
drv.outputs.insert_or_assign(i, DerivationOutput {
|
||||||
.output = DerivationOutputFloating {
|
.output = DerivationOutputCAFloating {
|
||||||
.method = ingestionMethod,
|
.method = ingestionMethod,
|
||||||
.hashType = std::move(ht),
|
.hashType = std::move(ht),
|
||||||
},
|
},
|
||||||
|
|
|
@ -3722,18 +3722,18 @@ void DerivationGoal::registerOutputs()
|
||||||
std::optional<ContentAddress> ca;
|
std::optional<ContentAddress> ca;
|
||||||
|
|
||||||
if (! std::holds_alternative<DerivationOutputInputAddressed>(i.second.output)) {
|
if (! std::holds_alternative<DerivationOutputInputAddressed>(i.second.output)) {
|
||||||
DerivationOutputFloating outputHash;
|
DerivationOutputCAFloating outputHash;
|
||||||
std::visit(overloaded {
|
std::visit(overloaded {
|
||||||
[&](DerivationOutputInputAddressed doi) {
|
[&](DerivationOutputInputAddressed doi) {
|
||||||
assert(false); // Enclosing `if` handles this case in other branch
|
assert(false); // Enclosing `if` handles this case in other branch
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed dof) {
|
[&](DerivationOutputCAFixed dof) {
|
||||||
outputHash = DerivationOutputFloating {
|
outputHash = DerivationOutputCAFloating {
|
||||||
.method = dof.hash.method,
|
.method = dof.hash.method,
|
||||||
.hashType = dof.hash.hash.type,
|
.hashType = dof.hash.hash.type,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFloating dof) {
|
[&](DerivationOutputCAFloating dof) {
|
||||||
outputHash = dof;
|
outputHash = dof;
|
||||||
},
|
},
|
||||||
}, i.second.output);
|
}, i.second.output);
|
||||||
|
@ -3758,7 +3758,7 @@ void DerivationGoal::registerOutputs()
|
||||||
// true if either floating CA, or incorrect fixed hash.
|
// true if either floating CA, or incorrect fixed hash.
|
||||||
bool needsMove = true;
|
bool needsMove = true;
|
||||||
|
|
||||||
if (auto p = std::get_if<DerivationOutputFixed>(& i.second.output)) {
|
if (auto p = std::get_if<DerivationOutputCAFixed>(& i.second.output)) {
|
||||||
Hash & h = p->hash.hash;
|
Hash & h = p->hash.hash;
|
||||||
if (h != h2) {
|
if (h != h2) {
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
||||||
auto & output = drv.outputs.begin()->second;
|
auto & output = drv.outputs.begin()->second;
|
||||||
|
|
||||||
/* Try the hashed mirrors first. */
|
/* Try the hashed mirrors first. */
|
||||||
if (auto hash = std::get_if<DerivationOutputFixed>(&output.output)) {
|
if (auto hash = std::get_if<DerivationOutputCAFixed>(&output.output)) {
|
||||||
if (hash->hash.method == FileIngestionMethod::Flat) {
|
if (hash->hash.method == FileIngestionMethod::Flat) {
|
||||||
for (auto hashedMirror : settings.hashedMirrors.get()) {
|
for (auto hashedMirror : settings.hashedMirrors.get()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -13,12 +13,12 @@ std::optional<StorePath> DerivationOutput::pathOpt(const Store & store, std::str
|
||||||
[](DerivationOutputInputAddressed doi) -> std::optional<StorePath> {
|
[](DerivationOutputInputAddressed doi) -> std::optional<StorePath> {
|
||||||
return { doi.path };
|
return { doi.path };
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed dof) -> std::optional<StorePath> {
|
[&](DerivationOutputCAFixed dof) -> std::optional<StorePath> {
|
||||||
return {
|
return {
|
||||||
store.makeFixedOutputPath(dof.hash.method, dof.hash.hash, drvName)
|
store.makeFixedOutputPath(dof.hash.method, dof.hash.hash, drvName)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[](DerivationOutputFloating dof) -> std::optional<StorePath> {
|
[](DerivationOutputCAFloating dof) -> std::optional<StorePath> {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
},
|
},
|
||||||
}, output);
|
}, output);
|
||||||
|
@ -27,7 +27,7 @@ std::optional<StorePath> DerivationOutput::pathOpt(const Store & store, std::str
|
||||||
|
|
||||||
bool derivationIsCA(DerivationType dt) {
|
bool derivationIsCA(DerivationType dt) {
|
||||||
switch (dt) {
|
switch (dt) {
|
||||||
case DerivationType::Regular: return false;
|
case DerivationType::InputAddressed: return false;
|
||||||
case DerivationType::CAFixed: return true;
|
case DerivationType::CAFixed: return true;
|
||||||
case DerivationType::CAFloating: return true;
|
case DerivationType::CAFloating: return true;
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,7 @@ bool derivationIsCA(DerivationType dt) {
|
||||||
|
|
||||||
bool derivationIsFixed(DerivationType dt) {
|
bool derivationIsFixed(DerivationType dt) {
|
||||||
switch (dt) {
|
switch (dt) {
|
||||||
case DerivationType::Regular: return false;
|
case DerivationType::InputAddressed: return false;
|
||||||
case DerivationType::CAFixed: return true;
|
case DerivationType::CAFixed: return true;
|
||||||
case DerivationType::CAFloating: return false;
|
case DerivationType::CAFloating: return false;
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@ bool derivationIsFixed(DerivationType dt) {
|
||||||
|
|
||||||
bool derivationIsImpure(DerivationType dt) {
|
bool derivationIsImpure(DerivationType dt) {
|
||||||
switch (dt) {
|
switch (dt) {
|
||||||
case DerivationType::Regular: return false;
|
case DerivationType::InputAddressed: return false;
|
||||||
case DerivationType::CAFixed: return true;
|
case DerivationType::CAFixed: return true;
|
||||||
case DerivationType::CAFloating: return false;
|
case DerivationType::CAFloating: return false;
|
||||||
};
|
};
|
||||||
|
@ -156,7 +156,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, std::istrings
|
||||||
|
|
||||||
return hash != ""
|
return hash != ""
|
||||||
? DerivationOutput {
|
? DerivationOutput {
|
||||||
.output = DerivationOutputFixed {
|
.output = DerivationOutputCAFixed {
|
||||||
.hash = FixedOutputHash {
|
.hash = FixedOutputHash {
|
||||||
.method = std::move(method),
|
.method = std::move(method),
|
||||||
.hash = Hash(hash, hashType),
|
.hash = Hash(hash, hashType),
|
||||||
|
@ -165,7 +165,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, std::istrings
|
||||||
}
|
}
|
||||||
: (settings.requireExperimentalFeature("ca-derivations"),
|
: (settings.requireExperimentalFeature("ca-derivations"),
|
||||||
DerivationOutput {
|
DerivationOutput {
|
||||||
.output = DerivationOutputFloating {
|
.output = DerivationOutputCAFloating {
|
||||||
.method = std::move(method),
|
.method = std::move(method),
|
||||||
.hashType = std::move(hashType),
|
.hashType = std::move(hashType),
|
||||||
},
|
},
|
||||||
|
@ -322,11 +322,11 @@ string Derivation::unparse(const Store & store, bool maskOutputs,
|
||||||
s += ','; printUnquotedString(s, "");
|
s += ','; printUnquotedString(s, "");
|
||||||
s += ','; printUnquotedString(s, "");
|
s += ','; printUnquotedString(s, "");
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed dof) {
|
[&](DerivationOutputCAFixed dof) {
|
||||||
s += ','; printUnquotedString(s, dof.hash.printMethodAlgo());
|
s += ','; printUnquotedString(s, dof.hash.printMethodAlgo());
|
||||||
s += ','; printUnquotedString(s, dof.hash.hash.to_string(Base16, false));
|
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, makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType));
|
||||||
s += ','; printUnquotedString(s, "");
|
s += ','; printUnquotedString(s, "");
|
||||||
},
|
},
|
||||||
|
@ -391,10 +391,10 @@ DerivationType BasicDerivation::type() const
|
||||||
[&](DerivationOutputInputAddressed _) {
|
[&](DerivationOutputInputAddressed _) {
|
||||||
inputAddressedOutputs.insert(i.first);
|
inputAddressedOutputs.insert(i.first);
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed _) {
|
[&](DerivationOutputCAFixed _) {
|
||||||
fixedCAOutputs.insert(i.first);
|
fixedCAOutputs.insert(i.first);
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFloating dof) {
|
[&](DerivationOutputCAFloating dof) {
|
||||||
floatingCAOutputs.insert(i.first);
|
floatingCAOutputs.insert(i.first);
|
||||||
if (!floatingHashType) {
|
if (!floatingHashType) {
|
||||||
floatingHashType = dof.hashType;
|
floatingHashType = dof.hashType;
|
||||||
|
@ -409,7 +409,7 @@ DerivationType BasicDerivation::type() const
|
||||||
if (inputAddressedOutputs.empty() && fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
|
if (inputAddressedOutputs.empty() && fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
|
||||||
throw Error("Must have at least one output");
|
throw Error("Must have at least one output");
|
||||||
} else if (! inputAddressedOutputs.empty() && fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
|
} else if (! inputAddressedOutputs.empty() && fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
|
||||||
return DerivationType::Regular;
|
return DerivationType::InputAddressed;
|
||||||
} else if (inputAddressedOutputs.empty() && ! fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
|
} else if (inputAddressedOutputs.empty() && ! fixedCAOutputs.empty() && floatingCAOutputs.empty()) {
|
||||||
if (fixedCAOutputs.size() > 1)
|
if (fixedCAOutputs.size() > 1)
|
||||||
// FIXME: Experimental feature?
|
// FIXME: Experimental feature?
|
||||||
|
@ -475,7 +475,7 @@ DrvHashModulo hashDerivationModulo(Store & store, const Derivation & drv, bool m
|
||||||
case DerivationType::CAFixed: {
|
case DerivationType::CAFixed: {
|
||||||
std::map<std::string, Hash> outputHashes;
|
std::map<std::string, Hash> outputHashes;
|
||||||
for (const auto & i : drv.outputs) {
|
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:"
|
auto hash = hashString(htSHA256, "fixed:out:"
|
||||||
+ dof.hash.printMethodAlgo() + ":"
|
+ dof.hash.printMethodAlgo() + ":"
|
||||||
+ dof.hash.hash.to_string(Base16, false) + ":"
|
+ dof.hash.hash.to_string(Base16, false) + ":"
|
||||||
|
@ -484,7 +484,7 @@ DrvHashModulo hashDerivationModulo(Store & store, const Derivation & drv, bool m
|
||||||
}
|
}
|
||||||
return outputHashes;
|
return outputHashes;
|
||||||
}
|
}
|
||||||
case DerivationType::Regular:
|
case DerivationType::InputAddressed:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store)
|
||||||
auto hashType = parseHashType(hashAlgo);
|
auto hashType = parseHashType(hashAlgo);
|
||||||
return hash != ""
|
return hash != ""
|
||||||
? DerivationOutput {
|
? DerivationOutput {
|
||||||
.output = DerivationOutputFixed {
|
.output = DerivationOutputCAFixed {
|
||||||
.hash = FixedOutputHash {
|
.hash = FixedOutputHash {
|
||||||
.method = std::move(method),
|
.method = std::move(method),
|
||||||
.hash = Hash(hash, hashType),
|
.hash = Hash(hash, hashType),
|
||||||
|
@ -562,7 +562,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store)
|
||||||
}
|
}
|
||||||
: (settings.requireExperimentalFeature("ca-derivations"),
|
: (settings.requireExperimentalFeature("ca-derivations"),
|
||||||
DerivationOutput {
|
DerivationOutput {
|
||||||
.output = DerivationOutputFloating {
|
.output = DerivationOutputCAFloating {
|
||||||
.method = std::move(method),
|
.method = std::move(method),
|
||||||
.hashType = std::move(hashType),
|
.hashType = std::move(hashType),
|
||||||
},
|
},
|
||||||
|
@ -630,11 +630,11 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr
|
||||||
[&](DerivationOutputInputAddressed doi) {
|
[&](DerivationOutputInputAddressed doi) {
|
||||||
out << "" << "";
|
out << "" << "";
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed dof) {
|
[&](DerivationOutputCAFixed dof) {
|
||||||
out << dof.hash.printMethodAlgo()
|
out << dof.hash.printMethodAlgo()
|
||||||
<< dof.hash.hash.to_string(Base16, false);
|
<< dof.hash.hash.to_string(Base16, false);
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFloating dof) {
|
[&](DerivationOutputCAFloating dof) {
|
||||||
out << (makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType))
|
out << (makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType))
|
||||||
<< "";
|
<< "";
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,12 +21,12 @@ struct DerivationOutputInputAddressed
|
||||||
StorePath path;
|
StorePath path;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DerivationOutputFixed
|
struct DerivationOutputCAFixed
|
||||||
{
|
{
|
||||||
FixedOutputHash hash; /* hash used for expected hash computation */
|
FixedOutputHash hash; /* hash used for expected hash computation */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DerivationOutputFloating
|
struct DerivationOutputCAFloating
|
||||||
{
|
{
|
||||||
/* information used for expected hash computation */
|
/* information used for expected hash computation */
|
||||||
FileIngestionMethod method;
|
FileIngestionMethod method;
|
||||||
|
@ -37,8 +37,8 @@ struct DerivationOutput
|
||||||
{
|
{
|
||||||
std::variant<
|
std::variant<
|
||||||
DerivationOutputInputAddressed,
|
DerivationOutputInputAddressed,
|
||||||
DerivationOutputFixed,
|
DerivationOutputCAFixed,
|
||||||
DerivationOutputFloating
|
DerivationOutputCAFloating
|
||||||
> output;
|
> output;
|
||||||
std::optional<HashType> hashAlgoOpt(const Store & store) const;
|
std::optional<HashType> hashAlgoOpt(const Store & store) const;
|
||||||
std::optional<StorePath> pathOpt(const Store & store, std::string_view drvName) const;
|
std::optional<StorePath> pathOpt(const Store & store, std::string_view drvName) const;
|
||||||
|
@ -59,7 +59,7 @@ typedef std::map<StorePath, StringSet> DerivationInputs;
|
||||||
typedef std::map<string, string> StringPairs;
|
typedef std::map<string, string> StringPairs;
|
||||||
|
|
||||||
enum struct DerivationType : uint8_t {
|
enum struct DerivationType : uint8_t {
|
||||||
Regular,
|
InputAddressed,
|
||||||
CAFixed,
|
CAFixed,
|
||||||
CAFloating,
|
CAFloating,
|
||||||
};
|
};
|
||||||
|
|
|
@ -573,11 +573,11 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat
|
||||||
printStorePath(drvPath), printStorePath(doia.path), printStorePath(recomputed));
|
printStorePath(drvPath), printStorePath(doia.path), printStorePath(recomputed));
|
||||||
envHasRightPath(doia.path, i.first);
|
envHasRightPath(doia.path, i.first);
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed dof) {
|
[&](DerivationOutputCAFixed dof) {
|
||||||
StorePath path = makeFixedOutputPath(dof.hash.method, dof.hash.hash, drvName);
|
StorePath path = makeFixedOutputPath(dof.hash.method, dof.hash.hash, drvName);
|
||||||
envHasRightPath(path, i.first);
|
envHasRightPath(path, i.first);
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFloating _) {
|
[&](DerivationOutputCAFloating _) {
|
||||||
throw UnimplementedError("Floating CA output derivations are not yet implemented");
|
throw UnimplementedError("Floating CA output derivations are not yet implemented");
|
||||||
},
|
},
|
||||||
}, i.second.output);
|
}, i.second.output);
|
||||||
|
|
|
@ -74,11 +74,11 @@ struct CmdShowDerivation : InstallablesCommand
|
||||||
std::visit(overloaded {
|
std::visit(overloaded {
|
||||||
[&](DerivationOutputInputAddressed doi) {
|
[&](DerivationOutputInputAddressed doi) {
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFixed dof) {
|
[&](DerivationOutputCAFixed dof) {
|
||||||
outputObj.attr("hashAlgo", dof.hash.printMethodAlgo());
|
outputObj.attr("hashAlgo", dof.hash.printMethodAlgo());
|
||||||
outputObj.attr("hash", dof.hash.hash.to_string(Base16, false));
|
outputObj.attr("hash", dof.hash.hash.to_string(Base16, false));
|
||||||
},
|
},
|
||||||
[&](DerivationOutputFloating dof) {
|
[&](DerivationOutputCAFloating dof) {
|
||||||
outputObj.attr("hashAlgo", makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType));
|
outputObj.attr("hashAlgo", makeFileIngestionPrefix(dof.method) + printHashType(dof.hashType));
|
||||||
},
|
},
|
||||||
}, output.second.output);
|
}, output.second.output);
|
||||||
|
|
Loading…
Reference in a new issue