From: Tim Orling <ticotimo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Tim Orling <tim.orling@konsulko.com>
Subject: [PATCH 2/3] lib/oe/distro_check: fix the openSUSE Leap package lists
Date: Sat, 14 Nov 2026 18:19:13 -0800 [thread overview]
Message-ID: <20261115021914.67744-3-tim.orling@konsulko.com> (raw)
In-Reply-To: <20261115021914.67744-1-tim.orling@konsulko.com>
download.opensuse.org's listings now link to "./15.6/", which
find_latest_numeric_release() couldn't parse, so the Leap URLs had an
empty release and failed with HTTP 404. Accept "./" links, ignore Leap
42.x (which came before 15.0), read the source RPMs from repo/oss/src/,
where they now are, and allow for there being no update repository, as
for Leap 16.
Tested against download.opensuse.org: Leap 16.1 is fetched again.
[YOCTO #16510]
AI-Generated: Claude Opus 5.5
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
meta/lib/oe/distro_check.py | 30 ++++++++++++++++---
.../oeqa/selftest/cases/oelib/distro_check.py | 19 ++++++++++++
2 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index 814b35b8d8..e37599c5d9 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -22,7 +22,11 @@ def get_links_from_url(url, d):
soup = BeautifulSoup(create_socket(url,d), "html.parser", parse_only=SoupStrainer("a"))
hyperlinks = []
for line in soup.find_all('a', href=True):
- hyperlinks.append(line['href'].strip('/'))
+ href = line['href']
+ # Some listings (e.g. MirrorCache) link to "./name/"
+ if href.startswith('./'):
+ href = href[2:]
+ hyperlinks.append(href.strip('/'))
return hyperlinks
def find_latest_numeric_release(url, d):
@@ -84,12 +88,30 @@ def get_latest_released_fedora_source_package_list(d):
package_names |= get_source_package_list_from_url_by_letter("http://archive.fedoraproject.org/pub/fedora/linux/updates/%s/SRPMS/" % latest, "updates", d)
return latest, package_names
+def find_latest_opensuse_leap_release(url, d):
+ "Find the latest Leap release on the given url, ignoring Leap 42.x, which came before 15.0"
+ releases = []
+ for link in get_links_from_url(url, d):
+ try:
+ version = tuple(int(n) for n in link.split("."))
+ except ValueError:
+ continue
+ if version[0] != 42:
+ releases.append((version, link))
+ return max(releases)[1] if releases else "_NotFound_"
+
def get_latest_released_opensuse_source_package_list(d):
"Returns list of all the name os packages in the latest opensuse distro"
- latest = find_latest_numeric_release("http://download.opensuse.org/source/distribution/leap", d)
+ from urllib.error import HTTPError
+ latest = find_latest_opensuse_leap_release("http://download.opensuse.org/source/distribution/leap/", d)
- package_names = get_source_package_list_from_url("http://download.opensuse.org/source/distribution/leap/%s/repo/oss/suse/src/" % latest, "main", d)
- package_names |= get_source_package_list_from_url("http://download.opensuse.org/update/leap/%s/oss/src/" % latest, "updates", d)
+ package_names = get_source_package_list_from_url("http://download.opensuse.org/source/distribution/leap/%s/repo/oss/src/" % latest, "main", d)
+ # Leap 16 has no separate update repository
+ try:
+ package_names |= get_source_package_list_from_url("http://download.opensuse.org/update/leap/%s/oss/src/" % latest, "updates", d)
+ except HTTPError as e:
+ if e.code != 404:
+ raise
return latest, package_names
def get_latest_released_clear_source_package_list(d):
diff --git a/meta/lib/oeqa/selftest/cases/oelib/distro_check.py b/meta/lib/oeqa/selftest/cases/oelib/distro_check.py
index 7545fa0c42..7add8d70f9 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/distro_check.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/distro_check.py
@@ -57,6 +57,25 @@ 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 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>"""
+
+ def test_links_relative_to_current_directory(self):
+ try:
+ from bs4 import BeautifulSoup, SoupStrainer
+ except ImportError:
+ self.skipTest("bs4 is not available")
+ with mock.patch.object(oe.distro_check, "create_socket", return_value=io.BytesIO(self.LISTING)):
+ links = oe.distro_check.get_links_from_url("http://example.com/leap/", None)
+ self.assertEqual(links, ["..", "15.0-Current", "15.6", "16.0", "42.3"])
+
+ def test_latest_leap_release(self):
+ # Leap 42.x came before 15.0
+ links = ["..", "15.0-Current", "15.6", "16.0", "16.1", "42.2", "42.3", "42.3-Current"]
+ with mock.patch.object(oe.distro_check, "get_links_from_url", return_value=links):
+ self.assertEqual(oe.distro_check.find_latest_opensuse_leap_release("http://example.com/leap/", None), "16.1")
+
class TestCreateDistroPackagesList(TestCase):
def test_skip_failed_distro(self):
"""
--
2.56.1
next prev parent reply other threads:[~2026-11-15 2:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 2:19 [PATCH 0/3] distro_check: fix the Ubuntu and openSUSE package lists, drop Clear Tim Orling
2026-11-15 2:19 ` [PATCH 1/3] lib/oe/distro_check: find the latest Ubuntu release from meta-release Tim Orling
2026-11-15 2:19 ` Tim Orling [this message]
2026-11-16 15:01 ` [OE-core] [PATCH 2/3] lib/oe/distro_check: fix the openSUSE Leap package lists Richard Purdie
2026-11-15 2:19 ` [PATCH 3/3] lib/oe/distro_check: drop Clear Linux Tim Orling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115021914.67744-3-tim.orling@konsulko.com \
--to=ticotimo@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=tim.orling@konsulko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox