Skip to contentSkip to conversation

doc: set_versions.py: change strategy for the default page

PATCH New Antonin Godard 1 participant 1 message Apr 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: set_versions.py: change strategy for the default page

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.

---
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(-)
doc/setversions.py +14 -3
index 82a0e8b191b..f1aea0a4225 100755
@@ -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