@@ -127,16 +127,28 @@ def find_latest_debian_release(url, d):
return "_NotFound_"
def get_debian_style_source_package_list(url, section, d):
- "Return the list of package-names stored in the debian style Sources.gz or Sources.xz file"
+ """
+ Return the names of the source packages in a debian style Sources.gz or
+ Sources.xz file, and of the binary packages they build (e.g. Debian's
+ "brotli" builds "python3-brotli")
+ """
import gzip
import lzma
opener = lzma.open if url.endswith(".xz") else gzip.open
package_names = set()
+ field = None
for line in opener(create_socket(url, d), mode="rt"):
- if line.startswith("Package:"):
- pkg = line.split(":", 1)[1].strip()
- package_names.add(pkg + ":" + section)
+ if line[:1] in (" ", "\t"):
+ # Continuation of the previous field
+ names = line if field == "Binary" else ""
+ else:
+ field, _, value = line.partition(":")
+ names = value if field in ("Package", "Binary") else ""
+ for name in names.split(","):
+ name = name.strip()
+ if name:
+ package_names.add(name + ":" + section)
return package_names
def get_latest_released_debian_source_package_list(d):
@@ -191,7 +203,7 @@ def create_distro_packages_list(distro_check_dir, d):
except Exception as e:
bb.warn("Cannot fetch packages for %s: %s" % (name, e))
continue
- bb.note("Distro: %s, Latest Release: %s, # src packages: %d" % (name, release, len(package_list)))
+ bb.note("Distro: %s, Latest Release: %s, # packages: %d" % (name, release, len(package_list)))
if len(package_list) == 0:
bb.error("Didn't fetch any packages for %s %s" % (name, release))
@@ -52,6 +52,24 @@ Version: 99.10
Supported: 0
"""
+SOURCES_WITH_BINARIES = b"""Package: brotli
+Binary: python3-brotli, brotli, libbrotli-dev,
+ libbrotli1
+Version: 1.1.0-2
+Description: an example
+ Binary: not-a-package
+
+Package: six
+Binary: python3-six
+"""
+
+class TestDebianStyleBinaryPackages(TestCase):
+ def test_binary_packages(self):
+ with mock.patch.object(oe.distro_check, "create_socket", return_value=io.BytesIO(gzip.compress(SOURCES_WITH_BINARIES))):
+ names = oe.distro_check.get_debian_style_source_package_list("http://example.com/Sources.gz", "main", None)
+ self.assertEqual(names, {"brotli:main", "python3-brotli:main", "libbrotli-dev:main", "libbrotli1:main",
+ "six:main", "python3-six:main"})
+
class TestFindLatestUbuntuRelease(TestCase):
def test_latest_supported(self):
with mock.patch.object(oe.distro_check, "create_socket", return_value=io.BytesIO(META_RELEASE)):
Only the source package names were recorded from Debian style Sources files, but Debian names Python modules' source packages after the upstream project and their binary packages python3-<name>, as OE does, so a recipe such as python3-brotli never matched Debian's "brotli", which builds python3-brotli. Record the names in each Binary field too. Tested against Debian 13.7: 91775 names instead of 37593, 5316 of them python3-*. [YOCTO #16512] AI-Generated: Claude Opus 5.5 Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- This applies on top of "distro_check: fix the Ubuntu and openSUSE package lists, drop Clear": https://lore.kernel.org/all/20261115021914.67744-1-tim.orling@konsulko.com/ meta/lib/oe/distro_check.py | 22 ++++++++++++++----- .../oeqa/selftest/cases/oelib/distro_check.py | 18 +++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-)