Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Paul Barker" <paul@pbarker.dev>
To: "Tim Orling" <ticotimo@gmail.com>,
	<openembedded-core@lists.openembedded.org>
Cc: "Tim Orling" <tim.orling@konsulko.com>
Subject: Re: [PATCH v2 2/3] lib/oe/distro_check: fix the openSUSE Leap package lists
Date: Fri, 20 Nov 2026 13:48:16 +0000	[thread overview]
Message-ID: <DN03322GA5UM.38O14Q1M8OARI@pbarker.dev> (raw)
In-Reply-To: <20261116165032.1829-3-tim.orling@konsulko.com>

On Mon Nov 16, 2026 at 4:50 PM GMT, Tim Orling wrote:
> 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>
> ---
> Changes in v2: use str.removeprefix() for the "./" links
>
>  meta/lib/oe/distro_check.py                   | 27 ++++++++++++++++---
>  .../oeqa/selftest/cases/oelib/distro_check.py | 19 +++++++++++++
>  2 files changed, 42 insertions(+), 4 deletions(-)
>
> diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
> index 814b35b8d8..b5c05a6765 100644
> --- a/meta/lib/oe/distro_check.py
> +++ b/meta/lib/oe/distro_check.py
> @@ -22,7 +22,8 @@ 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('/'))
> +        # Some listings (e.g. MirrorCache) link to "./name/"
> +        hyperlinks.append(line['href'].removeprefix('./').strip('/'))
>      return hyperlinks
>  
>  def find_latest_numeric_release(url, d):
> @@ -84,12 +85,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

Hi Tim,

This has been merged to master, but I still wonder... Should this use
our vendored copy of bs4 from bitbake (bb._vendor.bs4)?

Best regards,

-- 
Paul Barker


  reply	other threads:[~2026-11-20 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 16:50 [PATCH v2 0/3] distro_check: fix the Ubuntu and openSUSE package lists, drop Clear Tim Orling
2026-11-16 16:50 ` [PATCH v2 1/3] lib/oe/distro_check: find the latest Ubuntu release from meta-release Tim Orling
2026-11-16 16:50 ` [PATCH v2 2/3] lib/oe/distro_check: fix the openSUSE Leap package lists Tim Orling
2026-11-20 13:48   ` Paul Barker [this message]
2026-11-16 16:50 ` [PATCH v2 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=DN03322GA5UM.38O14Q1M8OARI@pbarker.dev \
    --to=paul@pbarker.dev \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ticotimo@gmail.com \
    --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