From 418a9db9f935da779a49d95c3d1840de9212b096 Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Wed, 3 Aug 2011 20:53:38 +0000 Subject: [PATCH] Avoid marking more valid excuses as impossible. Previously we could not reliably detect whether an excuse's dependency from a source package to a binNMU was valid, as the excuse did not contain sufficient information to determine the set of architecture(s) on which the dependency existed. By modifying the representation of the dependency list in the excuse to include an architecture list we can walk the relationships in reverse in order to sanity-check the source -> binNMU dependency. Signed-off-by: Adam D. Barratt --- britney.py | 19 +++++++++++++++++-- excuse.py | 7 ++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/britney.py b/britney.py index 3c3a92f..46d90e5 100755 --- a/britney.py +++ b/britney.py @@ -1049,7 +1049,7 @@ class Britney: # for the solving packages, update the excuse to add the dependencies for p in packages: if arch not in self.options.break_arches.split(): - excuse.add_dep(p) + excuse.add_dep(p, arch) else: excuse.add_break_dep(p, arch) @@ -1601,14 +1601,29 @@ class Britney: parts = e.name.split('/') for d in e.deps: ok = False + # source -> source dependency; both packages must have + # valid excuses if d in upgrade_me or d in unconsidered: ok = True # if the excuse is for a binNMU, also consider d/$arch as a # valid excuse - if len(parts) == 2: + elif len(parts) == 2: bd = '%s/%s' % (d, parts[1]) if bd in upgrade_me or bd in unconsidered: ok = True + # if the excuse is for a source package, check each of the + # architectures on which the excuse lists a dependency on d, + # and consider the excuse valid if it is possible on each + # architecture + else: + arch_ok = True + for arch in e.deps[d]: + bd = '%s/%s' % (d, arch) + if bd not in upgrade_me and bd not in unconsidered: + arch_ok = False + break + if arch_ok: + ok = True if not ok: e.addhtml("Impossible dependency: %s -> %s" % (e.name, d)) self.invalidate_excuses(upgrade_me, unconsidered) diff --git a/excuse.py b/excuse.py index c750547..f5021d8 100644 --- a/excuse.py +++ b/excuse.py @@ -53,7 +53,7 @@ class Excuse: self.dontinvalidate = 0 self.invalid_deps = [] - self.deps = [] + self.deps = {} self.sane_deps = [] self.break_deps = [] self.unsat_deps = {} @@ -85,9 +85,10 @@ class Excuse: """Set the urgency of upload of the package""" self.urgency = date - def add_dep(self, name): + def add_dep(self, name, arch): """Add a dependency""" - if name not in self.deps: self.deps.append(name) + if name not in self.deps: self.deps[name]=[] + self.deps[name].append(arch) def add_sane_dep(self, name): """Add a sane dependency"""