mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
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.
This commit is contained in:
parent
e892c52737
commit
62fc8859c1
@ -398,7 +398,7 @@ substitute() {
|
|||||||
content="${content%X}"
|
content="${content%X}"
|
||||||
|
|
||||||
for ((n = 2; n < ${#params[*]}; n += 1)); do
|
for ((n = 2; n < ${#params[*]}; n += 1)); do
|
||||||
p=${params[$n]}
|
p="${params[$n]}"
|
||||||
|
|
||||||
if [ "$p" = --replace ]; then
|
if [ "$p" = --replace ]; then
|
||||||
pattern="${params[$((n + 1))]}"
|
pattern="${params[$((n + 1))]}"
|
||||||
@ -448,13 +448,18 @@ substituteAll() {
|
|||||||
local -a args=()
|
local -a args=()
|
||||||
|
|
||||||
# We need to be careful due to vars with multi-line contents or weird names.
|
# 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
|
if [ "$NIX_DEBUG" = "1" ]; then
|
||||||
echo "@varName@ -> '${varName}'"
|
echo "@${varName}@ -> '${!varName}'"
|
||||||
fi
|
fi
|
||||||
args+=("--subst-var" "$varName")
|
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[@]}"
|
substitute "$input" "$output" "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user