* Minor simplification.

This commit is contained in:
Eelco Dolstra 2008-08-25 14:15:56 +00:00
parent 49829da8b4
commit c4f1c2114b
2 changed files with 7 additions and 10 deletions

View file

@ -173,24 +173,21 @@ static void getDerivations(EvalState & state, Expr e,
/* !!! undocumented hackery to support combining channels in /* !!! undocumented hackery to support combining channels in
nix-env.cc. */ nix-env.cc. */
Expr e2 = drvMap.get(toATerm("_combineChannels")); bool combineChannels = drvMap.get(toATerm("_combineChannels"));
bool combineChannels = e2 && evalBool(state, e2);
for (ATermMap::const_iterator i = drvMap.begin(); i != drvMap.end(); ++i) { for (ATermMap::const_iterator i = drvMap.begin(); i != drvMap.end(); ++i) {
startNest(nest, lvlDebug, startNest(nest, lvlDebug,
format("evaluating attribute `%1%'") % aterm2String(i->key)); format("evaluating attribute `%1%'") % aterm2String(i->key));
string pathPrefix2 = addToPath(pathPrefix, aterm2String(i->key)); string pathPrefix2 = addToPath(pathPrefix, aterm2String(i->key));
if (combineChannels) { if (combineChannels)
if (((string) aterm2String(i->key)) != "_combineChannels") getDerivations(state, i->value, pathPrefix2, autoArgs, drvs, doneExprs);
getDerivations(state, i->value, pathPrefix2, autoArgs, drvs, doneExprs);
}
else if (getDerivation(state, i->value, pathPrefix2, drvs, doneExprs)) { else if (getDerivation(state, i->value, pathPrefix2, drvs, doneExprs)) {
/* If the value of this attribute is itself an /* If the value of this attribute is itself an
attribute set, should we recurse into it? => Only attribute set, should we recurse into it? => Only
if it has a `recurseForDerivations = true' if it has a `recurseForDerivations = true'
attribute. */ attribute. */
ATermList es; ATermList es;
Expr e = evalExpr(state, i->value); Expr e = evalExpr(state, i->value), e2;
if (matchAttrs(e, es)) { if (matchAttrs(e, es)) {
ATermMap attrs(ATgetLength(es)); ATermMap attrs(ATgetLength(es));
queryAllAttrs(e, attrs, false); queryAllAttrs(e, attrs, false);

View file

@ -154,7 +154,7 @@ static Expr loadSourceExpr(EvalState & state, const Path & path)
for a user to have a ~/.nix-defexpr directory that includes for a user to have a ~/.nix-defexpr directory that includes
some system-wide directory). */ some system-wide directory). */
ATermMap attrs; ATermMap attrs;
attrs.set(toATerm("_combineChannels"), makeAttrRHS(eTrue, makeNoPos())); attrs.set(toATerm("_combineChannels"), makeAttrRHS(makeList(ATempty), makeNoPos()));
getAllExprs(state, path, attrs); getAllExprs(state, path, attrs);
return makeAttrs(attrs); return makeAttrs(attrs);
} }