summary refs log tree commit diff
path: root/src/libexpr/get-drvs.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-05-01 23:16:38 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-05-01 23:16:38 +0000
commit93aefd9fc0250eda2c47d22a88922d319cde34b8 (patch)
tree76ed8bbf3758f48a7b8d594552b80dfbf23540ec /src/libexpr/get-drvs.cc
parenta9d15d4f434fece269852a65be836d1338ed787d (diff)
downloadguix-93aefd9fc0250eda2c47d22a88922d319cde34b8.tar.gz
* 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".

Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r--src/libexpr/get-drvs.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index daa987fe71..d2d01072f6 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);
                 }
             }