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 = ''
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'';

View File

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

View File

@ -2,8 +2,6 @@
#
# 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
# native compile.
#
@ -73,4 +71,3 @@ export NIX_HARDENING_ENABLE
# No local scope in sourced file
unset -v role_pre role_post cmd upper_case
set +u

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ addToLuaSearchPathWithCustomDelimiter() {
if [[ ! -d "$topDir" ]]; then return; fi
# 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}"
}

View File

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

View File

@ -1,6 +1,6 @@
addSDL2Path () {
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
}

View File

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

View File

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

View File

@ -1,7 +1,7 @@
addGstreamer1LibPath () {
if test -d "$1/lib/gstreamer-1.0"
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
}

View File

@ -1,7 +1,7 @@
addGstreamerLibPath () {
if test -d "$1/lib/gstreamer-0.10"
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
}

View File

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

View File

@ -27,7 +27,7 @@ setLisp () {
collectNixLispLDLP () {
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
}

View File

@ -125,25 +125,25 @@ addEnvHooks "$targetOffset" addCMakeParams
makeCmakeFindLibs(){
isystem_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
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
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
isystem_seen=
iframework_seen=
case $flag in
-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*)
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*)
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_seen=1

View File

@ -32,13 +32,13 @@ stdenv.mkDerivation rec {
setupHook = writeText "setupHook.sh" ''
addOCamlPath () {
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
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"
fi
export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/"
if test -n "$createFindlibDestdir"; then
if test -n "''${createFindlibDestdir-}"; then
mkdir -p $OCAMLFIND_DESTDIR
fi
}

View File

@ -1,5 +1,5 @@
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
# in the opensource release
# if the package needs private headers, we assume they also want to link with system CF

View File

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

View File

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

View File

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