Merge pull request #72812 from NixOS/bash-no-undef-vars

cc-wrapper, bintools-wrapper: Remove now unneeded `set {+,-}u`
This commit is contained in:
John Ericson 2019-11-08 15:26:14 -05:00 committed by GitHub
commit 5132cc822a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 35 additions and 45 deletions

View File

@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
]; ];
preConfigure = '' preConfigure = ''
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$(echo "${jamomacore}/jamoma/share/cmake/Jamoma")" export CMAKE_PREFIX_PATH="''${CMAKE_PREFIX_PATH-}:$(echo "${jamomacore}/jamoma/share/cmake/Jamoma")"
''; '';
postInstall = ''rm $out/bin/i-score.sh''; postInstall = ''rm $out/bin/i-score.sh'';

View File

@ -199,11 +199,7 @@ stdenv.mkDerivation {
]; ];
postFixup = postFixup =
'' optionalString (libc != null) (''
set -u
''
+ optionalString (libc != null) (''
## ##
## General libc support ## General libc support
## ##

View File

@ -2,8 +2,6 @@
# #
# See comments in cc-wrapper's setup hook. This works exactly the same way. # See comments in cc-wrapper's setup hook. This works exactly the same way.
set -u
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a # Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile. # native compile.
# #
@ -73,4 +71,3 @@ export NIX_HARDENING_ENABLE
# No local scope in sourced file # No local scope in sourced file
unset -v role_pre role_post cmd upper_case unset -v role_pre role_post cmd upper_case
set +u

View File

@ -134,8 +134,6 @@ stdenv.mkDerivation {
installPhase = installPhase =
'' ''
set -u
mkdir -p $out/bin $out/nix-support mkdir -p $out/bin $out/nix-support
wrap() { wrap() {
@ -224,8 +222,6 @@ stdenv.mkDerivation {
postFixup = postFixup =
'' ''
set -u
# Backwards compatability for packages expecting this file, e.g. with # Backwards compatability for packages expecting this file, e.g. with
# `$NIX_CC/nix-support/dynamic-linker`. # `$NIX_CC/nix-support/dynamic-linker`.
# #

View File

@ -54,8 +54,6 @@
# For more details, read the individual files where the mechanisms used to # For more details, read the individual files where the mechanisms used to
# accomplish this will be individually documented. # accomplish this will be individually documented.
set -u
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a # Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile. # native compile.
# #
@ -120,4 +118,3 @@ export NIX_HARDENING_ENABLE
# No local scope in sourced file # No local scope in sourced file
unset -v role_pre role_post unset -v role_pre role_post
set +u

View File

@ -1,11 +1,11 @@
addEmacsVars () { addEmacsVars () {
if test -d $1/share/emacs/site-lisp; then if [[ -d "$1/share/emacs/site-lisp" ]]; then
export EMACSLOADPATH="$1/share/emacs/site-lisp:$EMACSLOADPATH" export EMACSLOADPATH="$1/share/emacs/site-lisp${EMACSLOADPATH:+:}${EMACSLOADPATH-}"
fi fi
} }
# If this is for a wrapper derivation, emacs and the dependencies are all # If this is for a wrapper derivation, emacs and the dependencies are all
# run-time dependencies. If this is for precompiling packages into bytecode, # run-time dependencies. If this is for precompiling packages into bytecode,
# emacs is a compile-time dependency of the package. # emacs is a compile-time dependency of the package.
addEnvHooks "$targetOffset" addEmacsVars addEnvHooks "$hostOffset" addEmacsVars
addEnvHooks "$targetOffset" addEmacsVars addEnvHooks "$targetOffset" addEmacsVars

View File

@ -20,7 +20,7 @@ addToLuaSearchPathWithCustomDelimiter() {
if [[ ! -d "$topDir" ]]; then return; fi if [[ ! -d "$topDir" ]]; then return; fi
# export only if we haven't already got this dir in the search path # export only if we haven't already got this dir in the search path
if [[ ${!varName} == *"$absPattern"* ]]; then return; fi if [[ ${!varName-} == *"$absPattern"* ]]; then return; fi
export "${varName}=${!varName:+${!varName};}${absPattern}" export "${varName}=${!varName:+${!varName};}${absPattern}"
} }

View File

@ -1,7 +1,9 @@
addSDLPath () { addSDLPath () {
if [ -e "$1/include/SDL" ]; then if [ -e "$1/include/SDL" ]; then
export SDL_PATH="$SDL_PATH $1/include/SDL" export SDL_PATH="${SDL_PATH-}${SDL_PATH:+ }$1/include/SDL"
export SDL_LIB_PATH="$SDL_LIB_PATH -L$1/lib" fi
if [ -e "$1/lib" ]; then
export SDL_LIB_PATH="${SDL_LIB_PATH-}${SDL_LIB_PATH:+ }$1/lib"
fi fi
} }

View File

@ -1,6 +1,6 @@
addSDL2Path () { addSDL2Path () {
if [ -e "$1/include/SDL2" ]; then if [ -e "$1/include/SDL2" ]; then
export SDL2_PATH="$SDL2_PATH $1/include/SDL2" export SDL2_PATH="${SDL2_PATH-}${SDL2_PATH:+ }$1/include/SDL2"
fi fi
} }

View File

@ -2,9 +2,9 @@ findGdkPixbufLoaders() {
# choose the longest loaders.cache # choose the longest loaders.cache
local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
if [ -f "$loadersCache" ]; then if [[ -f "$loadersCache" ]]; then
if [ -f "$GDK_PIXBUF_MODULE_FILE" ]; then if [[ -f "${GDK_PIXBUF_MODULE_FILE-}" ]]; then
if [ $(cat "$loadersCache"|wc -l) -gt $(cat "$GDK_PIXBUF_MODULE_FILE"|wc -l) ]; then if [[ "$(cat "$loadersCache" | wc -l)" > "$(cat "$GDK_PIXBUF_MODULE_FILE" | wc -l)" ]]; then
export GDK_PIXBUF_MODULE_FILE="$loadersCache" export GDK_PIXBUF_MODULE_FILE="$loadersCache"
fi fi
else else

View File

@ -1,9 +1,11 @@
make_glib_find_gsettings_schemas() { make_glib_find_gsettings_schemas() {
# For packages that need gschemas of other packages (e.g. empathy) # For packages that need gschemas of other packages (e.g. empathy)
if [ -d "$1"/share/gsettings-schemas/*/glib-2.0/schemas ]; then for maybe_dir in "$1"/share/gsettings-schemas/*/glib-2.0; do
addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"* if [[ -d "$maybe_dir/schemas" ]]; then
fi addToSearchPath GSETTINGS_SCHEMAS_PATH "$maybe_dir"
fi
done
} }
addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas

View File

@ -1,7 +1,7 @@
addGstreamer1LibPath () { addGstreamer1LibPath () {
if test -d "$1/lib/gstreamer-1.0" if test -d "$1/lib/gstreamer-1.0"
then then
export GST_PLUGIN_SYSTEM_PATH_1_0="${GST_PLUGIN_SYSTEM_PATH_1_0}${GST_PLUGIN_SYSTEM_PATH_1_0:+:}$1/lib/gstreamer-1.0" export GST_PLUGIN_SYSTEM_PATH_1_0="${GST_PLUGIN_SYSTEM_PATH_1_0-}${GST_PLUGIN_SYSTEM_PATH_1_0:+:}$1/lib/gstreamer-1.0"
fi fi
} }

View File

@ -1,7 +1,7 @@
addGstreamerLibPath () { addGstreamerLibPath () {
if test -d "$1/lib/gstreamer-0.10" if test -d "$1/lib/gstreamer-0.10"
then then
export GST_PLUGIN_SYSTEM_PATH="${GST_PLUGIN_SYSTEM_PATH}${GST_PLUGIN_SYSTEM_PATH:+:}$1/lib/gstreamer-0.10" export GST_PLUGIN_SYSTEM_PATH="${GST_PLUGIN_SYSTEM_PATH-}${GST_PLUGIN_SYSTEM_PATH:+:}$1/lib/gstreamer-0.10"
fi fi
} }

View File

@ -1,6 +1,6 @@
. @fix_qmake_libtool@ . @fix_qmake_libtool@
qmakeFlags=( $qmakeFlags ) qmakeFlags=( ${qmakeFlags-} )
qmakePrePhase() { qmakePrePhase() {
qmakeFlags=( \ qmakeFlags=( \

View File

@ -27,7 +27,7 @@ setLisp () {
collectNixLispLDLP () { collectNixLispLDLP () {
if echo "$1/lib"/lib*.so* | grep . > /dev/null; then if echo "$1/lib"/lib*.so* | grep . > /dev/null; then
export NIX_LISP_LD_LIBRARY_PATH="$NIX_LISP_LD_LIBRARY_PATH${NIX_LISP_LD_LIBRARY_PATH:+:}$1/lib" export NIX_LISP_LD_LIBRARY_PATH="${NIX_LISP_LD_LIBRARY_PATH-}${NIX_LISP_LD_LIBRARY_PATH:+:}$1/lib"
fi fi
} }

View File

@ -125,25 +125,25 @@ addEnvHooks "$targetOffset" addCMakeParams
makeCmakeFindLibs(){ makeCmakeFindLibs(){
isystem_seen= isystem_seen=
iframework_seen= iframework_seen=
for flag in $NIX_CFLAGS_COMPILE $NIX_LDFLAGS; do for flag in ${NIX_CFLAGS_COMPILE-} ${NIX_LDFLAGS-}; do
if test -n "$isystem_seen" && test -d "$flag"; then if test -n "$isystem_seen" && test -d "$flag"; then
isystem_seen= isystem_seen=
export CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH${CMAKE_INCLUDE_PATH:+:}${flag}" export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH-}${CMAKE_INCLUDE_PATH:+:}${flag}"
elif test -n "$iframework_seen" && test -d "$flag"; then elif test -n "$iframework_seen" && test -d "$flag"; then
iframework_seen= iframework_seen=
export CMAKE_FRAMEWORK_PATH="$CMAKE_FRAMEWORK_PATH${CMAKE_FRAMEWORK_PATH:+:}${flag}" export CMAKE_FRAMEWORK_PATH="${CMAKE_FRAMEWORK_PATH-}${CMAKE_FRAMEWORK_PATH:+:}${flag}"
else else
isystem_seen= isystem_seen=
iframework_seen= iframework_seen=
case $flag in case $flag in
-I*) -I*)
export CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH${CMAKE_INCLUDE_PATH:+:}${flag:2}" export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH-}${CMAKE_INCLUDE_PATH:+:}${flag:2}"
;; ;;
-L*) -L*)
export CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH${CMAKE_LIBRARY_PATH:+:}${flag:2}" export CMAKE_LIBRARY_PATH="${CMAKE_LIBRARY_PATH-}${CMAKE_LIBRARY_PATH:+:}${flag:2}"
;; ;;
-F*) -F*)
export CMAKE_FRAMEWORK_PATH="$CMAKE_FRAMEWORK_PATH${CMAKE_FRAMEWORK_PATH:+:}${flag:2}" export CMAKE_FRAMEWORK_PATH="${CMAKE_FRAMEWORK_PATH-}${CMAKE_FRAMEWORK_PATH:+:}${flag:2}"
;; ;;
-isystem) -isystem)
isystem_seen=1 isystem_seen=1

View File

@ -32,13 +32,13 @@ stdenv.mkDerivation rec {
setupHook = writeText "setupHook.sh" '' setupHook = writeText "setupHook.sh" ''
addOCamlPath () { addOCamlPath () {
if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib"; then if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib"; then
export OCAMLPATH="''${OCAMLPATH}''${OCAMLPATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/" export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/"
fi fi
if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"; then if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"; then
export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs" export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"
fi fi
export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/" export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/"
if test -n "$createFindlibDestdir"; then if test -n "''${createFindlibDestdir-}"; then
mkdir -p $OCAMLFIND_DESTDIR mkdir -p $OCAMLFIND_DESTDIR
fi fi
} }

View File

@ -1,5 +1,5 @@
linkSystemCoreFoundationFramework() { linkSystemCoreFoundationFramework() {
NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks $NIX_CFLAGS_COMPILE" NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}"
# gross! many symbols (such as _OBJC_CLASS_$_NSArray) are defined in system CF, but not # gross! many symbols (such as _OBJC_CLASS_$_NSArray) are defined in system CF, but not
# in the opensource release # in the opensource release
# if the package needs private headers, we assume they also want to link with system CF # if the package needs private headers, we assume they also want to link with system CF

View File

@ -1,6 +1,6 @@
addPrivateFrameworks() { addPrivateFrameworks() {
flag="-F/System/Library/PrivateFrameworks" flag="-F/System/Library/PrivateFrameworks"
if [[ "$NIX_CFLAGS_COMPILE" != *$flag* ]]; then if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then
NIX_CFLAGS_COMPILE+=" $flag" NIX_CFLAGS_COMPILE+=" $flag"
fi fi
} }

View File

@ -2,7 +2,7 @@ noDeprecatedDeclarations() {
# Security.framework has about 2000 deprecated constants, all of which the user will be # Security.framework has about 2000 deprecated constants, all of which the user will be
# warned about at compilation time # warned about at compilation time
flag="-Wno-deprecated-declarations" flag="-Wno-deprecated-declarations"
if [[ "$NIX_CFLAGS_COMPILE" != *$flag* ]]; then if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then
NIX_CFLAGS_COMPILE+=" $flag" NIX_CFLAGS_COMPILE+=" $flag"
fi fi
} }

View File

@ -6,7 +6,7 @@ addSGMLCatalogs () {
fi fi
} }
if test -z "$sgmlHookDone"; then if test -z "${sgmlHookDone-}"; then
sgmlHookDone=1 sgmlHookDone=1
# Set http_proxy and ftp_proxy to a invalid host to prevent # Set http_proxy and ftp_proxy to a invalid host to prevent