diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-18 14:16:24 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-23 12:08:56 +0000 |
commit | b04eda74476fcaaee729ead79322694b3fb5937e (patch) | |
tree | 6cfcffee8331c0cfba6b6f76d91ae60443dd2cdf | |
parent | 8d3e9aaede03f3615e5afb82df4d9b530a06a5f0 (diff) | |
download | poky-b04eda74476fcaaee729ead79322694b3fb5937e.tar.gz |
conf.py/set_versions/poky.yaml: Set version in conf.py from poky.yaml
Allow conf.py to read the versions it needs from poky.yaml and have
set_versions.py write this out. This means we don't have to change as
many files when making new releases.
(From yocto-docs rev: bfe74c67f327f0c6445cb4129ee0c32db022b95a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | documentation/conf.py | 22 | ||||
-rw-r--r-- | documentation/poky.yaml.in | 2 | ||||
-rwxr-xr-x | documentation/set_versions.py | 20 |
3 files changed, 42 insertions, 2 deletions
diff --git a/documentation/conf.py b/documentation/conf.py index 3015892d29..a5d7c0cd88 100644 --- a/documentation/conf.py +++ b/documentation/conf.py | |||
@@ -15,9 +15,27 @@ | |||
15 | import os | 15 | import os |
16 | import sys | 16 | import sys |
17 | import datetime | 17 | import datetime |
18 | try: | ||
19 | import yaml | ||
20 | except ImportError: | ||
21 | sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\ | ||
22 | \nPlease make sure to install pyyaml python package.\n") | ||
23 | sys.exit(1) | ||
18 | 24 | ||
19 | current_version = "dev" | 25 | # current_version = "dev" |
20 | bitbake_version = "" # Leave empty for development branch | 26 | # bitbake_version = "" # Leave empty for development branch |
27 | # Obtain versions from poky.yaml instead | ||
28 | with open("poky.yaml") as data: | ||
29 | buff = data.read() | ||
30 | subst_vars = yaml.safe_load(buff) | ||
31 | if "DOCCONF_VERSION" not in subst_vars: | ||
32 | sys.stderr.write("Please set DOCCONF_VERSION in poky.yaml") | ||
33 | sys.exit(1) | ||
34 | current_version = subst_vars["DOCCONF_VERSION"] | ||
35 | if "BITBAKE_SERIES" not in subst_vars: | ||
36 | sys.stderr.write("Please set BITBAKE_SERIES in poky.yaml") | ||
37 | sys.exit(1) | ||
38 | bitbake_version = subst_vars["BITBAKE_SERIES"] | ||
21 | 39 | ||
22 | # String used in sidebar | 40 | # String used in sidebar |
23 | version = 'Version: ' + current_version | 41 | version = 'Version: ' + current_version |
diff --git a/documentation/poky.yaml.in b/documentation/poky.yaml.in index 89a059ef1a..a346b7623c 100644 --- a/documentation/poky.yaml.in +++ b/documentation/poky.yaml.in | |||
@@ -5,6 +5,8 @@ DISTRO_NAME_NO_CAP_MINUS_ONE : "hardknott" | |||
5 | DISTRO_NAME_NO_CAP_LTS : "dunfell" | 5 | DISTRO_NAME_NO_CAP_LTS : "dunfell" |
6 | YOCTO_DOC_VERSION : "3.4.2" | 6 | YOCTO_DOC_VERSION : "3.4.2" |
7 | DISTRO_REL_TAG : "yocto-3.4.2" | 7 | DISTRO_REL_TAG : "yocto-3.4.2" |
8 | DOCCONF_VERSION : "dev" | ||
9 | BITBAKE_SERIES : "" | ||
8 | YOCTO_DL_URL : "https://downloads.yoctoproject.org" | 10 | YOCTO_DL_URL : "https://downloads.yoctoproject.org" |
9 | YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" | 11 | YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" |
10 | YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;" | 12 | YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;" |
diff --git a/documentation/set_versions.py b/documentation/set_versions.py index d48b8b74c7..4ee28d0944 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py | |||
@@ -30,9 +30,20 @@ release_series["hardknott"] = "3.3" | |||
30 | release_series["gatesgarth"] = "3.2" | 30 | release_series["gatesgarth"] = "3.2" |
31 | release_series["dunfell"] = "3.1" | 31 | release_series["dunfell"] = "3.1" |
32 | 32 | ||
33 | # "langdale" : "2.2", | ||
34 | bitbake_mapping = { | ||
35 | "kirkstone" : "2.0", | ||
36 | "honister" : "1.52", | ||
37 | "hardknott" : "1.50", | ||
38 | "gatesgarth" : "1.48", | ||
39 | "dunfell" : "1.46", | ||
40 | } | ||
41 | |||
33 | ourversion = None | 42 | ourversion = None |
34 | ourseries = None | 43 | ourseries = None |
35 | ourbranch = None | 44 | ourbranch = None |
45 | bitbakeversion = None | ||
46 | docconfver = None | ||
36 | 47 | ||
37 | # Test tags exist and inform the user to fetch if not | 48 | # Test tags exist and inform the user to fetch if not |
38 | try: | 49 | try: |
@@ -50,10 +61,12 @@ if ourversion: | |||
50 | # We're a tagged release | 61 | # We're a tagged release |
51 | components = ourversion.split(".") | 62 | components = ourversion.split(".") |
52 | baseversion = components[0] + "." + components[1] | 63 | baseversion = components[0] + "." + components[1] |
64 | docconfver = ourversion | ||
53 | for i in release_series: | 65 | for i in release_series: |
54 | if release_series[i] == baseversion: | 66 | if release_series[i] == baseversion: |
55 | ourseries = i | 67 | ourseries = i |
56 | ourbranch = i | 68 | ourbranch = i |
69 | bitbakeversion = bitbake_mapping[i] | ||
57 | else: | 70 | else: |
58 | # We're floating on a branch | 71 | # We're floating on a branch |
59 | branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip() | 72 | branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip() |
@@ -73,8 +86,11 @@ else: | |||
73 | print("Nearest release branch esimtated to be %s" % branch) | 86 | print("Nearest release branch esimtated to be %s" % branch) |
74 | if branch == "master": | 87 | if branch == "master": |
75 | ourseries = devbranch | 88 | ourseries = devbranch |
89 | docconfver = "dev" | ||
90 | bitbakeversion = "" | ||
76 | elif branch in release_series: | 91 | elif branch in release_series: |
77 | ourseries = branch | 92 | ourseries = branch |
93 | bitbakeversion = bitbake_mapping[branch] | ||
78 | else: | 94 | else: |
79 | sys.exit("Unknown series for branch %s" % branch) | 95 | sys.exit("Unknown series for branch %s" % branch) |
80 | 96 | ||
@@ -88,6 +104,8 @@ else: | |||
88 | ourversion = previoustags[-1] + ".999" | 104 | ourversion = previoustags[-1] + ".999" |
89 | else: | 105 | else: |
90 | ourversion = release_series[ourseries] + ".999" | 106 | ourversion = release_series[ourseries] + ".999" |
107 | if not docconfver: | ||
108 | docconfver = ourversion | ||
91 | 109 | ||
92 | series = [k for k in release_series] | 110 | series = [k for k in release_series] |
93 | previousseries = series[series.index(ourseries)+1:] | 111 | previousseries = series[series.index(ourseries)+1:] |
@@ -104,6 +122,8 @@ replacements = { | |||
104 | "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], | 122 | "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], |
105 | "YOCTO_DOC_VERSION" : ourversion, | 123 | "YOCTO_DOC_VERSION" : ourversion, |
106 | "DISTRO_REL_TAG" : "yocto-" + ourversion, | 124 | "DISTRO_REL_TAG" : "yocto-" + ourversion, |
125 | "DOCCONF_VERSION" : docconfver, | ||
126 | "BITBAKE_SERIES" : bitbakeversion, | ||
107 | } | 127 | } |
108 | 128 | ||
109 | with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: | 129 | with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: |