diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-18 16:21:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-23 12:08:56 +0000 |
commit | 8827704443363068db7181bc0698cbda5d35b01d (patch) | |
tree | 2582d1398e36ea533134dcd555b795e03b79f1df /documentation | |
parent | 767eb1c71c4fbb95dff6aa59b9a87211ef663d7c (diff) | |
download | poky-8827704443363068db7181bc0698cbda5d35b01d.tar.gz |
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.
(From yocto-docs rev: dc858c8b2ffdb792fe8cef05fab3d752aa858f78)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/.gitignore | 1 | ||||
-rwxr-xr-x | documentation/set_versions.py | 19 | ||||
-rw-r--r-- | documentation/sphinx-static/switchers.js.in (renamed from documentation/sphinx-static/switchers.js) | 8 |
3 files changed, 21 insertions, 7 deletions
diff --git a/documentation/.gitignore b/documentation/.gitignore index e5e2c1708d..096b97ec28 100644 --- a/documentation/.gitignore +++ b/documentation/.gitignore | |||
@@ -1,6 +1,7 @@ | |||
1 | _build/ | 1 | _build/ |
2 | Pipfile.lock | 2 | Pipfile.lock |
3 | poky.yaml | 3 | poky.yaml |
4 | sphinx-static/switchers.js | ||
4 | .vscode/ | 5 | .vscode/ |
5 | */svg/*.png | 6 | */svg/*.png |
6 | */svg/*.pdf | 7 | */svg/*.pdf |
diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 96e0d34697..94e2704a50 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py | |||
@@ -149,3 +149,22 @@ with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: | |||
149 | 149 | ||
150 | print("poky.yaml generated from poky.yaml.in") | 150 | print("poky.yaml generated from poky.yaml.in") |
151 | 151 | ||
152 | with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switchers.js", "w") as w: | ||
153 | lines = r.readlines() | ||
154 | for line in lines: | ||
155 | if "VERSIONS_PLACEHOLDER" in line: | ||
156 | w.write(" 'dev': 'dev (%s)',\n" % release_series[devbranch]) | ||
157 | for branch in activereleases: | ||
158 | if branch == devbranch: | ||
159 | continue | ||
160 | versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, capture_output=True, text=True).stdout.split() | ||
161 | versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in versions], key=int) | ||
162 | version = release_series[branch] | ||
163 | if versions[-1] != "0": | ||
164 | version = version + "." + versions[-1] | ||
165 | w.write(" '%s': '%s',\n" % (version, version)) | ||
166 | else: | ||
167 | w.write(line) | ||
168 | |||
169 | print("switchers.js generated from switchers.js.in") | ||
170 | |||
diff --git a/documentation/sphinx-static/switchers.js b/documentation/sphinx-static/switchers.js.in index af7e334906..5d3a4d7935 100644 --- a/documentation/sphinx-static/switchers.js +++ b/documentation/sphinx-static/switchers.js.in | |||
@@ -10,13 +10,7 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b | |||
10 | 'use strict'; | 10 | 'use strict'; |
11 | 11 | ||
12 | var all_versions = { | 12 | var all_versions = { |
13 | 'dev': 'dev (3.5)', | 13 | VERSIONS_PLACEHOLDER |
14 | '3.4.2': '3.4.2', | ||
15 | '3.3.5': '3.3.5', | ||
16 | '3.2.4': '3.2.4', | ||
17 | '3.1.15': '3.1.15', | ||
18 | '3.0.4': '3.0.4', | ||
19 | '2.7.4': '2.7.4', | ||
20 | }; | 14 | }; |
21 | 15 | ||
22 | var all_doctypes = { | 16 | var all_doctypes = { |