diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 47e330562708..fb79d8832886 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -72,6 +72,35 @@ _eval() { } +###################################################################### +# Logging. + +nestingLevel=0 + +startNest() { + nestingLevel=$(($nestingLevel + 1)) + echo -en "\033[$1p" +} + +stopNest() { + nestingLevel=$(($nestingLevel - 1)) + echo -en "\033[q" +} + +header() { + startNest "$2" + echo "$1" +} + +# Make sure that even when we exit abnormally, the original nesting +# level is properly restored. +closeNest() { + while [ $nestingLevel -gt 0 ]; do + stopNest + done +} + + ###################################################################### # Error handling. @@ -409,32 +438,6 @@ substituteAllInPlace() { # What follows is the generic builder. -nestingLevel=0 - -startNest() { - nestingLevel=$(($nestingLevel + 1)) - echo -en "\033[$1p" -} - -stopNest() { - nestingLevel=$(($nestingLevel - 1)) - echo -en "\033[q" -} - -header() { - startNest "$2" - echo "$1" -} - -# Make sure that even when we exit abnormally, the original nesting -# level is properly restored. -closeNest() { - while [ $nestingLevel -gt 0 ]; do - stopNest - done -} - - # 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