From a5185e461226d671fe92744e6fe37f4239dd8149 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Wed, 10 Jan 2024 20:03:44 -0600 Subject: [PATCH] Add proper support for virtual packages in check-mir, basing the determination solely off of binary packages. This is not expected to be a typical case. --- check-mir | 37 ++++++++++++++++++++++++++++++++++--- debian/changelog | 3 +++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/check-mir b/check-mir index 2d48b62..95dd614 100755 --- a/check-mir +++ b/check-mir @@ -47,10 +47,41 @@ def check_support(apt_cache, pkgname, alt=False): else: prefix = " * " + pkgname - try: + prov_packages = apt_cache.get_providing_packages(pkgname) + if pkgname in apt_cache: pkg = apt_cache[pkgname] - except KeyError: - print(prefix, "does not exist (pure virtual?)", file=sys.stderr) + + # If this is a virtual package, iterate through the binary packages that + # provide this, and ensure they are all in Main. Source packages in and of + # themselves cannot provide virtual packages, only binary packages can. + elif len(prov_packages) > 0: + supported, unsupported = [], [] + for pkg in prov_packages: + candidate = pkg.candidate + if candidate: + section = candidate.section + if section.startswith("universe") or section.startswith("multiverse"): + unsupported.append(pkg.name) + else: + supported.append(pkg.name) + + if len(supported) > 0: + msg = "is a virtual package, which is provided by the following " + msg += "candidates in Main: " + " ".join(supported) + print(prefix, msg) + elif len(unsupported) > 0: + msg = "is a virtual package, but is only provided by the " + msg += "following non-Main candidates: " + " ".join(unsupported) + print(prefix, msg, file=sys.stderr) + return False + else: + msg = "is a virtual package that exists but is not provided by " + msg += "package currently in the archive. Proceed with caution." + print(prefix, msg, file=sys.stderr) + return False + + else: + print(prefix, "does not exist", file=sys.stderr) return False section = pkg.candidate.section diff --git a/debian/changelog b/debian/changelog index 9b37c2c..d1a2e1b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ ubuntu-dev-tools (0.198) UNRELEASED; urgency=medium * In check-mir, ignore debhelper-compat when checking the build dependencies. This is expected to be a build dependency of all packages, so warning about it in any way is surely a red herring. + * Add proper support for virtual packages in check-mir, basing the + determination solely off of binary packages. This is not expected to be a + typical case. -- Simon Quigley Wed, 10 Jan 2024 18:54:07 -0600