about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2011-11-06T06·28+0000
committerShea Levy <shea@shealevy.com>2011-11-06T06·28+0000
commit3522730316dbb3a9ee5a690188f02435e7260406 (patch)
tree0e6b3d0056b6d8f128e1c2925228e6427bcfcc44 /src/libexpr/primops.cc
parent46876ff2037541613dc17c986f9b68b8f257cb3b (diff)
Embed output name into the context of the *OutPath attributes and extract it for input derivations
Multiple outputs test passes!
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index ce0b9e8b0b..9c217b373f 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -348,6 +348,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
     foreach (PathSet::iterator, i, context) {
         Path path = *i;
         bool explicitlyPassed = false;
+        string output = "out";
         
         /* Paths marked with `=' denote that the path of a derivation
            is explicitly passed to the builder.  Since that allows the
@@ -366,6 +367,12 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
             }
 
             explicitlyPassed = true;
+        } else if (path.at(0) == '!') {
+            size_t index;
+            path = string(path, 1);
+            index = path.find("!");
+            output = path.substr(0, index);
+            path = string(path, index + 1);
         }
 
         /* See prim_unsafeDiscardOutputDependency. */
@@ -382,7 +389,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
             if (explicitlyPassed)
                 drv.inputDrvs[path] = store -> queryDerivationOutputNames(path);
             else
-                drv.inputDrvs[path] = singleton<StringSet>("out");
+                drv.inputDrvs[path] = singleton<StringSet>(output);
         else
             drv.inputSrcs.insert(path);
     }
@@ -466,7 +473,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
         /* The output path of an output X is ‘<X>Path’,
            e.g. ‘outPath’. */
         mkString(*state.allocAttr(v, state.symbols.create(i->first + "Path")),
-            i->second.path, singleton<PathSet>(drvPath));
+            i->second.path, singleton<PathSet>("!" + i->first + "!" + drvPath));
     }
     v.attrs->sort();
 }