summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-03-14 14:34:56 +0100
committerGitHub <noreply@github.com>2023-03-14 14:34:56 +0100
commit40019dacd9a9c52fac7598e70a4268cf2dc39699 (patch)
tree301695b0dd19bc581bdeed8e3742cd75256a14b7 /lib
parent5c48304d07063d66fc78db2af41c0f45f85cfae4 (diff)
downloadspack-40019dacd9a9c52fac7598e70a4268cf2dc39699.tar.gz
spack-40019dacd9a9c52fac7598e70a4268cf2dc39699.tar.bz2
spack-40019dacd9a9c52fac7598e70a4268cf2dc39699.tar.xz
spack-40019dacd9a9c52fac7598e70a4268cf2dc39699.zip
Use bfs in get_spec_filter_list (#36093)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/ci.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py
index 004dc52a4e..68577d82bd 100644
--- a/lib/spack/spack/ci.py
+++ b/lib/spack/spack/ci.py
@@ -38,6 +38,7 @@ import spack.util.gpg as gpg_util
import spack.util.spack_yaml as syaml
import spack.util.url as url_util
import spack.util.web as web_util
+from spack import traverse
from spack.error import SpackError
from spack.reporters import CDash, CDashConfiguration
from spack.reporters.cdash import build_stamp as cdash_build_stamp
@@ -471,15 +472,16 @@ def get_spec_filter_list(env, affected_pkgs, dependent_traverse_depth=None):
tty.debug("All concrete environment specs:")
for s in all_concrete_specs:
tty.debug(" {0}/{1}".format(s.name, s.dag_hash()[:7]))
- env_matches = [s for s in all_concrete_specs if s.name in frozenset(affected_pkgs)]
+ affected_pkgs = frozenset(affected_pkgs)
+ env_matches = [s for s in all_concrete_specs if s.name in affected_pkgs]
visited = set()
dag_hash = lambda s: s.dag_hash()
- for match in env_matches:
- for dep_level, parent in match.traverse(direction="parents", key=dag_hash, depth=True):
- if dependent_traverse_depth is None or dep_level <= dependent_traverse_depth:
- affected_specs.update(
- parent.traverse(direction="children", visited=visited, key=dag_hash)
- )
+ for depth, parent in traverse.traverse_nodes(
+ env_matches, direction="parents", key=dag_hash, depth=True, order="breadth"
+ ):
+ if dependent_traverse_depth is not None and depth > dependent_traverse_depth:
+ break
+ affected_specs.update(parent.traverse(direction="children", visited=visited, key=dag_hash))
return affected_specs