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
This commit is contained in:
parent
e3e1a53118
commit
9172c1eee2
@ -562,6 +562,10 @@ _addToEnv() {
|
|||||||
(( "$depHostOffset" <= "$depTargetOffset" )) || continue
|
(( "$depHostOffset" <= "$depTargetOffset" )) || continue
|
||||||
local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"
|
local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"
|
||||||
if [[ -z "${strictDeps-}" ]]; then
|
if [[ -z "${strictDeps-}" ]]; then
|
||||||
|
|
||||||
|
# Keep track of which packages we have visited before.
|
||||||
|
local visitedPkgs=""
|
||||||
|
|
||||||
# Apply environment hooks to all packages during native
|
# Apply environment hooks to all packages during native
|
||||||
# compilation to ease the transition.
|
# compilation to ease the transition.
|
||||||
#
|
#
|
||||||
@ -574,7 +578,11 @@ _addToEnv() {
|
|||||||
${pkgsHostTarget+"${pkgsHostTarget[@]}"} \
|
${pkgsHostTarget+"${pkgsHostTarget[@]}"} \
|
||||||
${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}
|
${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}
|
||||||
do
|
do
|
||||||
|
if [[ "$visitedPkgs" = *"$pkg"* ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
runHook "${!hookRef}" "$pkg"
|
runHook "${!hookRef}" "$pkg"
|
||||||
|
visitedPkgs+=" $pkg"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"
|
local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user