Skip to contentSkip to conversation

lib/oe/distro_check: also list Ubuntu's universe packages

PATCH New Tim Orling 1 participant 1 message Nov 22

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

PATCH 1/1 lib/oe/distro_check: also list Ubuntu's universe packages

Only main was read, which in Ubuntu holds just the ~2,400 packages Canonical supports, so recipes for packages in universe (e.g. nasm) never matched Ubuntu although the same packages match Debian's main. Read universe as well, from the release and from -updates. The list for Ubuntu 26.04 (resolute) grows from 3,059 to 40,556 names.

Tested with a new oelib selftest and by fetching the Ubuntu 26.04 lists.

AI-Generated: Claude Opus 5.5

---
 meta/lib/oe/distro_check.py                   | 13 ++++++----
 .../oeqa/selftest/cases/oelib/distro_check.py | 24 +++++++++++++++++++
 2 files changed, 33 insertions(+), 4 deletions(-)
meta/lib/oe/distro_check.py +9 -4
index d8e487318c..d83652b487 100644
@@ -164,10 +164,15 @@ def find_latest_ubuntu_release(d):
 def get_latest_released_ubuntu_source_package_list(d):
     "Returns list of all the name os packages in the latest ubuntu distro"
     latest = find_latest_ubuntu_release(d)
-    url = "http://archive.ubuntu.com/ubuntu/dists/%s/main/source/Sources.gz" % latest
-    package_names = get_debian_style_source_package_list(url, "main", d)
-    url = "http://archive.ubuntu.com/ubuntu/dists/%s-updates/main/source/Sources.gz" % latest
-    package_names |= get_debian_style_source_package_list(url, "updates", d)
+    # Ubuntu's main only holds the packages Canonical supports; most of
+    # what Debian has in main is in Ubuntu's universe.
+    # (AI-generated: Claude Opus 5.5)
+    package_names = set()
+    for component in ("main", "universe"):
+        url = "http://archive.ubuntu.com/ubuntu/dists/%s/%s/source/Sources.gz" % (latest, component)
+        package_names |= get_debian_style_source_package_list(url, component, d)
+        url = "http://archive.ubuntu.com/ubuntu/dists/%s-updates/%s/source/Sources.gz" % (latest, component)
+        package_names |= get_debian_style_source_package_list(url, "updates", d)
     return latest, package_names
 
 def create_distro_packages_list(distro_check_dir, d):
meta/lib/oeqa/selftest/cases/oelib/distro_check.py +24 -0
index d783384251..a27be60c42 100644
@@ -57,6 +57,30 @@ class TestFindLatestUbuntuRelease(TestCase):
         with mock.patch.object(oe.distro_check, "create_socket", return_value=io.BytesIO(META_RELEASE)):
             self.assertEqual(oe.distro_check.find_latest_ubuntu_release(None), "resolute")
 
+class TestUbuntuPackageList(TestCase):
+    def test_main_and_universe(self):
+        """
+        The Ubuntu list has the packages in universe as well as main, from
+        the release and from its updates.
+        """
+        sources = {
+            "resolute/main": b"Package: bash\n",
+            "resolute/universe": b"Package: nasm\n",
+            "resolute-updates/main": b"Package: openssl\n",
+            "resolute-updates/universe": b"Package: nginx\n",
+        }
+
+        def fake_socket(url, d):
+            dist, component = url.split("/dists/")[1].split("/")[:2]
+            return io.BytesIO(gzip.compress(sources[dist + "/" + component]))
+
+        with mock.patch.object(oe.distro_check, "find_latest_ubuntu_release", return_value="resolute"), \
+                mock.patch.object(oe.distro_check, "create_socket", side_effect=fake_socket):
+            latest, names = oe.distro_check.get_latest_released_ubuntu_source_package_list(None)
+
+        self.assertEqual(latest, "resolute")
+        self.assertEqual(names, {"bash:main", "nasm:universe", "openssl:updates", "nginx:updates"})
+
 class TestOpenSUSE(TestCase):
     LISTING = b"""<a href="../">..</a> <a href="./15.0-Current/">15.0-Current/</a>
 <a href="./15.6/">15.6/</a> <a href="./16.0/">16.0/</a> <a href="./42.3/">42.3/</a>"""
Signature · 1 line
2.47.3