Use Deferred when building an input-addressed drv

Easier than using dummy path with input addressed.
This commit is contained in:
John Ericson 2022-03-18 02:07:31 +00:00
parent e433e42c5a
commit 8496be7def
2 changed files with 9 additions and 17 deletions

View file

@ -1194,9 +1194,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
for (auto & i : outputs) { for (auto & i : outputs) {
drv.env[i] = ""; drv.env[i] = "";
drv.outputs.insert_or_assign(i, drv.outputs.insert_or_assign(i,
DerivationOutput::InputAddressed { DerivationOutput::Deferred { });
.path = StorePath::dummy,
});
} }
// Regular, non-CA derivation should always return a single hash and not // Regular, non-CA derivation should always return a single hash and not
@ -1207,19 +1205,15 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * *
auto & h = drvHash.hash; auto & h = drvHash.hash;
switch (drvHash.kind) { switch (drvHash.kind) {
case DrvHash::Kind::Deferred: case DrvHash::Kind::Deferred:
for (auto & i : outputs) { /* Outputs already deferred, nothing to do */
drv.outputs.insert_or_assign(i,
DerivationOutput::Deferred { });
}
break; break;
case DrvHash::Kind::Regular: case DrvHash::Kind::Regular:
for (auto & i : outputs) { for (auto & [outputName, output] : drv.outputs) {
auto outPath = state.store->makeOutputPath(i, h, drvName); auto outPath = state.store->makeOutputPath(outputName, h, drvName);
drv.env[i] = state.store->printStorePath(outPath); drv.env[outputName] = state.store->printStorePath(outPath);
drv.outputs.insert_or_assign(i, output = DerivationOutput::InputAddressed {
DerivationOutput::InputAddressed {
.path = std::move(outPath), .path = std::move(outPath),
}); };
} }
break; break;
} }

View file

@ -201,9 +201,7 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
} }
} else { } else {
for (auto & output : drv.outputs) { for (auto & output : drv.outputs) {
output.second = DerivationOutput::InputAddressed { output.second = DerivationOutput::Deferred { };
.path = StorePath::dummy,
};
drv.env[output.first] = ""; drv.env[output.first] = "";
} }
auto h0 = hashDerivationModulo(*evalStore, drv, true); auto h0 = hashDerivationModulo(*evalStore, drv, true);