mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
* Keep attribute sets in sorted order to speed up attribute lookups.
* Simplify the representation of attributes in the AST. * Change the behaviour of listToAttrs() in case of duplicate names.
This commit is contained in:
parent
2dc6d50941
commit
e0b7fb8f27
12 changed files with 186 additions and 148 deletions
|
@ -69,13 +69,14 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
|||
mkString(*state.allocAttr(v, state.sOutPath), i->queryOutPath(state));
|
||||
if (drvPath != "")
|
||||
mkString(*state.allocAttr(v, state.sDrvPath), i->queryDrvPath(state));
|
||||
|
||||
state.mkAttrs(*state.allocAttr(v, state.sMeta));
|
||||
|
||||
|
||||
Value & vMeta = *state.allocAttr(v, state.sMeta);
|
||||
state.mkAttrs(vMeta);
|
||||
|
||||
MetaInfo meta = i->queryMetaInfo(state);
|
||||
|
||||
foreach (MetaInfo::const_iterator, j, meta) {
|
||||
Value & v2(*state.allocAttr(*(*v.attrs)[state.sMeta].value, state.symbols.create(j->first)));
|
||||
Value & v2(*state.allocAttr(vMeta, state.symbols.create(j->first)));
|
||||
switch (j->second.type) {
|
||||
case MetaValue::tpInt: mkInt(v2, j->second.intValue); break;
|
||||
case MetaValue::tpString: mkString(v2, j->second.stringValue); break;
|
||||
|
@ -92,6 +93,9 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
|||
}
|
||||
}
|
||||
|
||||
vMeta.attrs->sort();
|
||||
v.attrs->sort();
|
||||
|
||||
/* This is only necessary when installing store paths, e.g.,
|
||||
`nix-env -i /nix/store/abcd...-foo'. */
|
||||
store->addTempRoot(i->queryOutPath(state));
|
||||
|
@ -118,7 +122,8 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
|||
mkString(*state.allocAttr(args, state.sSystem), thisSystem);
|
||||
mkString(*state.allocAttr(args, state.symbols.create("manifest")),
|
||||
manifestFile, singleton<PathSet>(manifestFile));
|
||||
(*args.attrs)[state.symbols.create("derivations")].value = &manifest;
|
||||
args.attrs->push_back(Attr(state.symbols.create("derivations"), &manifest));
|
||||
args.attrs->sort();
|
||||
mkApp(topLevel, envBuilder, args);
|
||||
|
||||
/* Evaluate it. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue