about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-21T14·23+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-21T14·23+0000
commit06208d1d8677eaea1fb56dd09832f43154bbab5d (patch)
treea7e8ba6cb611048b5e35e9ad53a49554ed22a611 /src/libexpr/primops.cc
parent2e9042bd1e7e3a322f072f0bf98510698afa626a (diff)
* Uninstallation.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 0979331153..481966af9e 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -93,10 +93,16 @@ static string processBinding(EvalState & state, Expr e, StoreExpr & ne)
         Expr a = queryAttr(e, "type");
         if (a && evalString(state, a) == "derivation") {
             a = queryAttr(e, "drvPath");
-            if (a) {
-                Path drvPath = evalPath(state, a);
-                return addInput(state, drvPath, ne);
-            }
+            if (!a) throw badTerm("derivation name missing", e);
+            Path drvPath = evalPath(state, a);
+
+            a = queryAttr(e, "drvHash");
+            if (!a) throw badTerm("derivation hash missing", e);
+            Hash drvHash = parseHash(evalString(state, a));
+
+            state.drvHashes[drvPath] = drvHash;
+            
+            return addInput(state, drvPath, ne);
         }
     }
 
@@ -199,13 +205,13 @@ Expr primDerivation(EvalState & state, Expr args)
         ? hashString((string) outHash + outPath)
         : hashDerivation(state, ne);
     Path drvPath = writeTerm(unparseStoreExpr(ne), "-d-" + drvName);
-    state.drvHashes[drvPath] = drvHash;
 
     printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'")
         % drvName % drvPath);
 
     attrs.set("outPath", ATmake("Path(<str>)", outPath.c_str()));
     attrs.set("drvPath", ATmake("Path(<str>)", drvPath.c_str()));
+    attrs.set("drvHash", ATmake("Str(<str>)", ((string) drvHash).c_str()));
     attrs.set("type", ATmake("Str(\"derivation\")"));
 
     return makeAttrs(attrs);