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/set_versions.py | |
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/set_versions.py')
-rwxr-xr-x | documentation/set_versions.py | 19 |
1 files changed, 19 insertions, 0 deletions
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 | |||