diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-08-25T14·15+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-08-25T14·15+0000 |
commit | c4f1c2114b520f5c9d589780dd7662efbfd9cf63 (patch) | |
tree | 42f3a8579d95ec909698987da353f7efbf725b3d /src | |
parent | 49829da8b450a1e869168428171334e6d9d0eb45 (diff) |
* Minor simplification.
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/get-drvs.cc | 15 | ||||
-rw-r--r-- | src/nix-env/nix-env.cc | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index 6fa9b3f21de7..55092ea9bb83 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -102,7 +102,7 @@ static bool getDerivation(EvalState & state, Expr e, boost::shared_ptr<ATermMap> attrs(new ATermMap()); queryAllAttrs(e, *attrs, false); - + Expr a = attrs->get(toATerm("type")); if (!a || evalStringNoCtx(state, a) != "derivation") return true; @@ -173,24 +173,21 @@ static void getDerivations(EvalState & state, Expr e, /* !!! undocumented hackery to support combining channels in nix-env.cc. */ - Expr e2 = drvMap.get(toATerm("_combineChannels")); - bool combineChannels = e2 && evalBool(state, e2); - + bool combineChannels = drvMap.get(toATerm("_combineChannels")); + for (ATermMap::const_iterator i = drvMap.begin(); i != drvMap.end(); ++i) { startNest(nest, lvlDebug, format("evaluating attribute `%1%'") % aterm2String(i->key)); string pathPrefix2 = addToPath(pathPrefix, aterm2String(i->key)); - if (combineChannels) { - if (((string) aterm2String(i->key)) != "_combineChannels") - getDerivations(state, i->value, pathPrefix2, autoArgs, drvs, doneExprs); - } + if (combineChannels) + getDerivations(state, i->value, pathPrefix2, autoArgs, drvs, doneExprs); else if (getDerivation(state, i->value, pathPrefix2, drvs, doneExprs)) { /* If the value of this attribute is itself an attribute set, should we recurse into it? => Only if it has a `recurseForDerivations = true' attribute. */ ATermList es; - Expr e = evalExpr(state, i->value); + Expr e = evalExpr(state, i->value), e2; if (matchAttrs(e, es)) { ATermMap attrs(ATgetLength(es)); queryAllAttrs(e, attrs, false); diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 4cc5484cc452..c67c940d5cd5 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -154,7 +154,7 @@ static Expr loadSourceExpr(EvalState & state, const Path & path) for a user to have a ~/.nix-defexpr directory that includes some system-wide directory). */ ATermMap attrs; - attrs.set(toATerm("_combineChannels"), makeAttrRHS(eTrue, makeNoPos())); + attrs.set(toATerm("_combineChannels"), makeAttrRHS(makeList(ATempty), makeNoPos())); getAllExprs(state, path, attrs); return makeAttrs(attrs); } |