repos.BuildReporter: Option to ignore file dependencies

This turns out to be useful when may reports are
analized automatically.
This commit is contained in:
Ivan A. Melnikov 2023-12-13 14:09:04 +04:00
parent 333310dc9b
commit 573c9ae458

View File

@ -435,12 +435,15 @@ def _is_build_kind(kind):
class BuildReporter:
def __init__(self, from_repo, to_repo, ignore=(), prefer=(), caching=True):
def __init__(self, from_repo, to_repo,
ignore=(), prefer=(),
caching=True, ignore_file_deps=False):
self.from_repo = from_repo
self.to_repo = to_repo
self.ignore = ignore
self.prefer = prefer
self._cache = {} if caching else None
self.ignore_file_deps = ignore_file_deps
self._warned_on = set()
def _warn(self, text, subject):
@ -506,6 +509,10 @@ class BuildReporter:
# skip some platform-specific stuff
if any(x in dep.name for x in _SPECIAL_DEPS):
continue
# ignore file dependencies if we're asked to
if self.ignore_file_deps and not _is_build_kind(kind):
if dep.name.startswith(b'/'):
continue
# skip dependencies already present in to_repo
if any(self.to_repo.providers(dep)):
continue