From 0d5c4a24c47055319d1df5cfc0890e1b82082c47 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Wed, 8 Aug 2018 13:42:33 +0000 Subject: [PATCH] Handle Build-Depends-Indep in excuses Admittedly, no policy adds them yet so this is currently no-op code. However, future commits can start to rely on this infrastructure code. Signed-off-by: Niels Thykier --- britney2/excuse.py | 23 ++++++++++++++++++++--- britney2/utils.py | 17 +++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/britney2/excuse.py b/britney2/excuse.py index 59918a5..36dd32d 100644 --- a/britney2/excuse.py +++ b/britney2/excuse.py @@ -78,6 +78,7 @@ class Excuse(object): self.invalid_build_deps = set() self.deps = {} self.arch_build_deps = {} + self.indep_build_deps = {} self.sane_deps = [] self.break_deps = [] self.unsatisfiable_on_archs = [] @@ -152,6 +153,11 @@ class Excuse(object): self.arch_build_deps[name] = [] self.arch_build_deps[name].append(arch) + def add_indep_build_dep(self, name, arch): + if name not in self.indep_build_deps: + self.indep_build_deps[name] = [] + self.indep_build_deps[name].append(arch) + def add_unsatisfiable_dep(self, signature, arch): """Add an unsatisfiable dependency""" self.unsat_deps[arch].add(signature) @@ -245,6 +251,16 @@ class Excuse(object): else: res = res + "
  • Build-Depends(-Arch): %s %s\n" % (self.name, dep, dep) + for x in sorted(self.indep_build_deps, key=lambda x: x.split('/')[0]): + dep = x.split('/')[0] + if dep == lastdep: + continue + lastdep = dep + if x in self.invalid_build_deps: + res = res + "
  • Build-Depends-Indep: %s %s (not ready)\n" % (self.name, dep, dep) + else: + res = res + "
  • Build-Depends-Indep: %s %s\n" % (self.name, dep, dep) + res = res + "\n" return res @@ -292,10 +308,11 @@ class Excuse(object): 'on-architectures': sorted(self.missing_builds), 'on-unimportant-architectures': sorted(self.missing_builds_ood_arch), } - if self.deps or self.invalid_deps or self.arch_build_deps or self.invalid_build_deps or self.break_deps or self.unsat_deps: + if self.deps or self.invalid_deps or self.arch_build_deps or self.indep_build_deps \ + or self.invalid_build_deps or self.break_deps or self.unsat_deps: excusedata['dependencies'] = dep_data = {} - migrate_after = sorted((self.deps.keys() - self.invalid_deps) - | (self.arch_build_deps.keys() - self.invalid_build_deps)) + migrate_after_bd = (self.arch_build_deps.keys() | self.indep_build_deps.keys()) - self.invalid_build_deps + migrate_after = sorted((self.deps.keys() - self.invalid_deps) | migrate_after_bd) break_deps = [x for x, _ in self.break_deps if x not in self.deps] if self.invalid_deps or self.invalid_build_deps: diff --git a/britney2/utils.py b/britney2/utils.py index 92d071f..5128a79 100644 --- a/britney2/utils.py +++ b/britney2/utils.py @@ -834,11 +834,14 @@ def invalidate_excuses(excuses, valid, invalid): # build the reverse dependencies revdeps = defaultdict(list) revbuilddeps = defaultdict(list) + revindepbuilddeps = defaultdict(list) for exc in excuses.values(): for d in exc.deps: revdeps[d].append(exc.name) for d in exc.arch_build_deps: revbuilddeps[d].append(exc.name) + for d in exc.indep_build_deps: + revindepbuilddeps[d].append(exc.name) # loop on the invalid excuses for ename in iter_except(invalid.pop, KeyError): @@ -883,6 +886,20 @@ def invalidate_excuses(excuses, valid, invalid): if excuses[x].policy_verdict.value < rdep_verdict.value: excuses[x].policy_verdict = rdep_verdict + if ename in revindepbuilddeps: + for x in revindepbuilddeps[ename]: + # if the item is valid and it is not marked as `forced', then we invalidate it + if x in valid and not excuses[x].forced: + + # otherwise, invalidate the dependency and mark as invalidated and + # remove the depending excuses + excuses[x].invalidate_build_dep(ename) + valid.discard(x) + invalid.add(x) + excuses[x].addhtml("Invalidated by build-dependency (indep)") + if excuses[x].policy_verdict.value < rdep_verdict.value: + excuses[x].policy_verdict = rdep_verdict + def compile_nuninst(binaries_t, inst_tester, architectures, nobreakall_arches): """Compile a nuninst dict from the current testing