mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
import derivation: cleanup
Before this there was a bug where a `find` was being called on a not-yet-sorted set. The code was just a mess before anyway, so I cleaned it up while fixing it.
This commit is contained in:
parent
fe37ed1219
commit
b0c5c2ac34
1 changed files with 11 additions and 8 deletions
|
@ -84,16 +84,19 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args
|
||||||
Derivation drv = readDerivation(path);
|
Derivation drv = readDerivation(path);
|
||||||
Value & w = *state.allocValue();
|
Value & w = *state.allocValue();
|
||||||
state.mkAttrs(w, 2 + drv.outputs.size());
|
state.mkAttrs(w, 2 + drv.outputs.size());
|
||||||
mkString(*state.allocAttr(w, state.sDrvPath), path, singleton<PathSet>("=" + path));
|
Value * v2 = state.allocAttr(w, state.sDrvPath);
|
||||||
state.mkList(*state.allocAttr(w, state.symbols.create("outputs")), drv.outputs.size());
|
mkString(*v2, path, singleton<PathSet>("=" + path));
|
||||||
|
Value * outputsVal =
|
||||||
|
state.allocAttr(w, state.symbols.create("outputs"));
|
||||||
|
state.mkList(*outputsVal, drv.outputs.size());
|
||||||
unsigned int outputs_index = 0;
|
unsigned int outputs_index = 0;
|
||||||
|
|
||||||
Value * outputsVal = w.attrs->find(state.symbols.create("outputs"))->value;
|
for (const auto & o : drv.outputs) {
|
||||||
foreach (DerivationOutputs::iterator, i, drv.outputs) {
|
v2 = state.allocAttr(w, state.symbols.create(o.first));
|
||||||
mkString(*state.allocAttr(w, state.symbols.create(i->first)),
|
mkString(*v2, o.second.path,
|
||||||
i->second.path, singleton<PathSet>("!" + i->first + "!" + path));
|
singleton<PathSet>("!" + o.first + "!" + path));
|
||||||
mkString(*(outputsVal->list.elems[outputs_index++] = state.allocValue()),
|
outputsVal->list.elems[outputs_index] = state.allocValue();
|
||||||
i->first);
|
mkString(*(outputsVal->list.elems[outputs_index++]), o.first);
|
||||||
}
|
}
|
||||||
w.attrs->sort();
|
w.attrs->sort();
|
||||||
Value fun;
|
Value fun;
|
||||||
|
|
Loading…
Reference in a new issue