diff options
Diffstat (limited to 'documentation/set_versions.py')
-rwxr-xr-x | documentation/set_versions.py | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 90e08fc5e0..b8dd4b1b90 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py | |||
@@ -26,9 +26,9 @@ ourversion = None | |||
26 | if len(sys.argv) == 2: | 26 | if len(sys.argv) == 2: |
27 | ourversion = sys.argv[1] | 27 | ourversion = sys.argv[1] |
28 | 28 | ||
29 | activereleases = ["nanbield", "kirkstone", "dunfell"] | 29 | activereleases = ["walnascar", "scarthgap", "kirkstone"] |
30 | devbranch = "scarthgap" | 30 | devbranch = "whinlatter" |
31 | ltsseries = ["kirkstone", "dunfell"] | 31 | ltsseries = ["scarthgap", "kirkstone"] |
32 | 32 | ||
33 | # used by run-docs-builds to get the default page | 33 | # used by run-docs-builds to get the default page |
34 | if ourversion == "getlatest": | 34 | if ourversion == "getlatest": |
@@ -36,6 +36,9 @@ if ourversion == "getlatest": | |||
36 | sys.exit(0) | 36 | sys.exit(0) |
37 | 37 | ||
38 | release_series = collections.OrderedDict() | 38 | release_series = collections.OrderedDict() |
39 | release_series["whinlatter"] = "5.3" | ||
40 | release_series["walnascar"] = "5.2" | ||
41 | release_series["styhead"] = "5.1" | ||
39 | release_series["scarthgap"] = "5.0" | 42 | release_series["scarthgap"] = "5.0" |
40 | release_series["nanbield"] = "4.3" | 43 | release_series["nanbield"] = "4.3" |
41 | release_series["mickledore"] = "4.2" | 44 | release_series["mickledore"] = "4.2" |
@@ -68,6 +71,9 @@ release_series["laverne"] = "0.9" | |||
68 | 71 | ||
69 | 72 | ||
70 | bitbake_mapping = { | 73 | bitbake_mapping = { |
74 | "whinlatter" : "2.14", | ||
75 | "walnascar" : "2.12", | ||
76 | "styhead" : "2.10", | ||
71 | "scarthgap" : "2.8", | 77 | "scarthgap" : "2.8", |
72 | "nanbield" : "2.6", | 78 | "nanbield" : "2.6", |
73 | "mickledore" : "2.4", | 79 | "mickledore" : "2.4", |
@@ -95,12 +101,12 @@ docconfver = None | |||
95 | 101 | ||
96 | # Test tags exist and inform the user to fetch if not | 102 | # Test tags exist and inform the user to fetch if not |
97 | try: | 103 | try: |
98 | subprocess.run(["git", "show", "yocto-%s" % release_series[activereleases[0]]], capture_output=True, check=True) | 104 | subprocess.run(["git", "show", "yocto-%s" % release_series[activereleases[0]]], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) |
99 | except subprocess.CalledProcessError: | 105 | except subprocess.CalledProcessError: |
100 | sys.exit("Please run 'git fetch --tags' before building the documentation") | 106 | sys.exit("Please run 'git fetch --tags' before building the documentation") |
101 | 107 | ||
102 | # Try and figure out what we are | 108 | # Try and figure out what we are |
103 | tags = subprocess.run(["git", "tag", "--points-at", "HEAD"], capture_output=True, text=True).stdout | 109 | tags = subprocess.run(["git", "tag", "--points-at", "HEAD"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout |
104 | for t in tags.split(): | 110 | for t in tags.split(): |
105 | if t.startswith("yocto-"): | 111 | if t.startswith("yocto-"): |
106 | ourversion = t[6:] | 112 | ourversion = t[6:] |
@@ -118,7 +124,7 @@ if ourversion: | |||
118 | bitbakeversion = bitbake_mapping[i] | 124 | bitbakeversion = bitbake_mapping[i] |
119 | else: | 125 | else: |
120 | # We're floating on a branch | 126 | # We're floating on a branch |
121 | branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip() | 127 | branch = subprocess.run(["git", "branch", "--show-current"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.strip() |
122 | ourbranch = branch | 128 | ourbranch = branch |
123 | if branch != "master" and branch not in release_series: | 129 | if branch != "master" and branch not in release_series: |
124 | # We're not on a known release branch so we have to guess. Compare the numbers of commits | 130 | # We're not on a known release branch so we have to guess. Compare the numbers of commits |
@@ -126,7 +132,7 @@ else: | |||
126 | possible_branch = None | 132 | possible_branch = None |
127 | branch_count = 0 | 133 | branch_count = 0 |
128 | for b in itertools.chain(release_series.keys(), ["master"]): | 134 | for b in itertools.chain(release_series.keys(), ["master"]): |
129 | result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], capture_output=True, text=True) | 135 | result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) |
130 | if result.returncode == 0: | 136 | if result.returncode == 0: |
131 | count = result.stdout.count('\n') | 137 | count = result.stdout.count('\n') |
132 | if not possible_branch or count < branch_count: | 138 | if not possible_branch or count < branch_count: |
@@ -149,9 +155,9 @@ else: | |||
149 | else: | 155 | else: |
150 | sys.exit("Unknown series for branch %s" % branch) | 156 | sys.exit("Unknown series for branch %s" % branch) |
151 | 157 | ||
152 | previoustags = subprocess.run(["git", "tag", "--merged", "HEAD"], capture_output=True, text=True).stdout | 158 | previoustags = subprocess.run(["git", "tag", "--merged", "HEAD"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout |
153 | previoustags = [t[6:] for t in previoustags.split() if t.startswith("yocto-" + release_series[ourseries])] | 159 | previoustags = [t[6:] for t in previoustags.split() if t.startswith("yocto-" + release_series[ourseries])] |
154 | futuretags = subprocess.run(["git", "tag", "--merged", ourbranch], capture_output=True, text=True).stdout | 160 | futuretags = subprocess.run(["git", "tag", "--merged", ourbranch], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout |
155 | futuretags = [t[6:] for t in futuretags.split() if t.startswith("yocto-" + release_series[ourseries])] | 161 | futuretags = [t[6:] for t in futuretags.split() if t.startswith("yocto-" + release_series[ourseries])] |
156 | 162 | ||
157 | # Append .999 against the last known version | 163 | # Append .999 against the last known version |
@@ -166,17 +172,29 @@ series = [k for k in release_series] | |||
166 | previousseries = series[series.index(ourseries)+1:] or [""] | 172 | previousseries = series[series.index(ourseries)+1:] or [""] |
167 | lastlts = [k for k in previousseries if k in ltsseries] or "dunfell" | 173 | lastlts = [k for k in previousseries if k in ltsseries] or "dunfell" |
168 | 174 | ||
175 | latestreltag = subprocess.run(["git", "describe", "--abbrev=0", "--tags", "--match", "yocto-*"], capture_output=True, text=True).stdout | ||
176 | latestreltag = latestreltag.strip() | ||
177 | if latestreltag: | ||
178 | if latestreltag.startswith("yocto-"): | ||
179 | latesttag = latestreltag[6:] | ||
180 | else: | ||
181 | # fallback on the calculated version | ||
182 | print("Did not find a tag with 'git describe', falling back to %s" % ourversion) | ||
183 | latestreltag = "yocto-" + ourversion | ||
184 | latesttag = ourversion | ||
185 | |||
169 | print("Version calculated to be %s" % ourversion) | 186 | print("Version calculated to be %s" % ourversion) |
187 | print("Latest release tag found is %s" % latestreltag) | ||
170 | print("Release series calculated to be %s" % ourseries) | 188 | print("Release series calculated to be %s" % ourseries) |
171 | 189 | ||
172 | replacements = { | 190 | replacements = { |
173 | "DISTRO" : ourversion, | 191 | "DISTRO" : ourversion, |
192 | "DISTRO_LATEST_TAG": latesttag, | ||
174 | "DISTRO_NAME_NO_CAP" : ourseries, | 193 | "DISTRO_NAME_NO_CAP" : ourseries, |
175 | "DISTRO_NAME" : ourseries.capitalize(), | 194 | "DISTRO_NAME" : ourseries.capitalize(), |
176 | "DISTRO_NAME_NO_CAP_MINUS_ONE" : previousseries[0], | 195 | "DISTRO_NAME_NO_CAP_MINUS_ONE" : previousseries[0], |
177 | "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], | 196 | "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], |
178 | "YOCTO_DOC_VERSION" : ourversion, | 197 | "YOCTO_DOC_VERSION" : ourversion, |
179 | "DISTRO_REL_TAG" : "yocto-" + ourversion, | ||
180 | "DOCCONF_VERSION" : docconfver, | 198 | "DOCCONF_VERSION" : docconfver, |
181 | "BITBAKE_SERIES" : bitbakeversion, | 199 | "BITBAKE_SERIES" : bitbakeversion, |
182 | } | 200 | } |
@@ -224,7 +242,7 @@ with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switch | |||
224 | for branch in activereleases + ([ourseries] if ourseries not in activereleases else []): | 242 | for branch in activereleases + ([ourseries] if ourseries not in activereleases else []): |
225 | if branch == devbranch: | 243 | if branch == devbranch: |
226 | continue | 244 | continue |
227 | branch_versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, capture_output=True, text=True).stdout.split() | 245 | branch_versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split() |
228 | branch_versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in branch_versions], key=int) | 246 | branch_versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in branch_versions], key=int) |
229 | if not branch_versions: | 247 | if not branch_versions: |
230 | continue | 248 | continue |
@@ -269,7 +287,7 @@ def tag_to_semver_like(v): | |||
269 | v_maj, v_min, v_patch = v_semver.groups('0') | 287 | v_maj, v_min, v_patch = v_semver.groups('0') |
270 | return int("{:0>2}{:0>2}{:0>2}".format(v_maj, v_min, v_patch), 10) | 288 | return int("{:0>2}{:0>2}{:0>2}".format(v_maj, v_min, v_patch), 10) |
271 | 289 | ||
272 | yocto_tags = subprocess.run(["git", "tag", "--list", "--sort=version:refname", "yocto-*"], capture_output=True, text=True).stdout | 290 | yocto_tags = subprocess.run(["git", "tag", "--list", "--sort=version:refname", "yocto-*"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout |
273 | yocto_tags = sorted(yocto_tags.split() + missing_tags, key=tag_to_semver_like) | 291 | yocto_tags = sorted(yocto_tags.split() + missing_tags, key=tag_to_semver_like) |
274 | tags = [tag[6:] for tag in yocto_tags] | 292 | tags = [tag[6:] for tag in yocto_tags] |
275 | 293 | ||
@@ -314,3 +332,5 @@ with open('releases.rst', 'w') as f: | |||
314 | if tag == release_series[series] or tag.startswith('%s.' % release_series[series]): | 332 | if tag == release_series[series] or tag.startswith('%s.' % release_series[series]): |
315 | f.write('- :yocto_docs:`%s Documentation </%s>`\n' % (tag, tag)) | 333 | f.write('- :yocto_docs:`%s Documentation </%s>`\n' % (tag, tag)) |
316 | f.write('\n') | 334 | f.write('\n') |
335 | |||
336 | |||