Only ignore hints for the same package if arch matches

Signed-off-by: Ivo De Decker <ivodd@debian.org>
This commit is contained in:
Ivo De Decker 2019-01-01 10:28:17 +00:00
parent 7090c23efc
commit b395c6f760

View File

@ -703,29 +703,30 @@ class Britney(object):
hints = self._hint_parser.hints hints = self._hint_parser.hints
for x in ["block", "block-all", "block-udeb", "unblock", "unblock-udeb", "force", "urgent", "remove", "age-days"]: for x in ["block", "block-all", "block-udeb", "unblock", "unblock-udeb", "force", "urgent", "remove", "age-days"]:
z = {} z = defaultdict(dict)
for hint in hints[x]: for hint in hints[x]:
package = hint.package package = hint.package
architecture = hint.architecture
key = (hint, hint.user) key = (hint, hint.user)
if package in z and z[package] != key: if package in z and architecture in z[package] and z[package][architecture] != key:
hint2 = z[package][0] hint2 = z[package][architecture][0]
if x in ['unblock', 'unblock-udeb']: if x in ['unblock', 'unblock-udeb']:
if apt_pkg.version_compare(hint2.version, hint.version) < 0: if apt_pkg.version_compare(hint2.version, hint.version) < 0:
# This hint is for a newer version, so discard the old one # This hint is for a newer version, so discard the old one
self.logger.warning("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')", self.logger.warning("Overriding %s[%s] = ('%s', '%s', '%s') with ('%s', '%s', '%s')",
x, package, hint2.version, hint2.user, hint.version, hint.user) x, package, hint2.version, hint2.architecture, hint2.user, hint.version, hint.architecture, hint.user)
hint2.set_active(False) hint2.set_active(False)
else: else:
# This hint is for an older version, so ignore it in favour of the new one # This hint is for an older version, so ignore it in favour of the new one
self.logger.warning("Ignoring %s[%s] = ('%s', '%s'), ('%s', '%s') is higher or equal", self.logger.warning("Ignoring %s[%s] = ('%s', '%s', '%s'), ('%s', '%s', '%s') is higher or equal",
x, package, hint.version, hint.user, hint2.version, hint2.user) x, package, hint.version, hint.architecture, hint.user, hint2.version, hint2.architecture, hint2.user)
hint.set_active(False) hint.set_active(False)
else: else:
self.logger.warning("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')", self.logger.warning("Overriding %s[%s] = ('%s', '%s') with ('%s', '%s')",
x, package, hint2.user, hint2, hint.user, hint) x, package, hint2.user, hint2, hint.user, hint)
hint2.set_active(False) hint2.set_active(False)
z[package] = key z[package][architecture] = key
# Sanity check the hints hash # Sanity check the hints hash
if len(hints["block"]) == 0 and len(hints["block-udeb"]) == 0: if len(hints["block"]) == 0 and len(hints["block-udeb"]) == 0: