summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-25 11:55:43 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-25 11:55:43 +0000
commit581fc477838e9cf9e5d9657920ef63ea836050ee (patch)
treebac33c0720129205ed6baf25b12bbd9734946a90
parent52bf9b86bb79369b7f7b5b8a5726b83ee154da6a (diff)
downloadguix-581fc477838e9cf9e5d9657920ef63ea836050ee.tar.gz
* Fix the build hook mechanism; pass the pointer graph to the hook.
-rw-r--r--src/libstore/build.cc26
-rwxr-xr-xtests/build-hook.hook.sh4
-rw-r--r--tests/build-hook.sh2
3 files changed, 27 insertions, 5 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 8d9946add4..1de50a1404 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -769,15 +769,20 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
         
         /* Write the information that the hook needs to perform the
            build, i.e., the set of input paths, the set of output
-           paths, and [!!!]. */
+           paths, and the references (pointer graph) in the input
+           paths. */
         
         Path inputListFN = tmpDir + "/inputs";
         Path outputListFN = tmpDir + "/outputs";
+        Path referencesFN = tmpDir + "/references";
 
         string s;
         for (PathSet::iterator i = inputPaths.begin();
              i != inputPaths.end(); ++i)
             s += *i + "\n";
+        for (DerivationInputs::iterator i = drv.inputDrvs.begin();
+             i != drv.inputDrvs.end(); ++i)
+            s += i->first + "\n";
         writeStringToFile(inputListFN, s);
         
         s = "";
@@ -785,7 +790,24 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
              i != drv.outputs.end(); ++i)
             s += i->second.path + "\n";
         writeStringToFile(outputListFN, s);
-        
+
+        s = "";
+        for (PathSet::iterator i = inputPaths.begin();
+             i != inputPaths.end(); ++i)
+        {
+            s += *i;
+            PathSet references;
+            queryReferences(*i, references);
+            for (PathSet::iterator j = references.begin();
+                 j != references.end(); ++j)
+            {
+                s += " ";
+                s += *j;
+            }
+            s += "\n";
+        }
+        writeStringToFile(referencesFN, s);
+
         /* Tell the hook to proceed. */ 
         writeLine(toHook.writeSide, "okay");
 
diff --git a/tests/build-hook.hook.sh b/tests/build-hook.hook.sh
index bbf423017f..45536f8de3 100755
--- a/tests/build-hook.hook.sh
+++ b/tests/build-hook.hook.sh
@@ -1,12 +1,12 @@
 #! /bin/sh
 
-set -x
+#set -x
 
 drv=$4
 
 echo "HOOK for $drv" >&2
 
-outPath=$(sed 's/Derive(\[\"\([^\"]*\)\".*/\1/' $drv)
+outPath=$(sed 's/Derive(\[("out",\"\([^\"]*\)\".*/\1/' $drv)
 
 echo "output path is $outPath" >&2
 
diff --git a/tests/build-hook.sh b/tests/build-hook.sh
index 417f8c6d03..402ed83c96 100644
--- a/tests/build-hook.sh
+++ b/tests/build-hook.sh
@@ -4,7 +4,7 @@ storeExpr=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)
 
 echo "store expr is $storeExpr"
 
-outPath=$($TOP/src/nix-store/nix-store -qnfvvvvv "$storeExpr")
+outPath=$($TOP/src/nix-store/nix-store -quf "$storeExpr")
 
 echo "output path is $outPath"