3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #49552 from matthewbauer/setup-dedupe

setup.sh: avoid running the same hook twice
This commit is contained in:
Matthew Bauer 2019-01-27 18:22:41 -05:00 committed by GitHub
commit d54fbbebbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,6 +558,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.
#
@ -570,7 +574,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]"