diff --git a/src/python/jw/pkg/cmds/projects/lib/pkg_relations.py b/src/python/jw/pkg/cmds/projects/lib/pkg_relations.py index 4a42b070..ac0642c7 100644 --- a/src/python/jw/pkg/cmds/projects/lib/pkg_relations.py +++ b/src/python/jw/pkg/cmds/projects/lib/pkg_relations.py @@ -30,16 +30,11 @@ def pkg_relations( if syntax == Syntax.DEBIAN: expand_semver_revision_range = True - if skip_excluded: - excluded = app.get_project_refs( - seed_pkgs, - ['build'], - 'exclude', - scope = Scope.One, - add_self = False, - names_only = True, - ) - ignore |= set(excluded) + def __is_excluded(module: str) -> bool: + # True if the module is excluded from the build on the current + # distro, i.e. if its [build] exclude list matches the distro's + # os cascade + return app.is_excluded_from_build(module) is not None log( DEBUG, @@ -55,6 +50,9 @@ def pkg_relations( closure: list[str] = [] visited: set[str] = set() for seed in seed_pkgs: + if skip_excluded and __is_excluded(seed): + # Excluded seeds are neither considered nor output + continue app.walk_project_deps( closure, visited, @@ -69,6 +67,9 @@ def pkg_relations( recurse = recursive, ) for cur_pkg in closure: + if skip_excluded and __is_excluded(cur_pkg): + # Excluded modules contribute no dependencies + continue for subsec in subsections: section = 'pkg.' + rel_type + '.' + subsec for deps_spec in app.read_dep_edges(cur_pkg, [section], flavour): @@ -81,6 +82,8 @@ def pkg_relations( if dep_name in ignore or dep.full_name in ignore: continue if subsec == 'jw': + if skip_excluded and __is_excluded(dep_name): + continue if hide_jw_pkg and dep_name == 'jw-pkg': continue expand_version_macros = subsec == 'jw'