docs: set_versions.py: fix latest version of an active release shown as obsolete

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>
(From yocto-docs rev: f16b633211b97b2cdf2c65d83c99cd3853d2bb5c)

Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Quentin Schulz 2022-04-19 17:30:48 +02:00 committed by Richard Purdie
parent 36ccca5cba
commit b5882ec908

View File

@ -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: