From 06208d1d8677eaea1fb56dd09832f43154bbab5d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 21 Nov 2003 14:23:18 +0000 Subject: * Uninstallation. --- src/libexpr/primops.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/libexpr/primops.cc') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 097933115342..481966af9e3e 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()", outPath.c_str())); attrs.set("drvPath", ATmake("Path()", drvPath.c_str())); + attrs.set("drvHash", ATmake("Str()", ((string) drvHash).c_str())); attrs.set("type", ATmake("Str(\"derivation\")")); return makeAttrs(attrs); -- cgit 1.4.1