diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-02-26 16:20:28 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-02-26 16:20:28 +0100 |
commit | 647438344bfc1f77791391e2b4f98eef865c63dc (patch) | |
tree | ef580867fc6cc413940e4330d939cf1afda082cb /nixpkgs/pkgs/stdenv/generic/setup.sh | |
parent | b084c6a0fab7f32c904c5c8e8db8dddcefbe507f (diff) | |
parent | e3474e1d1e53b70e2b2af73ea26d6340e82f6b8b (diff) | |
download | nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.gz nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.bz2 nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.lz nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.xz nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.zst nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.zip |
Merge commit 'e3474e1d1e53'
Diffstat (limited to 'nixpkgs/pkgs/stdenv/generic/setup.sh')
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/setup.sh | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/nixpkgs/pkgs/stdenv/generic/setup.sh b/nixpkgs/pkgs/stdenv/generic/setup.sh index efb233312b57..9c918b12f96e 100644 --- a/nixpkgs/pkgs/stdenv/generic/setup.sh +++ b/nixpkgs/pkgs/stdenv/generic/setup.sh @@ -816,7 +816,7 @@ fi # Textual substitution functions. # only log once, due to max logging limit on hydra -_substituteStream_has_warned_replace_deprecation="" +_substituteStream_has_warned_replace_deprecation=false substituteStream() { local var=$1 @@ -824,24 +824,18 @@ substituteStream() { shift 2 while (( "$#" )); do - local is_required=1 - local is_quiet="" + local replace_mode="$1" case "$1" in - --replace-quiet) - is_quiet=1 - ;& --replace) # deprecated 2023-11-22 # this will either get removed, or switch to the behaviour of --replace-fail in the future - if [ -z "$_substituteStream_has_warned_replace_deprecation" ]; then + if ! "$_substituteStream_has_warned_replace_deprecation"; then echo "substituteStream(): WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" >&2 - _substituteStream_has_warned_replace_deprecation=1 + _substituteStream_has_warned_replace_deprecation=true fi + replace_mode='--replace-warn' ;& - --replace-warn) - is_required="" - ;& - --replace-fail) + --replace-quiet|--replace-warn|--replace-fail) pattern="$2" replacement="$3" shift 3 @@ -850,11 +844,9 @@ substituteStream() { eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' if [ "$pattern" != "$replacement" ]; then if [ "${!var}" == "$savedvar" ]; then - if [ -z "$is_required" ]; then - if [ -z "$is_quiet" ]; then - printf "substituteStream(): WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" >&2 - fi - else + if [ "$replace_mode" == --replace-warn ]; then + printf "substituteStream(): WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" >&2 + elif [ "$replace_mode" == --replace-fail ]; then printf "substituteStream(): ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" >&2 return 1 fi @@ -1073,7 +1065,11 @@ _defaultUnpack() { # stages. The XZ_OPT env var is only used by the full "XZ utils" implementation, which supports # the --threads (-T) flag. This allows us to enable multithreaded decompression exclusively on # that implementation, without the use of complex bash conditionals and checks. - XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn" | tar xf - --warning=no-timestamp + # Since tar does not control the decompression, we need to + # disregard the error code from the xz invocation. Otherwise, + # it can happen that tar exits earlier, causing xz to fail + # from a SIGPIPE. + (XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; true) | tar xf - --warning=no-timestamp ;; *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) # GNU tar can automatically select the decompression method |