[2/2] docs: set_versions.py: fix latest version of an active release shown as obsolete

Message ID 20220419153048.104600-2-foss+yocto@0leil.net
State New
Headers show
Series [1/2] docs: set_versions.py: fix latest release of a branch being shown twice in switchers.js | expand

Commit Message

Quentin Schulz April 19, 2022, 3:30 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

ourseries can be an active release and therefore shouldn't be marked as
obsolete. By adding ourseries to activereleases, it is impossible to
know if ourseries is actually an active release or not. Instead let's
loop on the active releases with ourseries too (only if it's not active
release, otherwise it'd appear twice).

Fixes: 6f40ef56054ec "docs: set_versions.py: add information about obsolescence of a release"
Cc: Quentin Schulz <foss+yocto@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 documentation/set_versions.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Patch

diff --git a/documentation/set_versions.py b/documentation/set_versions.py
index 4114ae573..8ae02b11f 100755
--- a/documentation/set_versions.py
+++ b/documentation/set_versions.py
@@ -199,16 +199,13 @@  if os.path.exists("poky.yaml.in"):
 #  - current doc version
 # (with duplicates removed)
 
-if ourseries not in activereleases:
-    activereleases.append(ourseries)
-
 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 "VERSIONS_PLACEHOLDER" in line:
             w.write("    'dev': { 'title': 'dev (%s)', 'obsolete': false,},\n" % release_series[devbranch])
-            for branch in activereleases:
+            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, capture_output=True, text=True).stdout.split()
@@ -219,7 +216,7 @@  with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switch
                 if branch_versions[-1] != "0":
                     version = version + "." + branch_versions[-1]
                 versions.append(version)
-                w.write("    '%s': {'title': '%s', 'obsolete': %s,},\n" % (version, version, str(branch == ourseries).lower()))
+                w.write("    '%s': {'title': '%s', 'obsolete': %s,},\n" % (version, version, str(branch not in activereleases).lower()))
             if ourversion not in versions and ourseries != devbranch:
                 w.write("    '%s': {'title': '%s', 'obsolete': true,},\n" % (ourversion, ourversion))
         else: