From b458af7384642dc241456a823a7895f83d576e83 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 30 Aug 2004 14:06:14 +0000 Subject: [PATCH] * The generic builder now dumps all environment variables to the file `$NIX_BUILD_TOP/env-vars' at the beginning of each build phase. In conjunction with the `-K' Nix flag, this is useful for debugging: to reproduce the build environment, go to the saved build directory and source in `env-vars' (e.g., `. env-vars'). svn path=/nixpkgs/trunk/; revision=1367 --- pkgs/stdenv/generic-branch/setup.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/stdenv/generic-branch/setup.sh b/pkgs/stdenv/generic-branch/setup.sh index 8aa065d5943..0fcbb5ee1ea 100644 --- a/pkgs/stdenv/generic-branch/setup.sh +++ b/pkgs/stdenv/generic-branch/setup.sh @@ -196,6 +196,18 @@ closeNest() { trap "closeNest" EXIT +# This function is useful for debugging broken Nix builds. It dumps +# all environment variables to a file `env-vars' in the build +# directory. If the build fails and the `-K' option is used, you can +# then go to the build directory and source in `env-vars' to reproduce +# the environment used for building. +dumpVars() { + if test "$noDumpEnvVars" != "1"; then + export > $NIX_BUILD_TOP/env-vars + fi +} + + # Ensure that the given directory exists. ensureDir() { local dir=$1 @@ -619,8 +631,12 @@ genericBuild() { fi for i in $phases; do + dumpVars $i done stopNest } + + +dumpVars