Move build checks before running policies

For future policies such as running autopkgtests it is important to know
whether a package has built, so that expensive actions such as "trigger an
autopkgtest" are not done too early/in vain.

This requires dropping the "age != 0" check for adding the out-of-date-ness to
the Excuse, as the policies now run later. But this check only applied to an
infinitesimal age, and even with age == 0 it is still a valid excuse that there
are missing binaries.

Signed-off-by: Niels Thykier <niels@thykier.net>
email-direct-upload-sponsor
Martin Pitt 8 years ago committed by Niels Thykier
parent 9cfe9d1072
commit 7ded1c85db

@ -1525,6 +1525,86 @@ class Britney(object):
excuse.addreason("block")
update_candidate = False
# at this point, we check the status of the builds on all the supported architectures
# to catch the out-of-date ones
pkgs = {src: ["source"]}
all_binaries = self.all_binaries
for arch in self.options.architectures:
oodbins = {}
uptodatebins = False
# for every binary package produced by this source in the suite for this architecture
for pkg_id in sorted(x for x in source_u.binaries if x.architecture == arch):
pkg = pkg_id.package_name
if pkg not in pkgs: pkgs[pkg] = []
pkgs[pkg].append(arch)
# retrieve the binary package and its source version
binary_u = all_binaries[pkg_id]
pkgsv = binary_u.source_version
# if it wasn't built by the same source, it is out-of-date
# if there is at least one binary on this arch which is
# up-to-date, there is a build on this arch
if source_u.version != pkgsv:
if pkgsv not in oodbins:
oodbins[pkgsv] = []
oodbins[pkgsv].append(pkg)
excuse.add_old_binary(pkg, pkgsv)
continue
else:
# if the binary is arch all, it doesn't count as
# up-to-date for this arch
if binary_u.architecture == arch:
uptodatebins = True
# if the package is architecture-dependent or the current arch is `nobreakall'
# find unsatisfied dependencies for the binary package
if binary_u.architecture != 'all' or arch in self.options.nobreakall_arches:
is_valid = self.excuse_unsat_deps(pkg, src, arch, suite, excuse)
if not is_valid and not source_t:
update_candidate = False
# if there are out-of-date packages, warn about them in the excuse and set update_candidate
# to False to block the update; if the architecture where the package is out-of-date is
# in the `outofsync_arches' list, then do not block the update
if oodbins:
oodtxt = ""
for v in oodbins.keys():
if oodtxt: oodtxt = oodtxt + "; "
oodtxt = oodtxt + "%s (from <a href=\"https://buildd.debian.org/status/logs.php?" \
"arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>)" % \
(", ".join(sorted(oodbins[v])), quote(arch), quote(src), quote(v), v)
if uptodatebins:
text = "old binaries left on <a href=\"https://buildd.debian.org/status/logs.php?" \
"arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>: %s" % \
(quote(arch), quote(src), quote(source_u.version), arch, oodtxt)
else:
text = "missing build on <a href=\"https://buildd.debian.org/status/logs.php?" \
"arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>: %s" % \
(quote(arch), quote(src), quote(source_u.version), arch, oodtxt)
if arch in self.options.outofsync_arches:
text = text + " (but %s isn't keeping up, so nevermind)" % (arch)
if not uptodatebins:
excuse.missing_build_on_ood_arch(arch)
else:
if uptodatebins:
if self.options.ignore_cruft:
text = text + " (but ignoring cruft, so nevermind)"
else:
update_candidate = False
else:
update_candidate = False
excuse.missing_build_on_arch(arch)
excuse.addhtml(text)
# if the source package has no binaries, set update_candidate to False to block the update
if not source_u.binaries:
excuse.addhtml("%s has no binaries on any arch" % src)
excuse.addreason("no-binaries")
update_candidate = False
# if the suite is unstable, then we have to check the urgency and the minimum days of
# permanence in unstable before updating testing; if the source package is too young,
# the check fails and we set update_candidate to False to block the update; consider
@ -1581,8 +1661,6 @@ class Britney(object):
excuse.addhtml("%s introduces new bugs, so still ignored (even "
"though it fixes more than it introduces, whine at debian-release)" % src)
all_binaries = self.all_binaries
if suite in ('pu', 'tpu') and source_t:
# o-o-d(ish) checks for (t-)p-u
# This only makes sense if the package is actually in testing.
@ -1617,87 +1695,6 @@ class Britney(object):
excuse.addhtml(text)
# at this point, we check the status of the builds on all the supported architectures
# to catch the out-of-date ones
pkgs = {src: ["source"]}
for arch in self.options.architectures:
oodbins = {}
uptodatebins = False
# for every binary package produced by this source in the suite for this architecture
for pkg_id in sorted(x for x in source_u.binaries if x.architecture == arch):
pkg = pkg_id.package_name
if pkg not in pkgs: pkgs[pkg] = []
pkgs[pkg].append(arch)
# retrieve the binary package and its source version
binary_u = all_binaries[pkg_id]
pkgsv = binary_u.source_version
# if it wasn't built by the same source, it is out-of-date
# if there is at least one binary on this arch which is
# up-to-date, there is a build on this arch
if source_u.version != pkgsv:
if pkgsv not in oodbins:
oodbins[pkgsv] = []
oodbins[pkgsv].append(pkg)
excuse.add_old_binary(pkg, pkgsv)
continue
else:
# if the binary is arch all, it doesn't count as
# up-to-date for this arch
if binary_u.architecture == arch:
uptodatebins = True
# if the package is architecture-dependent or the current arch is `nobreakall'
# find unsatisfied dependencies for the binary package
if binary_u.architecture != 'all' or arch in self.options.nobreakall_arches:
is_valid = self.excuse_unsat_deps(pkg, src, arch, suite, excuse)
if not is_valid and not source_t:
update_candidate = False
# if there are out-of-date packages, warn about them in the excuse and set update_candidate
# to False to block the update; if the architecture where the package is out-of-date is
# in the `outofsync_arches' list, then do not block the update
if oodbins:
oodtxt = ""
for v in oodbins.keys():
if oodtxt: oodtxt = oodtxt + "; "
oodtxt = oodtxt + "%s (from <a href=\"https://buildd.debian.org/status/logs.php?" \
"arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>)" % \
(", ".join(sorted(oodbins[v])), quote(arch), quote(src), quote(v), v)
if uptodatebins:
text = "old binaries left on <a href=\"https://buildd.debian.org/status/logs.php?" \
"arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>: %s" % \
(quote(arch), quote(src), quote(source_u.version), arch, oodtxt)
else:
text = "missing build on <a href=\"https://buildd.debian.org/status/logs.php?" \
"arch=%s&pkg=%s&ver=%s\" target=\"_blank\">%s</a>: %s" % \
(quote(arch), quote(src), quote(source_u.version), arch, oodtxt)
if arch in self.options.outofsync_arches:
text = text + " (but %s isn't keeping up, so nevermind)" % (arch)
if not uptodatebins:
excuse.missing_build_on_ood_arch(arch)
else:
if uptodatebins:
if self.options.ignore_cruft:
text = text + " (but ignoring cruft, so nevermind)"
else:
update_candidate = False
else:
update_candidate = False
excuse.missing_build_on_arch(arch)
if 'age' in policy_info and (policy_info['age']['current-age'] or
not policy_info['age']['age-requirement']):
excuse.addhtml(text)
# if the source package has no binaries, set update_candidate to False to block the update
if not source_u.binaries:
excuse.addhtml("%s has no binaries on any arch" % src)
excuse.addreason("no-binaries")
update_candidate = False
# check if there is a `force' hint for this package, which allows it to go in even if it is not updateable
forces = self.hints.search('force', package=src, version=source_u.version)
if forces:

Loading…
Cancel
Save