From 4bd38c330fc6dace1f45a29bbc7f5c64b22fffdb Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Sat, 17 Jul 2021 20:27:52 +0200 Subject: Revert #127736: stdenv changes towards an alternative shell At least for now. Such changes are risky (we have very many packages), and apparently it needs more testing/review without blocking other changes. This reverts the whole range 4d0e3984918^..8752c327377, except for one commit that got reverted in 6f239d73096 already. (that MR didn't even get its merge commit) --- pkgs/build-support/bintools-wrapper/setup-hook.sh | 9 ++------- pkgs/build-support/setup-hooks/auto-patchelf.sh | 1 - pkgs/build-support/setup-hooks/autoreconf.sh | 3 +-- pkgs/build-support/setup-hooks/make-symlinks-relative.sh | 1 - pkgs/build-support/setup-hooks/move-docs.sh | 7 ++++--- pkgs/build-support/setup-hooks/multiple-outputs.sh | 16 ++++++---------- pkgs/build-support/setup-hooks/reproducible-builds.sh | 8 ++------ 7 files changed, 15 insertions(+), 30 deletions(-) (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/bintools-wrapper/setup-hook.sh b/pkgs/build-support/bintools-wrapper/setup-hook.sh index ba09d19b1f2..7e9547b96c2 100644 --- a/pkgs/build-support/bintools-wrapper/setup-hook.sh +++ b/pkgs/build-support/bintools-wrapper/setup-hook.sh @@ -1,4 +1,3 @@ -# shellcheck shell=bash # Binutils Wrapper hygiene # # See comments in cc-wrapper's setup hook. This works exactly the same way. @@ -15,9 +14,7 @@ bintoolsWrapper_addLDVars () { getHostRoleEnvHook if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then - varName=NIX_LDFLAGS${role_post} - eval "$varName=\"${!varName:-} -L$1/lib64\"" - export "${varName?}" + export NIX_LDFLAGS${role_post}+=" -L$1/lib64" fi if [[ -d "$1/lib" ]]; then @@ -27,9 +24,7 @@ bintoolsWrapper_addLDVars () { # directories and bloats the size of the environment variable space. local -a glob=( $1/lib/lib* ) if [ "${#glob[*]}" -gt 0 ]; then - varName=NIX_LDFLAGS${role_post} - eval "$varName=\"${!varName:-} -L$1/lib\"" - export "${varName?}" + export NIX_LDFLAGS${role_post}+=" -L$1/lib" fi fi } diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh index 70b1fc802b5..511371931de 100644 --- a/pkgs/build-support/setup-hooks/auto-patchelf.sh +++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh @@ -29,7 +29,6 @@ isExecutable() { isExeResult="$(LANG=C $READELF -h -l "$1" 2> /dev/null \ | grep '^ *Type: *EXEC\>\|^ *INTERP\>')" # not using grep -q, because it can cause Broken pipe - # https://unix.stackexchange.com/questions/305547/broken-pipe-when-grepping-output-but-only-with-i-flag [ -n "$isExeResult" ] } diff --git a/pkgs/build-support/setup-hooks/autoreconf.sh b/pkgs/build-support/setup-hooks/autoreconf.sh index 4ba4025a02e..c08cab15868 100644 --- a/pkgs/build-support/setup-hooks/autoreconf.sh +++ b/pkgs/build-support/setup-hooks/autoreconf.sh @@ -1,5 +1,4 @@ -# shellcheck shell=bash -preConfigurePhases="${preConfigurePhases:-} autoreconfPhase" +preConfigurePhases+=" autoreconfPhase" autoreconfPhase() { runHook preAutoreconf diff --git a/pkgs/build-support/setup-hooks/make-symlinks-relative.sh b/pkgs/build-support/setup-hooks/make-symlinks-relative.sh index fd65f2e8e13..0608d3ca81c 100644 --- a/pkgs/build-support/setup-hooks/make-symlinks-relative.sh +++ b/pkgs/build-support/setup-hooks/make-symlinks-relative.sh @@ -1,4 +1,3 @@ -# shellcheck shell=bash fixupOutputHooks+=(_makeSymlinksRelative) # For every symlink in $output that refers to another file in $output diff --git a/pkgs/build-support/setup-hooks/move-docs.sh b/pkgs/build-support/setup-hooks/move-docs.sh index 965c16be2f6..ef31dcdce27 100644 --- a/pkgs/build-support/setup-hooks/move-docs.sh +++ b/pkgs/build-support/setup-hooks/move-docs.sh @@ -6,7 +6,7 @@ preFixupHooks+=(_moveToShare) _moveToShare() { forceShare=${forceShare:=man doc info} - if [[ -z $forceShare || -z $out ]]; then return; fi + if [ -z "$forceShare" -o -z "$out" ]; then return; fi for d in $forceShare; do if [ -d "$out/$d" ]; then @@ -14,9 +14,10 @@ _moveToShare() { echo "both $d/ and share/$d/ exist!" else echo "moving $out/$d to $out/share/$d" - mkdir -p "$out/share" - mv "$out/$d" "$out/share/" + mkdir -p $out/share + mv $out/$d $out/share/ fi fi done } + diff --git a/pkgs/build-support/setup-hooks/multiple-outputs.sh b/pkgs/build-support/setup-hooks/multiple-outputs.sh index 91f056cc89b..bfa47e3b20e 100644 --- a/pkgs/build-support/setup-hooks/multiple-outputs.sh +++ b/pkgs/build-support/setup-hooks/multiple-outputs.sh @@ -1,4 +1,3 @@ -# shellcheck shell=bash # The base package for automatic multiple-output splitting. Used in stdenv as well. preConfigureHooks+=(_multioutConfig) preFixupHooks+=(_multioutDocs) @@ -48,25 +47,22 @@ _overrideFirst outputInfo "info" "$outputBin" # Add standard flags to put files into the desired outputs. _multioutConfig() { - if [[ "$outputs" = "out" || -z "${setOutputFlags-1}" ]]; then - return - fi + if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then return; fi; # try to detect share/doc/${shareDocName} # Note: sadly, $configureScript detection comes later in configurePhase, # and reordering would cause more trouble than worth. if [ -z "$shareDocName" ]; then local confScript="$configureScript" - if [[ -z "$confScript" && -x ./configure ]]; then + if [ -z "$confScript" ] && [ -x ./configure ]; then confScript=./configure fi if [ -f "$confScript" ]; then local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")" - # PACKAGE_TARNAME sometimes contains garbage. - # verify that shareDocName contains only valid characters - if ! [[ $shareDocName =~ ^[a-zA-Z0f9_-]+$ ]]; then - shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')" - fi + fi + # PACKAGE_TARNAME sometimes contains garbage. + if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')" fi fi diff --git a/pkgs/build-support/setup-hooks/reproducible-builds.sh b/pkgs/build-support/setup-hooks/reproducible-builds.sh index 29efd22d905..5b01c213fe4 100644 --- a/pkgs/build-support/setup-hooks/reproducible-builds.sh +++ b/pkgs/build-support/setup-hooks/reproducible-builds.sh @@ -1,13 +1,9 @@ -# shellcheck disable=SC2148 # Use the last part of the out path as hash input for the build. # This should ensure that it is deterministic across rebuilds of the same # derivation and not easily collide with other builds. # We also truncate the hash so that it cannot cause reference cycles. -# NIX_CFLAGS_COMPILE might not have been defined before -NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -frandom-seed=$( - # shellcheck disable=SC2154 +export NIX_CFLAGS_COMPILE+=" -frandom-seed=$( outbase="${out##*/}" randomseed="${outbase:0:10}" - echo "$randomseed" + echo $randomseed )" -export NIX_CFLAGS_COMPILE -- cgit 1.4.1