mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 09:36:47 +02:00
Slight cleanup of builtins.derivation
outputHashAlgo
logic (#10417)
This was part of approved PR #10021. Unfortunately that one is stalled on a peculiar Linux test timeout, so trying to get bits of it merged first to bisect failure.
This commit is contained in:
parent
74130fd1f1
commit
a3d5a71c5f
1 changed files with 5 additions and 5 deletions
|
@ -1127,7 +1127,7 @@ drvName, Bindings * attrs, Value & v)
|
|||
bool contentAddressed = false;
|
||||
bool isImpure = false;
|
||||
std::optional<std::string> outputHash;
|
||||
std::string outputHashAlgo;
|
||||
std::optional<HashAlgorithm> outputHashAlgo;
|
||||
std::optional<ContentAddressMethod> ingestionMethod;
|
||||
|
||||
StringSet outputs;
|
||||
|
@ -1226,7 +1226,7 @@ drvName, Bindings * attrs, Value & v)
|
|||
else if (i->name == state.sOutputHash)
|
||||
outputHash = state.forceStringNoCtx(*i->value, pos, context_below);
|
||||
else if (i->name == state.sOutputHashAlgo)
|
||||
outputHashAlgo = state.forceStringNoCtx(*i->value, pos, context_below);
|
||||
outputHashAlgo = parseHashAlgoOpt(state.forceStringNoCtx(*i->value, pos, context_below));
|
||||
else if (i->name == state.sOutputHashMode)
|
||||
handleHashMode(state.forceStringNoCtx(*i->value, pos, context_below));
|
||||
else if (i->name == state.sOutputs) {
|
||||
|
@ -1244,7 +1244,7 @@ drvName, Bindings * attrs, Value & v)
|
|||
if (i->name == state.sBuilder) drv.builder = std::move(s);
|
||||
else if (i->name == state.sSystem) drv.platform = std::move(s);
|
||||
else if (i->name == state.sOutputHash) outputHash = std::move(s);
|
||||
else if (i->name == state.sOutputHashAlgo) outputHashAlgo = std::move(s);
|
||||
else if (i->name == state.sOutputHashAlgo) outputHashAlgo = parseHashAlgoOpt(s);
|
||||
else if (i->name == state.sOutputHashMode) handleHashMode(s);
|
||||
else if (i->name == state.sOutputs)
|
||||
handleOutputs(tokenizeString<Strings>(s));
|
||||
|
@ -1327,7 +1327,7 @@ drvName, Bindings * attrs, Value & v)
|
|||
"multiple outputs are not supported in fixed-output derivations"
|
||||
).atPos(v).debugThrow();
|
||||
|
||||
auto h = newHashAllowEmpty(*outputHash, parseHashAlgoOpt(outputHashAlgo));
|
||||
auto h = newHashAllowEmpty(*outputHash, outputHashAlgo);
|
||||
|
||||
auto method = ingestionMethod.value_or(FileIngestionMethod::Flat);
|
||||
|
||||
|
@ -1347,7 +1347,7 @@ drvName, Bindings * attrs, Value & v)
|
|||
state.error<EvalError>("derivation cannot be both content-addressed and impure")
|
||||
.atPos(v).debugThrow();
|
||||
|
||||
auto ha = parseHashAlgoOpt(outputHashAlgo).value_or(HashAlgorithm::SHA256);
|
||||
auto ha = outputHashAlgo.value_or(HashAlgorithm::SHA256);
|
||||
auto method = ingestionMethod.value_or(FileIngestionMethod::Recursive);
|
||||
|
||||
for (auto & i : outputs) {
|
||||
|
|
Loading…
Reference in a new issue