From patchwork Thu Feb 12 08:37:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonin Godard X-Patchwork-Id: 80958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 629E0EB5955 for ; Thu, 12 Feb 2026 08:37:53 +0000 (UTC) Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.41235.1770885470796669453 for ; Thu, 12 Feb 2026 00:37:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=dkim header.b=WoJ4NucA; spf=pass (domain: bootlin.com, ip: 185.246.84.56, mailfrom: antonin.godard@bootlin.com) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id AB6DA1A0E45 for ; Thu, 12 Feb 2026 08:37:48 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 805C3606CD for ; Thu, 12 Feb 2026 08:37:48 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BAF60119714CA; Thu, 12 Feb 2026 09:37:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770885468; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Hbvf0RrJRvC1xC7VdheEGcI7Qux1MGlEs09NKFn6w4Q=; b=WoJ4NucAoC0+rzjwRzsQnbE+8SCwhj9MJkQmMAE6GslWwMULl9nq2C5MU1QDWVtJWW5X7X oKsimrEMgxJVdkd5/hnSDVWH3owocNOhEVm7a4Bgv47PIYMUQswTpS13AMKpDc8+a+EaOl UvYhTRIgze0Cj2oYdSdqYAAO4RMvDQftxX4H7PytX5cWWlgq+g5JQdApqRX/Pz31Y1jwPy ZLfo6X1Oe1fkx+ek4l0PmqsP4Mpu3dWUMx5RCdgdTwplT+X8OMUhp0mhb2BvNKE6P52K4G kb+LKSjpcORTK3jg3vddNlOxg/VBvUmSbl0M/F6zL3iwnySF46sBzIlfO71deQ== From: Antonin Godard Date: Thu, 12 Feb 2026 09:37:37 +0100 Subject: [PATCH 1/3] set_versions.py: remove duplicate and unneeded logic MIME-Version: 1.0 Message-Id: <20260212-fix-switchers-js-v1-1-16d95c74c328@bootlin.com> References: <20260212-fix-switchers-js-v1-0-16d95c74c328@bootlin.com> In-Reply-To: <20260212-fix-switchers-js-v1-0-16d95c74c328@bootlin.com> To: docs@lists.yoctoproject.org Cc: Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1489; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=vZmbq5yDgAJ1gmJNSkscYOjbrXVCeZw+nprfmbRvRNg=; b=owEBbQKS/ZANAwAKAdGAQUApo6g2AcsmYgBpjZFas52It2GemMgluojOC5xszSQ/XO5lp5Sqn LLDp8/nk4WJAjMEAAEKAB0WIQSGSHJRiN1AG7mg0//RgEFAKaOoNgUCaY2RWgAKCRDRgEFAKaOo NiXyEACgJCmisR3kKDf4p5Ds+rPOkc6Hs1TEqN2I97NcSYhEeqB7LsqVGh68OSqEULWBN7LCbBZ cdyDjnesS8llHuu6nCoq+qy4HlnUv8sFOLwFTBZHyWBWqT8ogFyOnJZq5LQmSK41nv9HoIhlnbc Q+9OlyaBfePiI/11MhAm8w6RybHlchXad7WpOCZIZMeY3tUvKmLWyLwT+avV7qg/4u6DNEwC9fL zyYo1wyI9FFEYjzeWEkJ+GuDkxy2vlQ8zcGUrVkzP0Z83qEADZ732aRLQBL7P453ImcUUk5SnOO /b9jiEFEGcmWz8CSF2SuBlBisL0gdGtwplAv37MzV8JSj9q2BhamM/S/LMbAvBMg7d6defZnYwD 2lpGGMyx0OIQVNXFrddZURbuaf2A4AQtAgnyLQcSu6UzaCZIpf76aII1SiSJxjhOu84SguyXCgo Nwu4IicpwNS5iamNdNKbwaUyAVRGpB/SkGn0U7t2eZEhPhNPC3rCsOWd8q9fljmr75fzS7WlUmP m1ZKNcJUCfdrU/sN5GD5kkO/gb4W/r5fp0BOY0l5RnZBIVUoQ0QX8S3rHEm2VshurSFS7+MF7G3 oyM8tc+cCQwBPScM69aDKaKkqM9OpSenE/Q7SAXLW7eTUPFONu5Fz1LWdTjxZQZ86WU6vOXHhi9 3ycp4qc0QatOkNg== X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-Last-TLS-Session-Version: TLSv1.3 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 12 Feb 2026 08:37:53 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/8896 The following commit will make it unneeded to pass the version to the script directly, as it will be automatically deduced no matter which branch we're on. We can therefore the ourversion assignment. We still want the "getlatest" special argument, so read it from sys.argv directly. Add a comment mentioning that the order here is important for getlatest to work. Signed-off-by: Antonin Godard --- documentation/set_versions.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 78d0518c1..64b58f103 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -18,20 +18,13 @@ import os import itertools import re -ourversion = None -if len(sys.argv) == 2: - ourversion = sys.argv[1] - -ourversion = None -if len(sys.argv) == 2: - ourversion = sys.argv[1] - +# Order matters: most recent to least recent activereleases = ["whinlatter", "scarthgap", "kirkstone"] devbranch = "wrynose" ltsseries = ["wrynose", "scarthgap", "kirkstone"] # used by run-docs-builds to get the default page -if ourversion == "getlatest": +if len(sys.argv) > 1 and sys.argv[1] == "getlatest": print(activereleases[0]) sys.exit(0) @@ -96,6 +89,7 @@ poky_mapping = { "3.1" : "23.0", } +ourversion = None ourseries = None ourbranch = None bitbakeversion = None From patchwork Thu Feb 12 08:37:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonin Godard X-Patchwork-Id: 80957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13314EDF05F for ; Thu, 12 Feb 2026 08:37:53 +0000 (UTC) Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.41236.1770885471338613510 for ; Thu, 12 Feb 2026 00:37:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=dkim header.b=qqO4t8wi; spf=pass (domain: bootlin.com, ip: 185.246.85.4, mailfrom: antonin.godard@bootlin.com) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5F9E64E40CB4 for ; Thu, 12 Feb 2026 08:37:49 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 35D8C606CA for ; Thu, 12 Feb 2026 08:37:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 50A51119711E9; Thu, 12 Feb 2026 09:37:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770885468; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=DghCAD5tew4yvXmtPXmD3dyYDN+Iz4Qrjk2H/HHgKZo=; b=qqO4t8wipe4PCDXxakXGb8pUOMXHlZrc5ahkWMtPlMNecWd44mOSiJ+B5pkz14xE8KAQOs IQlCmRUd29gmc6X/DMrLNc/yTlsfK/gVJC3RoF86WNIKvRVAF5C2Qr/y90VR92xrb4G5qD 4OzJ7719HoorqZTYiE51lgCbHc47odiVzYQrg5mpXOJKX46C9pBy4kEfTMDq5q3XfeSlPo 5e2UXFYiPd+FVZusvfTcYY6YKDqEPz0HVK+rP4xFxqHx13GDkp+FvpnApxEunh+Em7un1d 0U+q/ZXHleHYZuTijwYMaVqij4MoQZ8eiS+UMqaJE0bUzsFlN1HjIoj5pfNk/Q== From: Antonin Godard Date: Thu, 12 Feb 2026 09:37:38 +0100 Subject: [PATCH 2/3] switchers.js: rework the logic and improve it MIME-Version: 1.0 Message-Id: <20260212-fix-switchers-js-v1-2-16d95c74c328@bootlin.com> References: <20260212-fix-switchers-js-v1-0-16d95c74c328@bootlin.com> In-Reply-To: <20260212-fix-switchers-js-v1-0-16d95c74c328@bootlin.com> To: docs@lists.yoctoproject.org Cc: Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=19710; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=JCRU8SaX5vCASzk3+YwiAoJDWIuxOienneyaZKfePLs=; b=owEBbQKS/ZANAwAKAdGAQUApo6g2AcsmYgBpjZFanYHJdKKZnW1zbDdKLHr+k41+e2LrdJECb /gcmslyXLiJAjMEAAEKAB0WIQSGSHJRiN1AG7mg0//RgEFAKaOoNgUCaY2RWgAKCRDRgEFAKaOo NkUED/9gWXB4ykZluJIR5vJJdBooafj4caKTjEB7E8LxYuiv0+y5RH0B15VUIRUMOqA05X0EUiz QvSVmrY7Tt1QCa3IWAP1K8xHBO4AMyKgc6i2/3rbPd207Lv8WYsn63mz0Bq3Noo4R9VxJEbNaRk 0pX0GoxcIoX9OXMYb4FpoBWZdxy3fZZg3y8ACQsQH9opKwOfQpYcdWdDHOy5T5zDru3AeUYwy+8 FiZe2k7xsU09ClcsQoCwMt7RUQrWScQOp10aqfxr+WDMaMfoB7+TRdetA5x3kO8ZGbj7YAwvq9j cmDWPY/Gi16urf5v+Tf8we6/TmJNyT1OSpdouK56Rm1UOU5gej9jw366A91AX8ucGzy35HYYLdt h3aJrQjgIN65CZBDDgFjfveaI86UbrfVOsx7DhvalOjVS9Az+/0a9hK528Ch7nA2Gv9w9fWgWqs wNAGvxbK4wxt+sJnn+KVB5ya9qH4Jhidfb6QMCMDPvVhEVavPQu4ijSM+If3gYRv05e0CZ2xqfH wEaqAyBkwcbbnE95ei6NmZm7rkcju6/otiqD2RLTBeluCU5RQFykUlK22rUh0Mu+DyC5+aRagLf m/MrtUoTc9Pdz94DTYNB2YK4c+qmPEFJVtiyEnoEynMYRTCOuiUWydNpqg4CdoeTtS+OttwpVOr UsBV3QvdRiOxJpQ== X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-Last-TLS-Session-Version: TLSv1.3 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 12 Feb 2026 08:37:53 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/8897 Rework the generation of the switcher menu, and also fix it. It's not obvious how this could be split for easier review, as many parts depend on one another, so this is what this patch changes and fixes: - Show "(latest)" when we are building for the tip of a branch (which is not a tag). This replaces the ".999" suffix which was confusing for some people. - Show a commit id when building on a separate commit that is not a branch tip or not a tag. This should only ever happen when building locally (not for the published version). - Make the default landing be the current active release, shown as e.g. "Whinlatter (5.3 (latest))" in the menu. And make it part of the fixed version, meaning we can go back to it if we change to another. - All stable/LTS versions are displayed in the menu UNLESS the current version for which we are viewing is part of them, in which case it's shown last in the menu. - There is one exception to the above: if the current active release is "Whinlatter (5.3 (latest))", and we navigate to _tag_ 5.3, since the version is seen for both as "5.3" to Sphinx, keep the "latest" version in the menu. - Rework the logic to show outdated or obsolete versions to conform with the above changes, but overall it behaves the same: - granted that Kirkstone is an active release, and 4.0.32 is the latest tag for this release, the "outdated" banner is displayed. - browsing any version not part of the active release (all LTS versions + the stable branch) will show the "obsolete" banner. Signed-off-by: Antonin Godard --- documentation/set_versions.py | 131 +++++++++++++++------------ documentation/sphinx-static/switchers.js.in | 132 +++++++++++++++++++--------- 2 files changed, 163 insertions(+), 100 deletions(-) diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 64b58f103..66e845c97 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -94,6 +94,7 @@ ourseries = None ourbranch = None bitbakeversion = None docconfver = None +head_commit = None # Test tags exist and inform the user to fetch if not try: @@ -106,29 +107,30 @@ tags = subprocess.run(["git", "tag", "--points-at", "HEAD"], stdout=subprocess.P for t in tags.split(): if t.startswith("yocto-"): ourversion = t[6:] - -if ourversion: - # We're a tagged release - components = ourversion.split(".") - baseversion = components[0] + "." + components[1] - docconfver = ourversion - for i in release_series: - if release_series[i] == baseversion: - ourseries = i - ourbranch = i - if i in bitbake_mapping: - bitbakeversion = bitbake_mapping[i] -else: + seriesversion = ".".join(ourversion.split(".")[0:2]) + for series in release_series: + if release_series[series] == seriesversion: + ourseries = series + bitbakeversion = bitbake_mapping[ourseries] + break + break + +if ourversion is None: # We're floating on a branch - branch = subprocess.run(["git", "branch", "--show-current"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.strip() - ourbranch = branch - if branch != "master" and branch not in release_series: - # We're not on a known release branch so we have to guess. Compare the numbers of commits - # from each release branch and assume the smallest number of commits is the one we're based off + branch = subprocess.run(["git", "branch", "--show-current"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True).stdout.strip() + + if branch == "" or branch not in list(release_series.keys()) + ["master", "master-next"]: + # We're not on a known release branch so we have to guess. Compare the + # numbers of commits from each release branch and assume the smallest + # number of commits is the one we're based off possible_branch = None branch_count = 0 for b in itertools.chain(release_series.keys(), ["master"]): - result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True) if result.returncode == 0: count = result.stdout.count('\n') if not possible_branch or count < branch_count: @@ -140,29 +142,29 @@ else: else: branch = "master" print("Nearest release branch estimated to be %s" % branch) + if branch == "master": + ourversion = "dev" ourseries = devbranch - docconfver = "dev" - bitbakeversion = "dev" - elif branch in release_series: - ourseries = branch - if branch in bitbake_mapping: - bitbakeversion = bitbake_mapping[branch] - else: - sys.exit("Unknown series for branch %s" % branch) - - previoustags = subprocess.run(["git", "tag", "--merged", "HEAD"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout - previoustags = [t[6:] for t in previoustags.split() if t.startswith("yocto-" + release_series[ourseries])] - futuretags = subprocess.run(["git", "tag", "--merged", ourbranch], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout - futuretags = [t[6:] for t in futuretags.split() if t.startswith("yocto-" + release_series[ourseries])] - - # Append .999 against the last known version - if len(previoustags) != len(futuretags): - ourversion = previoustags[-1] + ".999" + bitbakeversion = ourversion + elif branch == "master-next": + ourversion = "next" + ourseries = devbranch + bitbakeversion = ourversion else: - ourversion = release_series[ourseries] + ".999" - if not docconfver: - docconfver = ourversion + ourseries = branch + bitbakeversion = bitbake_mapping[ourseries] + ourversion = release_series[branch] + head_commit = subprocess.run(["git", "rev-parse", "--short", "HEAD"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True).stdout.strip() + branch_commit = subprocess.run(["git", "rev-parse", "--short", branch], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True).stdout.strip() + if head_commit != branch_commit: + ourversion += f" ({head_commit})" + else: + ourversion += " (latest)" series = [k for k in release_series] previousseries = series[series.index(ourseries)+1:] or [""] @@ -182,6 +184,7 @@ else: print("Version calculated to be %s" % ourversion) print("Latest release tag found is %s" % latestreltag) print("Release series calculated to be %s" % ourseries) +print("Bitbake version calculated to be %s" % bitbakeversion) replacements = { "DISTRO" : ourversion, @@ -192,7 +195,7 @@ replacements = { "DISTRO_NAME_NO_CAP_MINUS_ONE" : previousseries[0], "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], "YOCTO_DOC_VERSION" : ourversion, - "DOCCONF_VERSION" : docconfver, + "DOCCONF_VERSION" : ourversion, "BITBAKE_SERIES" : bitbakeversion, } @@ -227,29 +230,41 @@ if os.path.exists("poky.yaml.in"): # - current doc version # (with duplicates removed) +def get_latest_tag(branch: str) -> str: + """ + Get the latest tag of `branch`. + """ + branch_versions = subprocess.run('git tag --list yocto-%s*' % + (release_series[branch]), shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True).stdout.split() + branch_versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in branch_versions], key=int) + if not branch_versions: + return "" + version = release_series[branch] + if branch_versions[-1] != "0": + version = version + "." + branch_versions[-1] + return version + +# The default landing page version, which we always want to show +default_release_codename = activereleases[0] +default_release = release_series[default_release_codename] + versions = [] with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switchers.js", "w") as w: lines = r.readlines() for line in lines: - if "ALL_RELEASES_PLACEHOLDER" in line: - w.write(str(list(release_series.keys()))) - continue if "VERSIONS_PLACEHOLDER" in line: - w.write(" 'dev': { 'title': 'Unstable (dev)', 'obsolete': false,},\n") - for branch in activereleases + ([ourseries] if ourseries not in activereleases else []): - if branch == devbranch: - continue - branch_versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split() - branch_versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in branch_versions], key=int) - if not branch_versions: - continue - version = release_series[branch] - if branch_versions[-1] != "0": - version = version + "." + branch_versions[-1] - versions.append(version) - w.write(" '%s': {'title': '%s (%s)', 'obsolete': %s,},\n" % (version, branch.capitalize(), version, str(branch not in activereleases).lower())) - if ourversion not in versions and ourseries != devbranch: - w.write(" '%s': {'title': '%s (%s)', 'obsolete': %s,},\n" % (ourversion, ourseries.capitalize(), ourversion, str(ourseries not in activereleases).lower())) + w.write(" 'dev': 'Unstable (dev)',\n") + w.write(f" '{default_release}': '{default_release_codename.capitalize()} ({default_release} (latest))',\n") + for branch in activereleases: + latest_tag = get_latest_tag(branch) + if latest_tag: + w.write(f" '{latest_tag}': '{branch.capitalize()} ({latest_tag})',\n") + elif "ALL_RELEASES_PLACEHOLDER" in line: + for series in release_series: + w.write(f" '{release_series[series]}': '{series}',\n") else: w.write(line) diff --git a/documentation/sphinx-static/switchers.js.in b/documentation/sphinx-static/switchers.js.in index b1c0812b5..bea8906cf 100644 --- a/documentation/sphinx-static/switchers.js.in +++ b/documentation/sphinx-static/switchers.js.in @@ -9,9 +9,9 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b (function() { 'use strict'; - var all_releases = + var all_releases = { ALL_RELEASES_PLACEHOLDER - ; + }; var switcher_versions = { VERSIONS_PLACEHOLDER @@ -66,23 +66,62 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b return 0; } - function build_version_select(current_series, current_version) { + function build_version_select(current_version) { var buf = [''); - return buf.join(''); + var current_title = current_version; + if ((current_version_num in switcher_versions) && (!is_not_latest) && (!current_version.split(" ")[1])) { + current_title = switcher_versions[current_version_num]; + } else if (!(["dev", "next"].includes(current_version))) { + var current_series = current_version_num.split(".").slice(0, 2).join("."); + if (current_series in all_releases) { + // capitalize codename + var series_name = all_releases[current_series].charAt(0).toUpperCase() + all_releases[current_series].slice(1); + current_title = series_name + " (" + current_version + ")"; + } + } + + buf.push( + '", + ); + + buf.push(""); + return buf.join(""); } function build_doctype_select(current_doctype) { @@ -156,25 +195,30 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b var selected_version = $(this).children('option:selected').attr('value'); var url = window.location.href; var current_version = DOCUMENTATION_OPTIONS.VERSION; + var current_version_info = current_version.split(" "); + var selected_version_info = selected_version.split(" "); var docroot = get_docroot_url() - var new_versionpath = selected_version + '/'; + if ((selected_version_info[0] in switcher_versions) && (switcher_versions[selected_version_info[0]].includes("latest"))) { + // default landing page selected, empty the version + var new_versionpath = ''; + } else { + var new_versionpath = selected_version + '/'; + } // latest tag is also the default page (without version information) - if (docroot.endsWith(current_version + '/') == false) { - var new_url = docroot + new_versionpath + url.replace(docroot, ""); - var fallback_url = docroot + new_versionpath; + if (docroot.endsWith("dev/")) { + var new_url = url.replace("/dev/", "/" + new_versionpath); + var fallback_url = new_url.replace(url.replace(docroot, ""), ""); + } else if (docroot.endsWith(current_version_info[0] + "/") == false) { + var new_url = docroot + new_versionpath + url.replace(docroot, ""); + var fallback_url = docroot + new_versionpath; } else { - // check for named releases (e.g. dunfell) in the subpath - $.each(all_releases, function(idx, release) { - if (docroot.endsWith('/' + release + '/')) { - current_version = release; - return false; - } - }); - - var new_url = url.replace('/' + current_version + '/', '/' + new_versionpath); - var fallback_url = new_url.replace(url.replace(docroot, ""), ""); + var new_url = url.replace( + "/" + current_version_info[0] + "/", + "/" + new_versionpath, + ); + var fallback_url = new_url.replace(url.replace(docroot, ""), ""); } console.log(get_docroot_url()) @@ -224,8 +268,7 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b $(document).ready(function() { var release = DOCUMENTATION_OPTIONS.VERSION; var current_doctype = doctype_segment_from_url(window.location.href); - var current_series = release.substr(0, 3); - var version_select = build_version_select(current_series, release); + var version_select = build_version_select(release); $('.version_switcher_placeholder').html(version_select); $('.version_switcher_placeholder select').bind('change', on_version_switch); @@ -235,22 +278,27 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b $('.doctype_switcher_placeholder').html(doctype_select); $('.doctype_switcher_placeholder select').bind('change', on_doctype_switch); - if (release != "dev") { + var release_info = release.split(" "); + if (!(["dev", "next"].includes(release_info[0]))) { + var match = false; $.each(switcher_versions, function(version, vers_data) { - var series = version.substr(0, 3); - if (series == current_series) { - if (version != release && release.endsWith('.999') == false) { - $('#outdated-warning').html('This document is for outdated version ' + release + ', you should select the latest release version in this series, ' + version + '.'); - $('#outdated-warning').css('padding', '.5em'); - return false; - } - if (vers_data["obsolete"]) { - $('#outdated-warning').html('Version ' + release + ' of the project is now considered obsolete, please select and use a more recent version'); - $('#outdated-warning').css('padding', '.5em'); - return false; + var series = version.split(".").slice(0, 2).join("."); + if ((!vers_data.includes("(latest)")) && (release_info[0].startsWith(series))) { + match = true; + if (ver_compare(release_info[0], version) >= 0) { + return; + } else if ((release_info.length > 1) && (release_info[1] == "(latest)")) { + return; } + $('#outdated-warning').html('This document is for an outdated version ' + release_info[0] + ', you should select version ' + version + '.'); + $('#outdated-warning').css('padding', '.5em'); + return; } }); + if (!match) { + $('#outdated-warning').html('This document is for obsolete release ' + release_info[0] + ', you should select a supported release.'); + $('#outdated-warning').css('padding', '.5em'); + } } }); })(); From patchwork Thu Feb 12 08:37:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonin Godard X-Patchwork-Id: 80959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 256E4EB2719 for ; Thu, 12 Feb 2026 08:37:53 +0000 (UTC) Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.41237.1770885471580046199 for ; Thu, 12 Feb 2026 00:37:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=dkim header.b=dRPHBsyH; spf=pass (domain: bootlin.com, ip: 185.246.85.4, mailfrom: antonin.godard@bootlin.com) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 0E5A24E40CB5 for ; Thu, 12 Feb 2026 08:37:50 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D38C1606CA for ; Thu, 12 Feb 2026 08:37:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 178C0119714D5; Thu, 12 Feb 2026 09:37:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770885469; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=jvJf0pU2MkxCvTFZIRoVhypYEQDCJWDbqF7LrWrQD+o=; b=dRPHBsyHMe3N391qqObOKexltG9xbfuJ4LaR5yFGpVPUDM7OFvyUq0UCkaWpcQkvRh+fAN 54yGptLRZuesA9GYeCTSjmeEoO4YTw9CiDlXV/qgd+HNCrQcJu+7cdusR4Q+YVTEPviTnA 8KxXH5f9zyC11V2IChoIi7WQZx1fV6RPuzEpg54I4cOGf9SXkXo1FnGAeSqV2IqTZ46Lt9 qX9svJN9bzlRgX3pEbWp5c8k+86hCd+omZhRZmvBKD+G5JMiUQFoKh1V0r59CPa/cBZucw TP6zgKdW5F0yzGbiZ7g6l31vWhVjEwV0NQoQINdoG112ND92lh1HU1rTh0G4iA== From: Antonin Godard Date: Thu, 12 Feb 2026 09:37:39 +0100 Subject: [PATCH 3/3] set_versions.py: set a more accurate DISTRO value MIME-Version: 1.0 Message-Id: <20260212-fix-switchers-js-v1-3-16d95c74c328@bootlin.com> References: <20260212-fix-switchers-js-v1-0-16d95c74c328@bootlin.com> In-Reply-To: <20260212-fix-switchers-js-v1-0-16d95c74c328@bootlin.com> To: docs@lists.yoctoproject.org Cc: Thomas Petazzoni , Antonin Godard X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2066; i=antonin.godard@bootlin.com; h=from:subject:message-id; bh=fzK6kkcLVQCa2japyrebNy8LzQcZgawNl1c04GtUk/g=; b=owEBbQKS/ZANAwAKAdGAQUApo6g2AcsmYgBpjZFaFlYiC0uRFBhUn7xF3ym84vh7s4ExYh6bN 33r/TiUG9aJAjMEAAEKAB0WIQSGSHJRiN1AG7mg0//RgEFAKaOoNgUCaY2RWgAKCRDRgEFAKaOo NmOID/9WhOFmqqI4tUmX0ggAT/kncbjQsByI/pkqwm8EACeYvfNipncNh/8M8MQCvIIEIuWOaom DQtHn/6XO9Tvx9FeddjwaaTdSjB3r0get+q24V6FBWx57yzdS3fhPbA9yx9YqGqCLUVFsYzqus4 PeQ3Uyz3IoufXFr4OImlQmxmHceG6CPe4RABiZItL87lUDQvKogupONauaGadWxs2IunF5nfb3S UsshLfF9UYX3Zr9KInAJoDRsMGKiCjbQeSDPhFivL1TadrbYaJyC9lB5H02cOdCbjwLW0txXFSE frYMTQTzMLDKVKjcssg6q6yV8PjxXQRaCmhis78BHNQzEiuh/o5Yi5shdpOJywTW+AH38UC8sTt zH5/u+vGZdaG/6dQ7USnk8m4hXiFdt2dANt7knnt2UFEjtJu8TT8ZqxwhJe1LFGYH/6sUoASvjH vLAbf8ebHxod1J/DUNicMWCrnk5Ceccz2U+deQMWVJx+q48XQghAATtdddHwlT90cnv1PTWqsD2 Koxf8mxVCGQsZ66GMnqvJ08t6iY6+kIPnEHE5YnUu/t1NPpXzrTelxdZkg8K4VYQegxDXRUMTEY PeS0sxflfDOLS0LOIRgAQFuk5UMn9e5UHuxyuHCvLVztKUXIDftQj1ACmFCVT5B8YKzx3GDDhsG cLNBaw8yzdO+sPw== X-Developer-Key: i=antonin.godard@bootlin.com; a=openpgp; fpr=8648725188DD401BB9A0D3FFD180414029A3A836 X-Last-TLS-Session-Version: TLSv1.3 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 12 Feb 2026 08:37:53 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/8898 The changes from the previous commit make the current value inaccurate in some situations, especially since this variable is used in some commands. Take these situations into account and compute a more accurate value for DISTRO. Signed-off-by: Antonin Godard --- documentation/set_versions.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 66e845c97..56cf3d34d 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -186,8 +186,30 @@ print("Latest release tag found is %s" % latestreltag) print("Release series calculated to be %s" % ourseries) print("Bitbake version calculated to be %s" % bitbakeversion) +# The &DISTRO; replacement will be mostly right when just equaling ourversion. +distro = ourversion +# Few exceptions though: +if "(latest)" in distro: + # we're on a branch tip, in that case the closest match is the latest tag + # from that branch. Some instructions rely on DISTRO to provide tag names, + # etc. so it makes sense provide the latest tag from that branch. + distro = latesttag +elif distro in ["dev", "next"]: + # When building on master or master-next, make the distro the version of the + # devbranch. + distro = release_series[devbranch] +elif head_commit: + # or we're on a random commit, in that case create a DISTRO value that + # contains the hash. this would for example be "5.3-4d2acc043". + # This will not happen when publishing the documentation from the + # autobuilder as we don't build specific commits - this should only happen + # for development. + distro = distro.split()[0] + f"-{head_commit}" + +print(f"DISTRO calculated to be {distro}") + replacements = { - "DISTRO" : ourversion, + "DISTRO" : distro, "DISTRO_LATEST_TAG": latesttag, "DISTRO_RELEASE_SERIES": release_series[ourseries], "DISTRO_NAME_NO_CAP" : ourseries,