set_versions/switchers.js: Allow switchers.js version information to be autogenerated
PATCH 1/2 set_versions/switchers.js: Allow switchers.js version information to be autogenerated
A horrible blunt hammer approach to updating the version information in switchers.js based on the available tag information.
To merge and work correctly, this will need a change to the autobuilder-helper docs generation code to pull the swicthers.js and script from master, then to run the script. That should hopefully remove the need for other patching even on old docs branches though.
---
documentation/.gitignore | 1 +
documentation/set_versions.py | 20 +++++++++++++++++++
.../{switchers.js => switchers.js.in} | 8 +-------
3 files changed, 22 insertions(+), 7 deletions(-)
rename documentation/sphinx-static/{switchers.js => switchers.js.in} (97%)documentation/.gitignore +1 -0
@@ -1,6 +1,7 @@ _build/ Pipfile.lock poky.yaml +sphinx-static/switchers.js .vscode/ */svg/*.png */svg/*.pdf
documentation/set_versions.py +20 -0
@@ -13,6 +13,7 @@ import subprocess import collections import sys +activereleases = ["honister", "hardknott", "dunfell"] devbranch = "kirkstone" #devbranch = "langdale" ltsseries = ["kirkstone", "dunfell"]
@@ -144,3 +145,22 @@ with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: print("poky.yaml generated from poky.yaml.in") +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': 'dev (%s)',\n" % release_series[devbranch]) + for branch in activereleases: + if branch == devbranch: + continue + versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, capture_output=True, text=True).stdout.split() + versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in versions], key=int) + version = release_series[branch] + if versions[-1] != "0": + version = version + "." + versions[-1] + w.write(" '%s': '%s',\n" % (version, version)) + else: + w.write(line) + +print("switchers.js generated from switchers.js.in") +
documentation/sphinx-static/switchers.js.in renamed from documentation/sphinx-static/switchers.js +1 -7
@@ -10,13 +10,7 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b 'use strict'; var all_versions = { - 'dev': 'dev (3.5)', - '3.4.2': '3.4.2', - '3.3.5': '3.3.5', - '3.2.4': '3.2.4', - '3.1.14': '3.1.14', - '3.0.4': '3.0.4', - '2.7.4': '2.7.4', + VERSIONS_PLACEHOLDER }; var all_doctypes = {
Signature · 1 line
2.32.0
PATCH 2/2 set_versions: Handle older non-active releases
Ensure older non-active releases are shown in the switchers.js release list.
--- documentation/set_versions.py | 3 +++ 1 file changed, 3 insertions(+)
documentation/set_versions.py +3 -0
@@ -145,6 +145,9 @@ with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: print("poky.yaml generated from poky.yaml.in") +if ourseries not in activereleases: + activereleases.append(ourseries) + 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:
Signature · 1 line
2.32.0
Re: [docs] [PATCH 2/2] set_versions: Handle older non-active releases
Hi Richard,
Quoted 3 lines · Richard Purdie
Ensure older non-active releases are shown in the switchers.js release list.
We're currently showing EOL releases in the docs too. I think we need to discuss this first before removing EOL releases in the previous patch (pretty sure I commented on another patchseries questioning this decision). I don't think it's a good idea to mask them but I'm happy to be proven otherwise :)
Cheers,
Quentin
Re: [docs] [PATCH 2/2] set_versions: Handle older non-active releases
Quoted 7 lines · Quentin Schulz
Hi Richard,
Quoted 3 lines · Richard Purdie
Ensure older non-active releases are shown in the switchers.js release list.
Quoted 5 lines
We're currently showing EOL releases in the docs too. I think we need to discuss this first before removing EOL releases in the previous patch (pretty sure I commented on another patchseries questioning this decision). I don't think it's a good idea to mask them but I'm happy to be proven otherwise :)
I'm of the view that we should show the currently supported ones by default. You can navigate to the older ones or follow links to them but we want to give users a strong hint about which versions they should be looking at, and hint to them if they're on old versions...
Cheers,
Richard
Re: [docs] [PATCH 2/2] set_versions: Handle older non-active releases
Hi Richard,
Quoted 14 lines · Richard Purdie
Quoted 7 lines · Quentin Schulz
Hi Richard,
Quoted 3 lines · Richard Purdie
Ensure older non-active releases are shown in the switchers.js release list.
Quoted 5 lines
We're currently showing EOL releases in the docs too. I think we need to discuss this first before removing EOL releases in the previous patch (pretty sure I commented on another patchseries questioning this decision). I don't think it's a good idea to mask them but I'm happy to be proven otherwise :)
Quoted 5 lines
I'm of the view that we should show the currently supported ones by default. You can navigate to the older ones or follow links to them but we want to give users a strong hint about which versions they should be looking at, and hint to them if they're on old versions...
https://docs.yoctoproject.org/3.0.4/
Shows a red HTML header.
It's a policy decision. I know it's been hard to encourage people to move to actually supported versions of the Yocto Project, so maybe removing explicit links to the docs is sufficiently annoying for people to think about migrating? I don't know.
Not nice to users but can see the reason for the project to go this route.
Cheers,
Quentin