1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

Fix derivation computation with __structuredAttrs and multiple outputs

Fixes

  error: derivation '/nix/store/klivma7r7h5lndb99f7xxmlh5whyayvg-zlib-1.2.11.drv' has incorrect output '/nix/store/fv98nnx5ykgbq8sqabilkgkbc4169q05-zlib-1.2.11-dev', should be '/nix/store/adm7pilzlj3z5k249s8b4wv3scprhzi1-zlib-1.2.11-dev'
This commit is contained in:
Eelco Dolstra 2020-01-21 21:14:13 +01:00
parent 8b09105db3
commit aef635da78
7 changed files with 27 additions and 27 deletions

View file

@ -246,30 +246,18 @@ string Derivation::unparse(const Store & store, bool maskOutputs,
s.reserve(65536);
s += "Derive([";
StringSet maskedOutputs;
if (maskOutputs) {
bool first = true;
maskedOutputs = tokenizeString<StringSet>(get(env, "outputs").value_or("out"), " ");
for (auto & i : maskedOutputs) {
if (first) first = false; else s += ',';
s += '('; printString(s, i);
s += ",\"\",\"\",\"\")";
}
} else {
bool first = true;
for (auto & i : outputs) {
if (first) first = false; else s += ',';
s += '('; printString(s, i.first);
s += ','; printString(s, store.printStorePath(i.second.path));
s += ','; printString(s, i.second.hashAlgo);
s += ','; printString(s, i.second.hash);
s += ')';
}
bool first = true;
for (auto & i : outputs) {
if (first) first = false; else s += ',';
s += '('; printString(s, i.first);
s += ','; printString(s, maskOutputs ? "" : store.printStorePath(i.second.path));
s += ','; printString(s, i.second.hashAlgo);
s += ','; printString(s, i.second.hash);
s += ')';
}
s += "],[";
bool first = true;
first = true;
if (actualInputs) {
for (auto & i : *actualInputs) {
if (first) first = false; else s += ',';
@ -299,7 +287,7 @@ string Derivation::unparse(const Store & store, bool maskOutputs,
for (auto & i : env) {
if (first) first = false; else s += ',';
s += '('; printString(s, i.first);
s += ','; printString(s, maskOutputs && maskedOutputs.count(i.first) ? "" : i.second);
s += ','; printString(s, maskOutputs && outputs.count(i.first) ? "" : i.second);
s += ')';
}