summaryrefslogtreecommitdiffstats
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-10-31 14:26:54 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2019-01-27 17:49:13 -0500
commit9172c1eee2e376ef9070d1db0586471c52397242 (patch)
treea66813aaa0b05f58062cce7cb0bf01a4602cfa17 /pkgs/stdenv/generic
parente3e1a53118d22796f95bbd8978e5bcb0b1603270 (diff)
setup.sh: avoid running the same hook twice
In strictDeps=false, we don’t want the same package hook to be run twice, otherwise we get duplicates in some flags. Fixes #41340
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/setup.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 8af369b1d17d..7e55f0db2aac 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -562,6 +562,10 @@ _addToEnv() {
(( "$depHostOffset" <= "$depTargetOffset" )) || continue
local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"
if [[ -z "${strictDeps-}" ]]; then
+
+ # Keep track of which packages we have visited before.
+ local visitedPkgs=""
+
# Apply environment hooks to all packages during native
# compilation to ease the transition.
#
@@ -574,7 +578,11 @@ _addToEnv() {
${pkgsHostTarget+"${pkgsHostTarget[@]}"} \
${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}
do
+ if [[ "$visitedPkgs" = *"$pkg"* ]]; then
+ continue
+ fi
runHook "${!hookRef}" "$pkg"
+ visitedPkgs+=" $pkg"
done
else
local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"