From 856f3a46b2f64d4481ced392e1ebc86f09551521 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 15 Jan 2023 23:45:50 +0200 Subject: [PATCH 1/6] stdenv: drop remove unnecessary env var and the associated obsolete functions support for log nesting was removed in 2017 https://github.com/nixos/nixpkgs/commit/6669a3b47711dc967df0ea8ff93fa9857aad015d --- .../tools/misc/automake/automake-1.11.x.nix | 3 -- .../tools/misc/automake/automake-1.15.x.nix | 3 -- .../tools/misc/automake/automake-1.16.x.nix | 3 -- pkgs/stdenv/generic/setup.sh | 31 +++++++------------ .../tools/package-management/nix/nix-perl.nix | 2 -- 5 files changed, 11 insertions(+), 31 deletions(-) diff --git a/pkgs/development/tools/misc/automake/automake-1.11.x.nix b/pkgs/development/tools/misc/automake/automake-1.11.x.nix index 4f9a92d362bcb..161dca6f1805d 100644 --- a/pkgs/development/tools/misc/automake/automake-1.11.x.nix +++ b/pkgs/development/tools/misc/automake/automake-1.11.x.nix @@ -22,9 +22,6 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ perl autoconf ]; buildInputs = [ autoconf ]; - # Disable indented log output from Make, otherwise "make.test" will - # fail. - preCheck = "unset NIX_INDENT_MAKE"; doCheck = false; # takes _a lot_ of time, fails 11 of 782 tests # Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the diff --git a/pkgs/development/tools/misc/automake/automake-1.15.x.nix b/pkgs/development/tools/misc/automake/automake-1.15.x.nix index 470827c2b45e9..f0df759ee2cf6 100644 --- a/pkgs/development/tools/misc/automake/automake-1.15.x.nix +++ b/pkgs/development/tools/misc/automake/automake-1.15.x.nix @@ -16,9 +16,6 @@ stdenv.mkDerivation rec { patches = [ ./help2man-SOURCE_DATE_EPOCH-support.patch ]; - # Disable indented log output from Make, otherwise "make.test" will - # fail. - preCheck = "unset NIX_INDENT_MAKE"; doCheck = false; # takes _a lot_ of time, fails 3 out of 2698 tests, all seem to be related to paths doInstallCheck = false; # runs the same thing, fails the same tests diff --git a/pkgs/development/tools/misc/automake/automake-1.16.x.nix b/pkgs/development/tools/misc/automake/automake-1.16.x.nix index 65d6185f50c07..0d9572c6f3140 100644 --- a/pkgs/development/tools/misc/automake/automake-1.16.x.nix +++ b/pkgs/development/tools/misc/automake/automake-1.16.x.nix @@ -15,9 +15,6 @@ stdenv.mkDerivation rec { setupHook = ./setup-hook.sh; - # Disable indented log output from Make, otherwise "make.test" will - # fail. - preCheck = "unset NIX_INDENT_MAKE"; doCheck = false; # takes _a lot_ of time, fails 3 out of 2698 tests, all seem to be related to paths doInstallCheck = false; # runs the same thing, fails the same tests diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 5fba54dbcced8..be68c76d6384c 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -125,11 +125,6 @@ _eval() { ###################################################################### # Logging. -# Obsolete. -stopNest() { true; } -header() { echo "$1"; } -closeNest() { true; } - # Prints a command such that all word splits are unambiguous. We need # to split the command in three parts because the middle format string # will be, and must be, repeated for each argument. The first argument @@ -798,10 +793,6 @@ unset _HOST_PATH unset _XDG_DATA_DIRS -# Make GNU Make produce nested output. -export NIX_INDENT_MAKE=1 - - # Normalize the NIX_BUILD_CORES variable. The value might be 0, which # means that we're supposed to try and auto-detect the number of # available CPU cores at run-time. @@ -1033,7 +1024,7 @@ _defaultUnpack() { unpackFile() { curSrc="$1" - header "unpacking source archive $curSrc" 3 + echo "unpacking source archive $curSrc" if ! runOneHook unpackCmd "$curSrc"; then echo "do not know how to unpack source archive $curSrc" exit 1 @@ -1130,7 +1121,7 @@ patchPhase() { fi for i in "${patchesArray[@]}"; do - header "applying patch $i" 3 + echo "applying patch $i" local uncompress=cat case "$i" in *.gz) @@ -1494,15 +1485,15 @@ distPhase() { showPhaseHeader() { local phase="$1" case "$phase" in - unpackPhase) header "unpacking sources";; - patchPhase) header "patching sources";; - configurePhase) header "configuring";; - buildPhase) header "building";; - checkPhase) header "running tests";; - installPhase) header "installing";; - fixupPhase) header "post-installation fixup";; - installCheckPhase) header "running install tests";; - *) header "$phase";; + unpackPhase) echo "unpacking sources";; + patchPhase) echo "patching sources";; + configurePhase) echo "configuring";; + buildPhase) echo "building";; + checkPhase) echo "running tests";; + installPhase) echo "installing";; + fixupPhase) echo "post-installation fixup";; + installCheckPhase) echo "running install tests";; + *) echo "$phase";; esac } diff --git a/pkgs/tools/package-management/nix/nix-perl.nix b/pkgs/tools/package-management/nix/nix-perl.nix index 3c44dbdbe1440..0796a0914f1f5 100644 --- a/pkgs/tools/package-management/nix/nix-perl.nix +++ b/pkgs/tools/package-management/nix/nix-perl.nix @@ -40,6 +40,4 @@ stdenv.mkDerivation { ]; preConfigure = "export NIX_STATE_DIR=$TMPDIR"; - - preBuild = "unset NIX_INDENT_MAKE"; } From fe1c7a1945d462489af03ea88e56d46b1a721e53 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 16 Jan 2023 00:08:12 +0200 Subject: [PATCH 2/6] treewide: remove usages of header and stopNest they're obsolete --- .../networking/browsers/firefox/common.nix | 2 +- pkgs/build-support/fetchbzr/builder.sh | 4 +--- pkgs/build-support/fetchcvs/builder.sh | 2 -- pkgs/build-support/fetchdarcs/builder.sh | 4 +--- .../fetchdocker/fetchdocker-builder.sh | 3 +-- pkgs/build-support/fetchdocker/generic-fetcher.nix | 6 ++---- pkgs/build-support/fetchfirefoxaddon/default.nix | 2 +- pkgs/build-support/fetchfossil/builder.sh | 4 +--- pkgs/build-support/fetchgit/builder.sh | 3 +-- pkgs/build-support/fetchhg/builder.sh | 4 +--- pkgs/build-support/fetchmtn/builder.sh | 12 +++--------- pkgs/build-support/fetchsvn/builder.sh | 4 +--- pkgs/build-support/fetchsvnssh/builder.sh | 4 +--- pkgs/build-support/fetchurl/builder.sh | 2 +- pkgs/build-support/release/debian-build.nix | 6 ++---- pkgs/build-support/release/nix-build.nix | 3 +-- pkgs/build-support/release/source-tarball.nix | 3 +-- pkgs/build-support/setup-hooks/audit-tmpdir.sh | 4 +--- .../build-support/setup-hooks/canonicalize-jars.sh | 3 +-- pkgs/build-support/setup-hooks/patch-shebangs.sh | 2 -- .../postgresql-test-hook/postgresql-test-hook.sh | 8 ++++---- .../setup-hooks/separate-debug-info.sh | 2 +- pkgs/build-support/vm/default.nix | 6 ++---- .../compilers/chicken/4/fetchegg/builder.sh | 4 +--- .../compilers/chicken/5/fetchegg/builder.sh | 4 +--- pkgs/development/tools/misc/patchelf/setup-hook.sh | 4 +--- pkgs/os-specific/linux/sgx/psw/default.nix | 4 ++-- pkgs/os-specific/linux/sgx/sdk/default.nix | 14 +++++++------- pkgs/top-level/make-tarball.nix | 6 +++--- pkgs/top-level/nixpkgs-basic-release-checks.nix | 2 +- 30 files changed, 45 insertions(+), 86 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index e8deb9fcd9cc7..07243fe10ed9a 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -524,7 +524,7 @@ buildStdenv.mkDerivation ({ fi # Extract the debug info. - header "separating debug info from $i (build ID $id)" + echo "separating debug info from $i (build ID $id)" mkdir -p "$dst/''${id:0:2}" $OBJCOPY --only-keep-debug "$i" "$dst/''${id:0:2}/''${id:2}.debug" diff --git a/pkgs/build-support/fetchbzr/builder.sh b/pkgs/build-support/fetchbzr/builder.sh index 163f6fc60eea3..380642a5e6816 100644 --- a/pkgs/build-support/fetchbzr/builder.sh +++ b/pkgs/build-support/fetchbzr/builder.sh @@ -1,10 +1,8 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source "$stdenv/setup" -header "exporting \`$url' (revision $rev) into \`$out'" +echo "exporting \`$url' (revision $rev) into \`$out'" # Perform a lightweight checkout so that we don't end up importing # all the repository's history. BZR_LOG=/dev/null bzr -Ossl.cert_reqs=none export -r "$rev" --format=dir "$out" "$url" - -stopNest diff --git a/pkgs/build-support/fetchcvs/builder.sh b/pkgs/build-support/fetchcvs/builder.sh index 90363275b9737..4b49e9676ec02 100644 --- a/pkgs/build-support/fetchcvs/builder.sh +++ b/pkgs/build-support/fetchcvs/builder.sh @@ -24,5 +24,3 @@ else fi (cd export && cvs -f -z0 -d "$cvsRoot" export $tag "$module") mv export/* $out - -stopNest diff --git a/pkgs/build-support/fetchdarcs/builder.sh b/pkgs/build-support/fetchdarcs/builder.sh index 018852770504a..ce5537f46f40d 100644 --- a/pkgs/build-support/fetchdarcs/builder.sh +++ b/pkgs/build-support/fetchdarcs/builder.sh @@ -11,10 +11,8 @@ elif test -n "$context"; then tagflags="--context=$context" fi -header "getting $url $partial ${tagtext} into $out" +echo "getting $url $partial ${tagtext} into $out" darcs get --lazy $tagflags "$url" "$out" # remove metadata, because it can change rm -rf "$out/_darcs" - -stopNest diff --git a/pkgs/build-support/fetchdocker/fetchdocker-builder.sh b/pkgs/build-support/fetchdocker/fetchdocker-builder.sh index e5a1a61b78d30..4eb70f672d488 100644 --- a/pkgs/build-support/fetchdocker/fetchdocker-builder.sh +++ b/pkgs/build-support/fetchdocker/fetchdocker-builder.sh @@ -1,6 +1,6 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source "${stdenv}/setup" -header "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}" +echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}" mkdir -p "${out}" cat < "${out}/compositeImage.sh" @@ -26,4 +26,3 @@ ${gnutar}/bin/tar \ -c "${manifest}" "${repositories}" -T "${imageFileStorePaths}" EOF chmod +x "${out}/compositeImage.sh" -stopNest diff --git a/pkgs/build-support/fetchdocker/generic-fetcher.nix b/pkgs/build-support/fetchdocker/generic-fetcher.nix index 3b0c33770467e..6a7b977db29f8 100644 --- a/pkgs/build-support/fetchdocker/generic-fetcher.nix +++ b/pkgs/build-support/fetchdocker/generic-fetcher.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation { inherit name; builder = writeText "${fetcher}-builder.sh" '' source "$stdenv/setup" - header "${fetcher} exporting to $out" + echo "${fetcher} exporting to $out" declare -A creds @@ -49,7 +49,7 @@ stdenv.mkDerivation { fi if [ -f "$dockerCredentialsFile" ]; then - header "using credentials from $dockerCredentialsFile" + echo "using credentials from $dockerCredentialsFile" CREDSFILE=$(cat "$dockerCredentialsFile") creds[token]=$(${awk} -F'=' '/DOCKER_TOKEN/ {print $2}' <<< "$CREDSFILE" | head -n1) @@ -77,8 +77,6 @@ stdenv.mkDerivation { ${layerDigestFlag} \ "${repository}/${imageName}" \ "${tag}" - - stopNest ''; buildInputs = [ haskellPackages.hocker ]; diff --git a/pkgs/build-support/fetchfirefoxaddon/default.nix b/pkgs/build-support/fetchfirefoxaddon/default.nix index 0fa51e69840cd..fe9ff5c469bad 100644 --- a/pkgs/build-support/fetchfirefoxaddon/default.nix +++ b/pkgs/build-support/fetchfirefoxaddon/default.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation { builder = writeScript "xpibuilder" '' source $stdenv/setup - header "firefox addon $name into $out" + echo "firefox addon $name into $out" UUID="${extid}" mkdir -p "$out/$UUID" diff --git a/pkgs/build-support/fetchfossil/builder.sh b/pkgs/build-support/fetchfossil/builder.sh index 009b23c406d6b..36b758ab574e4 100644 --- a/pkgs/build-support/fetchfossil/builder.sh +++ b/pkgs/build-support/fetchfossil/builder.sh @@ -1,6 +1,6 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "Cloning Fossil $url [$rev] into $out" +echo "Cloning Fossil $url [$rev] into $out" # Fossil, bless its adorable little heart, wants to write global configuration # to $HOME/.fossil. AFAICT, there is no way to disable this functionality. @@ -19,5 +19,3 @@ popd # Just nuke the checkout file. rm $out/.fslckout - -stopNest diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh index acb970639ab17..77f6381b09ab2 100644 --- a/pkgs/build-support/fetchgit/builder.sh +++ b/pkgs/build-support/fetchgit/builder.sh @@ -6,7 +6,7 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "exporting $url (rev $rev) into $out" +echo "exporting $url (rev $rev) into $out" $SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" \ ${leaveDotGit:+--leave-dotGit} \ @@ -18,4 +18,3 @@ $SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" \ ${branchName:+--branch-name "$branchName"} runHook postFetch -stopNest diff --git a/pkgs/build-support/fetchhg/builder.sh b/pkgs/build-support/fetchhg/builder.sh index cec0e441f2296..1ce294757713c 100644 --- a/pkgs/build-support/fetchhg/builder.sh +++ b/pkgs/build-support/fetchhg/builder.sh @@ -1,10 +1,8 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "getting $url${rev:+ ($rev)} into $out" +echo "getting $url${rev:+ ($rev)} into $out" hg clone --insecure "$url" hg-clone hg archive -q$subrepoClause -y ${rev:+-r "$rev"} --cwd hg-clone $out rm -f $out/.hg_archival.txt - -stopNest diff --git a/pkgs/build-support/fetchmtn/builder.sh b/pkgs/build-support/fetchmtn/builder.sh index 7db66730dab82..1aabd7949ee1d 100644 --- a/pkgs/build-support/fetchmtn/builder.sh +++ b/pkgs/build-support/fetchmtn/builder.sh @@ -8,7 +8,7 @@ if ! [ -f "$cacheDB" ]; then mtn --db "$cacheDB" db init fi -header "getting revision $selector"; +echo "getting revision $selector"; done=; for source in $dbs; do @@ -32,9 +32,7 @@ for source in $dbs; do fi; done; -stopNest; - -header "checking out the revision $revision"; +echo "checking out the revision $revision"; if test -n "$done"; then mtn checkout --db "$cacheDB" -r "$revision" "$out" -b "${branch}" @@ -43,10 +41,6 @@ else exit 1; fi; -stopNest - -header "clearing _MTN in the output" +echo "clearing _MTN in the output" rm -rf "$out/_MTN" - -stopNest diff --git a/pkgs/build-support/fetchsvn/builder.sh b/pkgs/build-support/fetchsvn/builder.sh index b58e5a88b3cd8..aa4d049aba431 100644 --- a/pkgs/build-support/fetchsvn/builder.sh +++ b/pkgs/build-support/fetchsvn/builder.sh @@ -1,7 +1,7 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "exporting $url (r$rev) into $out" +echo "exporting $url (r$rev) into $out" if test -n "$http_proxy"; then # Configure proxy @@ -22,5 +22,3 @@ fi; svn export --trust-server-cert --non-interactive \ ${ignoreExternals:+--ignore-externals} ${ignoreKeywords:+--ignore-keywords} \ -r "$rev" "$url" "$out" - -stopNest diff --git a/pkgs/build-support/fetchsvnssh/builder.sh b/pkgs/build-support/fetchsvnssh/builder.sh index b0441299dd2c6..5782151524f7a 100644 --- a/pkgs/build-support/fetchsvnssh/builder.sh +++ b/pkgs/build-support/fetchsvnssh/builder.sh @@ -1,7 +1,7 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "exporting $url (r$rev) into $out" +echo "exporting $url (r$rev) into $out" if test "$sshSupport"; then export SVN_SSH="$openssh/bin/ssh" @@ -12,5 +12,3 @@ fi # whether the server is being spoofed --- only the cryptographic # hash of the output matters. expect -f $sshSubversion "$username" "$password" "$rev" "$url" $out - -stopNest diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh index dd987f41b4467..e8eaba934858e 100644 --- a/pkgs/build-support/fetchurl/builder.sh +++ b/pkgs/build-support/fetchurl/builder.sh @@ -37,7 +37,7 @@ if [ -n "$downloadToTemp" ]; then downloadedFile="$TMPDIR/file"; fi tryDownload() { local url="$1" echo - header "trying $url" + echo "trying $url" local curlexit=18; success= diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix index 9104bf2dce5cc..679adad827dac 100644 --- a/pkgs/build-support/release/debian-build.nix +++ b/pkgs/build-support/release/debian-build.nix @@ -43,9 +43,8 @@ vmTools.runInLinuxImage (stdenv.mkDerivation ( [ ! -f /etc/lsb-release ] || (source /etc/lsb-release; echo "OS release: $DISTRIB_DESCRIPTION") echo "System/kernel: $(uname -a)" if test -e /etc/debian_version; then echo "Debian release: $(cat /etc/debian_version)"; fi - header "installed Debian packages" + echo "installed Debian packages" dpkg-query --list - stopNest ''; installPhase = '' @@ -73,11 +72,10 @@ vmTools.runInLinuxImage (stdenv.mkDerivation ( [ "$(echo $out/debs/*.deb)" != "" ] for i in $out/debs/*.deb; do - header "Generated DEB package: $i" + echo "Generated DEB package: $i" dpkg-deb --info "$i" pkgName=$(dpkg-deb -W "$i" | awk '{print $1}') echo "file deb $i" >> $out/nix-support/hydra-build-products - stopNest done dpkg -i $out/debs/*.deb diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix index 5ed2b0752efc5..9578fbf482f26 100644 --- a/pkgs/build-support/release/nix-build.nix +++ b/pkgs/build-support/release/nix-build.nix @@ -74,10 +74,9 @@ stdenv.mkDerivation ( if test -n "$succeedOnFailure"; then if test -n "$keepBuildDirectory"; then KEEPBUILDDIR="$out/`basename $TMPDIR`" - header "Copying build directory to $KEEPBUILDDIR" + echo "Copying build directory to $KEEPBUILDDIR" mkdir -p $KEEPBUILDDIR cp -R "$TMPDIR/"* $KEEPBUILDDIR - stopNest fi fi ''; diff --git a/pkgs/build-support/release/source-tarball.nix b/pkgs/build-support/release/source-tarball.nix index 742cce13b7bf1..d624d071cc21b 100644 --- a/pkgs/build-support/release/source-tarball.nix +++ b/pkgs/build-support/release/source-tarball.nix @@ -64,10 +64,9 @@ stdenv.mkDerivation ( if test -n "$succeedOnFailure"; then if test -n "$keepBuildDirectory"; then KEEPBUILDDIR="$out/`basename $TMPDIR`" - header "Copying build directory to $KEEPBUILDDIR" + echo "Copying build directory to $KEEPBUILDDIR" mkdir -p $KEEPBUILDDIR cp -R "$TMPDIR/"* $KEEPBUILDDIR - stopNest fi fi ''; diff --git a/pkgs/build-support/setup-hooks/audit-tmpdir.sh b/pkgs/build-support/setup-hooks/audit-tmpdir.sh index 9c03bc2ee9354..36714178156bd 100644 --- a/pkgs/build-support/setup-hooks/audit-tmpdir.sh +++ b/pkgs/build-support/setup-hooks/audit-tmpdir.sh @@ -13,7 +13,7 @@ auditTmpdir() { local dir="$1" [ -e "$dir" ] || return 0 - header "checking for references to $TMPDIR/ in $dir..." + echo "checking for references to $TMPDIR/ in $dir..." local i find "$dir" -type f -print0 | while IFS= read -r -d $'\0' i; do @@ -36,6 +36,4 @@ auditTmpdir() { fi done - - stopNest } diff --git a/pkgs/build-support/setup-hooks/canonicalize-jars.sh b/pkgs/build-support/setup-hooks/canonicalize-jars.sh index 8c55810748ea0..5137bfc94b011 100644 --- a/pkgs/build-support/setup-hooks/canonicalize-jars.sh +++ b/pkgs/build-support/setup-hooks/canonicalize-jars.sh @@ -6,12 +6,11 @@ fixupOutputHooks+=('if [ -z "$dontCanonicalizeJars" -a -e "$prefix" ]; then cano canonicalizeJarsIn() { local dir="$1" - header "canonicalizing jars in $dir" + echo "canonicalizing jars in $dir" dir="$(realpath -sm -- "$dir")" while IFS= read -rd '' f; do canonicalizeJar "$f" done < <(find -- "$dir" -type f -name '*.jar' -print0) - stopNest } source @canonicalize_jar@ diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 04ebcd2cc64ec..a26113abea88e 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -100,8 +100,6 @@ patchShebangs() { fi fi done < <(find "$@" -type f -perm -0100 -print0) - - stopNest } patchShebangsAuto () { diff --git a/pkgs/build-support/setup-hooks/postgresql-test-hook/postgresql-test-hook.sh b/pkgs/build-support/setup-hooks/postgresql-test-hook/postgresql-test-hook.sh index 041a3f5653325..de8faad5475e5 100644 --- a/pkgs/build-support/setup-hooks/postgresql-test-hook/postgresql-test-hook.sh +++ b/pkgs/build-support/setup-hooks/postgresql-test-hook/postgresql-test-hook.sh @@ -53,7 +53,7 @@ EOF echo >&2 'initdb not found. Did you add postgresql to the checkInputs?' false fi - header 'initializing postgresql' + echo 'initializing postgresql' initdb -U postgres # Move the socket @@ -65,15 +65,15 @@ EOF echo "listen_addresses = ''" >>"$PGDATA/postgresql.conf" fi - header 'starting postgresql' + echo 'starting postgresql' eval "${postgresqlStartCommands:-pg_ctl start}" - header 'setting up postgresql' + echo 'setting up postgresql' eval "$postgresqlTestSetupCommands" } postgresqlStop() { - header 'stopping postgresql' + echo 'stopping postgresql' pg_ctl stop } diff --git a/pkgs/build-support/setup-hooks/separate-debug-info.sh b/pkgs/build-support/setup-hooks/separate-debug-info.sh index be94af545be17..3c8c9c294c3e2 100644 --- a/pkgs/build-support/setup-hooks/separate-debug-info.sh +++ b/pkgs/build-support/setup-hooks/separate-debug-info.sh @@ -26,7 +26,7 @@ _separateDebugInfo() { fi # Extract the debug info. - header "separating debug info from $i (build ID $id)" + echo "separating debug info from $i (build ID $id)" mkdir -p "$dst/${id:0:2}" # This may fail, e.g. if the binary is for a different diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 7bae2fc7cfb27..84754e580302c 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -527,9 +527,8 @@ rec { echo "System/kernel: $(uname -a)" if test -e /etc/fedora-release; then echo "Fedora release: $(cat /etc/fedora-release)"; fi if test -e /etc/SuSE-release; then echo "SUSE release: $(cat /etc/SuSE-release)"; fi - header "installed RPM packages" + echo "installed RPM packages" rpm -qa --qf "%{Name}-%{Version}-%{Release} (%{Arch}; %{Distribution}; %{Vendor})\n" - stopNest ''; buildPhase = '' @@ -559,9 +558,8 @@ rec { find $rpmout -name "*.rpm" -exec cp {} $out/$outDir \; for i in $out/$outDir/*.rpm; do - header "Generated RPM/SRPM: $i" + echo "Generated RPM/SRPM: $i" rpm -qip $i - stopNest done eval "$postInstall" diff --git a/pkgs/development/compilers/chicken/4/fetchegg/builder.sh b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh index 5f41a36263a9c..cb56eabc5d781 100644 --- a/pkgs/development/compilers/chicken/4/fetchegg/builder.sh +++ b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh @@ -1,10 +1,8 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "exporting egg ${eggName} (version $version) into $out" +echo "exporting egg ${eggName} (version $version) into $out" mkdir -p $out chicken-install -r "${eggName}:${version}" cp -r ${eggName}/* $out/ - -stopNest diff --git a/pkgs/development/compilers/chicken/5/fetchegg/builder.sh b/pkgs/development/compilers/chicken/5/fetchegg/builder.sh index f02e017577873..34c9de37233d3 100644 --- a/pkgs/development/compilers/chicken/5/fetchegg/builder.sh +++ b/pkgs/development/compilers/chicken/5/fetchegg/builder.sh @@ -1,11 +1,9 @@ if [ -e .attrs.sh ]; then source .attrs.sh; fi source $stdenv/setup -header "exporting egg ${eggName} (version $version) into $out" +echo "exporting egg ${eggName} (version $version) into $out" mkdir -p $out CHICKEN_EGG_CACHE=. chicken-install -r "${eggName}:${version}" rm ${eggName}/{STATUS,TIMESTAMP} cp -r ${eggName}/* $out/ - -stopNest diff --git a/pkgs/development/tools/misc/patchelf/setup-hook.sh b/pkgs/development/tools/misc/patchelf/setup-hook.sh index 576b9ca2103ec..8f010a3f4d0b1 100644 --- a/pkgs/development/tools/misc/patchelf/setup-hook.sh +++ b/pkgs/development/tools/misc/patchelf/setup-hook.sh @@ -8,7 +8,7 @@ patchELF() { local dir="$1" [ -e "$dir" ] || return 0 - header "shrinking RPATHs of ELF executables and libraries in $dir" + echo "shrinking RPATHs of ELF executables and libraries in $dir" local i while IFS= read -r -d $'\0' i; do @@ -17,6 +17,4 @@ patchELF() { echo "shrinking $i" patchelf --shrink-rpath "$i" || true done < <(find "$dir" -type f -print0) - - stopNest } diff --git a/pkgs/os-specific/linux/sgx/psw/default.nix b/pkgs/os-specific/linux/sgx/psw/default.nix index ba2d0967e45de..4a5e50d9c6abb 100644 --- a/pkgs/os-specific/linux/sgx/psw/default.nix +++ b/pkgs/os-specific/linux/sgx/psw/default.nix @@ -132,7 +132,7 @@ stdenv.mkDerivation rec { # NixOS module which is based on those files without relying on them. Still, it # is helpful to have properly patched versions for non-NixOS distributions. postFixup = '' - header "Fixing aesmd.service" + echo "Fixing aesmd.service" substituteInPlace $out/lib/systemd/system/aesmd.service \ --replace '@aesm_folder@' \ "$out/aesm" \ @@ -149,7 +149,7 @@ stdenv.mkDerivation rec { --replace "/bin/kill" \ "${coreutils}/bin/kill" - header "Fixing remount-dev-exec.service" + echo "Fixing remount-dev-exec.service" substituteInPlace $out/lib/systemd/system/remount-dev-exec.service \ --replace '/bin/mount' \ "${util-linux}/bin/mount" diff --git a/pkgs/os-specific/linux/sgx/sdk/default.nix b/pkgs/os-specific/linux/sgx/sdk/default.nix index 5213dc1e4fda8..053aaecbcbb7e 100644 --- a/pkgs/os-specific/linux/sgx/sdk/default.nix +++ b/pkgs/os-specific/linux/sgx/sdk/default.nix @@ -109,7 +109,7 @@ stdenv.mkDerivation rec { }; in '' - header "Setting up IPP crypto build artifacts" + echo "Setting up IPP crypto build artifacts" pushd 'external/ippcp_internal' @@ -149,7 +149,7 @@ stdenv.mkDerivation rec { ./linux/installer/bin/sgx_linux_x64_sdk_${version}.bin -prefix $installDir installDir=$installDir/sgxsdk - header "Move files created by installer" + echo "Move files created by installer" mkdir -p $out/bin pushd $out @@ -206,15 +206,15 @@ stdenv.mkDerivation rec { preFixup = '' - header "Strip sgxsdk prefix" + echo "Strip sgxsdk prefix" for path in "$out/share/bin/environment" "$out/bin/sgx-gdb"; do substituteInPlace $path --replace "$TMPDIR/sgxsdk" "$out" done - header "Fixing pkg-config files" + echo "Fixing pkg-config files" sed -i "s|prefix=.*|prefix=$out|g" $out/lib/pkgconfig/*.pc - header "Fixing SGX_SDK default in samples" + echo "Fixing SGX_SDK default in samples" substituteInPlace $out/share/SampleCode/LocalAttestation/buildenv.mk \ --replace '/opt/intel/sgxsdk' "$out" for file in $out/share/SampleCode/*/Makefile; do @@ -222,12 +222,12 @@ stdenv.mkDerivation rec { --replace '/opt/intel/sgxsdk' "$out" done - header "Fixing BINUTILS_DIR in buildenv.mk" + echo "Fixing BINUTILS_DIR in buildenv.mk" substituteInPlace $out/share/bin/buildenv.mk \ --replace 'BINUTILS_DIR ?= /usr/local/bin' \ 'BINUTILS_DIR ?= ${BINUTILS_DIR}' - header "Fixing GDB path in bin/sgx-gdb" + echo "Fixing GDB path in bin/sgx-gdb" substituteInPlace $out/bin/sgx-gdb --replace '/usr/local/bin/gdb' '${gdb}/bin/gdb' ''; diff --git a/pkgs/top-level/make-tarball.nix b/pkgs/top-level/make-tarball.nix index 6858e37fabeb8..dbe96bd096f89 100644 --- a/pkgs/top-level/make-tarball.nix +++ b/pkgs/top-level/make-tarball.nix @@ -47,10 +47,10 @@ pkgs.releaseTools.sourceTarball { opts=(--option build-users-group "") nix-store --init - header "checking eval-release.nix" + echo "checking eval-release.nix" nix-instantiate --eval --strict --show-trace ./maintainers/scripts/eval-release.nix > /dev/null - header "checking find-tarballs.nix" + echo "checking find-tarballs.nix" nix-instantiate --readonly-mode --eval --strict --show-trace --json \ ./maintainers/scripts/find-tarballs.nix \ --arg expr 'import ./maintainers/scripts/all-tarballs.nix' > $TMPDIR/tarballs.json @@ -61,7 +61,7 @@ pkgs.releaseTools.sourceTarball { exit 1 fi - header "generating packages.json" + echo "generating packages.json" mkdir -p $out/nix-support echo -n '{"version":2,"packages":' > tmp nix-env -f . -I nixpkgs=$src -qa --meta --json --arg config 'import ${./packages-config.nix}' "''${opts[@]}" >> tmp diff --git a/pkgs/top-level/nixpkgs-basic-release-checks.nix b/pkgs/top-level/nixpkgs-basic-release-checks.nix index e2b81b20c5b08..ab9dac4b380ca 100644 --- a/pkgs/top-level/nixpkgs-basic-release-checks.nix +++ b/pkgs/top-level/nixpkgs-basic-release-checks.nix @@ -32,7 +32,7 @@ pkgs.runCommand "nixpkgs-release-checks" { src = nixpkgs; buildInputs = [nix]; } # Check that all-packages.nix evaluates on a number of platforms without any warnings. for platform in ${pkgs.lib.concatStringsSep " " supportedSystems}; do - header "checking Nixpkgs on $platform" + echo "checking Nixpkgs on $platform" # To get a call trace; see https://nixos.org/manual/nixpkgs/stable/#function-library-lib.trivial.warn # Relies on impure eval From 0e8263ce73cc3f78bd94b37db87fe47060761ce3 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 16 Jan 2023 00:36:31 +0200 Subject: [PATCH 3/6] stdenv: fix SC2223 In pkgs/stdenv/generic/setup.sh line 36: : ${outputs:=out} ^-------------^ SC2223 (info): This default assignment may cause DoS due to globbing. Quote it. --- pkgs/stdenv/generic/setup.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index be68c76d6384c..62fbf9d986a91 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -32,7 +32,7 @@ if [ -n "$__structuredAttrs" ]; then export NIX_ATTRS_JSON_FILE="$NIX_BUILD_TOP/.attrs.json" export NIX_ATTRS_SH_FILE="$NIX_BUILD_TOP/.attrs.sh" else - : ${outputs:=out} + : "${outputs:=out}" fi getAllOutputNames() { @@ -393,7 +393,7 @@ fi # implementation uses zip archive and zip does not support dates going back to # 1970. export SOURCE_DATE_EPOCH -: ${SOURCE_DATE_EPOCH:=315532800} +: "${SOURCE_DATE_EPOCH:=315532800}" # Wildcard expansions that don't match should expand to an empty list. @@ -605,12 +605,12 @@ findInputs() { # in each list must be store paths, and therefore space-free. # Make sure all are at least defined as empty -: ${depsBuildBuild=} ${depsBuildBuildPropagated=} -: ${nativeBuildInputs=} ${propagatedNativeBuildInputs=} ${defaultNativeBuildInputs=} -: ${depsBuildTarget=} ${depsBuildTargetPropagated=} -: ${depsHostHost=} ${depsHostHostPropagated=} -: ${buildInputs=} ${propagatedBuildInputs=} ${defaultBuildInputs=} -: ${depsTargetTarget=} ${depsTargetTargetPropagated=} +: "${depsBuildBuild=}" "${depsBuildBuildPropagated=}" +: "${nativeBuildInputs=}" "${propagatedNativeBuildInputs=}" "${defaultNativeBuildInputs=}" +: "${depsBuildTarget=}" "${depsBuildTargetPropagated=}" +: "${depsHostHost=}" "${depsHostHostPropagated=}" +: "${buildInputs=}" "${propagatedBuildInputs=}" "${defaultBuildInputs=}" +: "${depsTargetTarget=}" "${depsTargetTargetPropagated=}" for pkg in ${depsBuildBuild[@]} ${depsBuildBuildPropagated[@]}; do findInputs "$pkg" -1 -1 @@ -1070,7 +1070,7 @@ unpackPhase() { # Find the source directory. # set to empty if unset - : ${sourceRoot=} + : "${sourceRoot=}" if [ -n "${setSourceRoot:-}" ]; then runOneHook setSourceRoot @@ -1174,7 +1174,7 @@ configurePhase() { runHook preConfigure # set to empty if unset - : ${configureScript=} + : "${configureScript=}" if [[ -z "$configureScript" && -x ./configure ]]; then configureScript=./configure From 0417f953e2b46d37fd68704d7bb24181c9c03274 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 16 Jan 2023 00:39:25 +0200 Subject: [PATCH 4/6] stdenv: fix SC2004 & SC2086 SC2004 (style): $/${} is unnecessary on arithmetic variables. SC2086 (info): Double quote to prevent globbing and word splitting. --- pkgs/stdenv/generic/setup.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 62fbf9d986a91..af8c190f85344 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -879,7 +879,7 @@ substituteStream() { # fail loudly if provided with a binary (containing null bytes) consumeEntire() { # read returns non-0 on EOF, so we want read to fail - if IFS='' read -r -d '' $1 ; then + if IFS='' read -r -d '' "$1" ; then echo "consumeEntire(): ERROR: Input null bytes, won't process" >&2 return 1 fi @@ -1436,7 +1436,7 @@ installCheckPhase() { echo "no Makefile or custom installCheckPhase, doing nothing" #TODO(@oxij): should flagsArray influence make -n? elif [[ -z "${installCheckTarget:-}" ]] \ - && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} >/dev/null 2>&1; then + && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" >/dev/null 2>&1; then echo "no installcheck target in ${makefile:-Makefile}, doing nothing" else # Old bash empty array hack @@ -1503,14 +1503,14 @@ showPhaseFooter() { local startTime="$2" local endTime="$3" local delta=$(( endTime - startTime )) - (( $delta < 30 )) && return + (( delta < 30 )) && return local H=$((delta/3600)) local M=$((delta%3600/60)) local S=$((delta%60)) echo -n "$phase completed in " - (( $H > 0 )) && echo -n "$H hours " - (( $M > 0 )) && echo -n "$M minutes " + (( H > 0 )) && echo -n "$H hours " + (( M > 0 )) && echo -n "$M minutes " echo "$S seconds" } @@ -1552,7 +1552,7 @@ genericBuild() { if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then continue; fi if [[ -n $NIX_LOG_FD ]]; then - echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&$NIX_LOG_FD + echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&"$NIX_LOG_FD" fi showPhaseHeader "$curPhase" From 4db439c5991dc1903efc167918b64cf852ba0fd5 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 16 Jan 2023 00:19:32 +0200 Subject: [PATCH 5/6] stdenv: disable shellcheck rules In pkgs/stdenv/generic/setup.sh line 101: source "$hookName" ^---------^ SC1090 (warning): ShellCheck can't follow non-constant source. Use a directive to specify location. In pkgs/stdenv/generic/setup.sh line 166: mkdir -p "$out/nix-support" ^--^ SC2154 (warning): out is referenced but not assigned. In pkgs/stdenv/generic/setup.sh line 407: PATH= ^--^ SC2123 (warning): PATH is the shell search path. Use another name. In pkgs/stdenv/generic/setup.sh line 452: declare -a pkgBuildAccumVars=(pkgsBuildBuild pkgsBuildHost pkgsBuildTarget) ^---------------^ SC2034 (warning): pkgBuildAccumVars appears unused. Verify use (or export if used e xternally). because pkgBuildAccumVars is used In pkgs/stdenv/generic/setup.sh line 235: nameref="$* ${nameref-}" ^-----^ SC2178 (warning): Variable was used as an array but is now assigned a string. because we theres a useArray conditional --- pkgs/stdenv/generic/setup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index af8c190f85344..89a0dc1112d87 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1,4 +1,5 @@ # shellcheck shell=bash +# shellcheck disable=1090,2154,2123,2034,2178 __nixpkgs_setup_set_original=$- set -eu set -o pipefail @@ -443,7 +444,6 @@ runHook addInputsHook # Package accumulators -# shellcheck disable=SC2034 declare -a pkgsBuildBuild pkgsBuildHost pkgsBuildTarget declare -a pkgsHostHost pkgsHostTarget declare -a pkgsTargetTarget @@ -468,7 +468,6 @@ declare -a pkgTargetHookVars=(envTargetTargetHook) declare -a pkgHookVarVars=(pkgBuildHookVars pkgHostHookVars pkgTargetHookVars) # those variables are declared here, since where and if they are used varies -# shellcheck disable=SC2034 declare -a preFixupHooks fixupOutputHooks preConfigureHooks postFixupHooks postUnpackHooks unpackCmdHooks # Add env hooks for all sorts of deps with the specified host offset. From e58785bf417dbb62611795a0187240600cc8685c Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 16 Jan 2023 08:13:40 +0200 Subject: [PATCH 6/6] stdenv: disable shellcheck rule SC2048 we use [*] to support structuredAttrs and non In pkgs/stdenv/generic/setup.sh line 1542: for curPhase in ${phases[*]}; do ^----------^ SC2048 (warning): Use "${array[@]}" (with quotes) to prevent whitespace problems. --- pkgs/stdenv/generic/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 89a0dc1112d87..7e4c5edbc869e 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1,5 +1,5 @@ # shellcheck shell=bash -# shellcheck disable=1090,2154,2123,2034,2178 +# shellcheck disable=1090,2154,2123,2034,2178,2048 __nixpkgs_setup_set_original=$- set -eu set -o pipefail