about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-03T16·17+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-03T16·17+0000
commit7e85a2af5f2cf6c19fc582c6cec77c0eefef2c31 (patch)
tree808ac16a2a864baaf2ac8037dd3edd6336eb2f36
parentb3f916995af379ac1964e0459fb805803794ba39 (diff)
* Fix importing of derivation outputs.
-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 0f62653b0e9c..7776a38d6528 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -43,8 +43,15 @@ static Expr primImport(EvalState & state, const ATermVector & args)
 {
     PathSet context;
     Path path = coerceToPath(state, args[0], context);
-    
-    /* !!! build the derivations in context */
+
+    for (PathSet::iterator i = context.begin(); i != context.end(); ++i) {
+        assert(isStorePath(*i));
+        if (!isValidPath(*i))
+            throw EvalError(format("cannot import `%1%', since path `%2%' is not valid")
+                % path % *i);
+        if (isDerivation(*i))
+            buildDerivations(singleton<PathSet>(*i));
+    }
 
     return evalFile(state, path);
 }