[PATCH] doc: set_versions.py: change strategy for the default page

Antonin Godard <[email protected]>
Newsgroups org.openembedded.lists.bitbake-devel,org.yoctoproject.lists.docs
Message-ID <[email protected]>
A problem can happen with the current code: if the current stable release
is made EOL before the development branch is made the current stable,
then we only have LTS releases displayed.

Change the logic to _always_ display the latest non-dev branch as the
default page, even if EOL.

Signed-off-by: Antonin Godard <[email protected]>
---
Note: this fix are the same as the ones sent for yocto-docs, see
https://lore.kernel.org/r/20260413-set-versions-no-current-release-v1-0-9c40207c8604@bootlin.com
---
 doc/setversions.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/setversions.py b/doc/setversions.py
index 82a0e8b191b..f1aea0a4225 100755
--- a/doc/setversions.py
+++ b/doc/setversions.py
@@ -65,14 +65,25 @@ if RELEASES_FROM_JSON:
         bb_ver = release["bitbake_version"]
         if release["status"] == "Active Development":
             DEVBRANCH = bb_ver
-        if release["series"] == "current":
-            ACTIVERELEASES.append(bb_ver)
         if "LTS until" in release["status"]:
             LTSSERIES.append(bb_ver)
         if release["bitbake_version"]:
             YOCTO_MAPPING[bb_ver] = release["release_codename"]
 
-    ACTIVERELEASES.remove(DEVBRANCH)
+    # Find the first non-dev release, which should be displayed as the default
+    # page on the docs website.
+    current_branch = ""
+    for release in RELEASES_FROM_JSON:
+        if release["status"] != "Active Development":
+            current_branch = release["bitbake_version"]
+            break
+
+    if not current_branch:
+        sys.exit("Unable to find a current release! Exiting...")
+
+    # make the list of releases unique, there can be duplication when the
+    # current releases is also an LTS
+    ACTIVERELEASES = list(dict.fromkeys([current_branch] + LTSSERIES))
 
 print(f"ACTIVERELEASES calculated to be {ACTIVERELEASES}", file=sys.stderr)
 print(f"DEVBRANCH calculated to be {DEVBRANCH}", file=sys.stderr)

---
base-commit: 5d722b5d65e4eef7befe6376983385421e993f86
change-id: 20260413-set-versions-fixes-5a8b6e39b42f
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.