Author: eelco
Date: Mon Mar 19 03:45:36 2012
New Revision: 33249
URL: https://nixos.org/websvn/nix/?rev=33249&sc=1

Log:
* For "nix-build --run-env" it's desirable that $stdenv/setup (and by
  extension postHook) does nothing else than set up the environment.
  It shouldn't touch $out because there may not be a $out.  So move
  the "imperative" bits of postHook into a separate phase.

Modified:
   nixpkgs/trunk/pkgs/build-support/release/nix-build.nix

Modified: nixpkgs/trunk/pkgs/build-support/release/nix-build.nix
==============================================================================
--- nixpkgs/trunk/pkgs/build-support/release/nix-build.nix      Mon Mar 19 
02:53:58 2012        (r33248)
+++ nixpkgs/trunk/pkgs/build-support/release/nix-build.nix      Mon Mar 19 
03:45:36 2012        (r33249)
@@ -13,6 +13,7 @@
 , src, stdenv
 , name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
 , failureHook ? null
+, prePhases ? []
 , postPhases ? []
 , ... } @ args:
 
@@ -56,13 +57,6 @@
     name = name + (if src ? version then "-" + src.version else "");
   
     postHook = ''
-      mkdir -p $out/nix-support
-      echo "$system" > $out/nix-support/system
-
-      if test -z "${toString doCoverageAnalysis}"; then
-          echo "nix-build none $out" >> $out/nix-support/hydra-build-products
-      fi
-
       # If `src' is the result of a call to `makeSourceTarball', then it
       # has a subdirectory containing the actual tarball(s).  If there are
       # multiple tarballs, just pick the first one.
@@ -77,9 +71,18 @@
           export CFLAGS="-O0"
           export CXXFLAGS="-O0"
       fi
-
     ''; # */
 
+    initPhase = ''
+      mkdir -p $out/nix-support
+      echo "$system" > $out/nix-support/system
+
+      if test -z "${toString doCoverageAnalysis}"; then
+          echo "nix-build none $out" >> $out/nix-support/hydra-build-products
+      fi
+    '';
+
+    prePhases = ["initPhase"] ++ prePhases;
 
     # In the report phase, create a coverage analysis report.
     coverageReportPhase = if doCoverageAnalysis then ''
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to