diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-05-08 19:37:37 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-05-08 19:41:50 +0200 |
commit | 62fc8859c10dd18b005b9bcaa0b429103d7661d9 (patch) | |
tree | d445ead0c85af51894d9ff51257484661b6b13cd /pkgs/stdenv/generic | |
parent | e892c52737bc6de4741f22a198013e34490b0d21 (diff) |
stdenv substituteAll: use yet another implementation
It turned out that process substitution fed into a while-cycle isn't recognized during darwin bootstrap: http://hydra.nixos.org/build/35382446/nixlog/1/raw Also fix broken NIX_DEBUG output, noticed by abbradar.
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 3e156b579bc43..10fc4873afa3e 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -398,7 +398,7 @@ substitute() { content="${content%X}" for ((n = 2; n < ${#params[*]}; n += 1)); do - p=${params[$n]} + p="${params[$n]}" if [ "$p" = --replace ]; then pattern="${params[$((n + 1))]}" @@ -448,13 +448,18 @@ substituteAll() { local -a args=() # We need to be careful due to vars with multi-line contents or weird names. - while IFS= read -r -d '' varName; do + local IFS== + local varNames="$(env -0 | cut -z -d= -f1 | grep -z -v '^[_A-Z]' | tr '\000' '=')" + local varName + for varName in $varNames; do if [ "$NIX_DEBUG" = "1" ]; then - echo "@varName@ -> '${varName}'" + echo "@${varName}@ -> '${!varName}'" fi args+=("--subst-var" "$varName") - done < <(env -0 | cut -z -d= -f1 | grep -z -v '^[_A-Z]') + done + # restore default $IFS for the child + IFS=$' \t\n' substitute "$input" "$output" "${args[@]}" } |