From 93aefd9fc0250eda2c47d22a88922d319cde34b8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 May 2007 23:16:38 +0000 Subject: * Give unpacked channels more sensible names than 0, 1, ... They now get the basename of the channel URL (e.g., nixpkgs-unstable). The top-level Nix expression of the channel is now an attribute set, the attributes of which are the individual channels (e.g., {nixpkgs_unstable = ...; strategoxt_unstable = ...}). This makes attribute paths ("nix-env -qaA" and "nix-env -iA") more sensible, e.g., "nix-env -iA nixpkgs_unstable.subversion". --- src/libexpr/get-drvs.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index daa987fe713b..d2d01072f61d 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -170,12 +170,21 @@ static void getDerivations(EvalState & state, Expr e, if (matchAttrs(e, es)) { ATermMap drvMap(ATgetLength(es)); queryAllAttrs(e, drvMap); + + /* !!! undocumented hackery to support + corepkgs/channels/unpack.sh. */ + Expr e2 = drvMap.get(toATerm("_combineChannels")); + bool combineChannels = e2 && evalBool(state, e2); 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 (getDerivation(state, i->value, pathPrefix2, drvs, doneExprs)) { + if (combineChannels) { + if (((string) aterm2String(i->key)) != "_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' @@ -185,8 +194,8 @@ static void getDerivations(EvalState & state, Expr e, if (matchAttrs(e, es)) { ATermMap attrs(ATgetLength(es)); queryAllAttrs(e, attrs, false); - Expr e2 = attrs.get(toATerm("recurseForDerivations")); - if (e2 && evalBool(state, e2)) + if (((e2 = attrs.get(toATerm("recurseForDerivations"))) + && evalBool(state, e2))) getDerivations(state, e, pathPrefix2, autoArgs, drvs, doneExprs); } } -- cgit 1.4.1