@@ -186,8 +186,30 @@ print("Latest release tag found is %s" % latestreltag)
print("Release series calculated to be %s" % ourseries)
print("Bitbake version calculated to be %s" % bitbakeversion)
+# The &DISTRO; replacement will be mostly right when just equaling ourversion.
+distro = ourversion
+# Few exceptions though:
+if "(latest)" in distro:
+ # we're on a branch tip, in that case the closest match is the latest tag
+ # from that branch. Some instructions rely on DISTRO to provide tag names,
+ # etc. so it makes sense provide the latest tag from that branch.
+ distro = latesttag
+elif distro in ["dev", "next"]:
+ # When building on master or master-next, make the distro the version of the
+ # devbranch.
+ distro = release_series[devbranch]
+elif head_commit:
+ # or we're on a random commit, in that case create a DISTRO value that
+ # contains the hash. this would for example be "5.3-4d2acc043".
+ # This will not happen when publishing the documentation from the
+ # autobuilder as we don't build specific commits - this should only happen
+ # for development.
+ distro = distro.split()[0] + f"-{head_commit}"
+
+print(f"DISTRO calculated to be {distro}")
+
replacements = {
- "DISTRO" : ourversion,
+ "DISTRO" : distro,
"DISTRO_LATEST_TAG": latesttag,
"DISTRO_RELEASE_SERIES": release_series[ourseries],
"DISTRO_NAME_NO_CAP" : ourseries,
The changes from the previous commit make the current value inaccurate in some situations, especially since this variable is used in some commands. Take these situations into account and compute a more accurate value for DISTRO. Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- documentation/set_versions.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)