summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-18 14:16:24 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-23 12:08:56 +0000
commitb04eda74476fcaaee729ead79322694b3fb5937e (patch)
tree6cfcffee8331c0cfba6b6f76d91ae60443dd2cdf
parent8d3e9aaede03f3615e5afb82df4d9b530a06a5f0 (diff)
downloadpoky-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.py22
-rw-r--r--documentation/poky.yaml.in2
-rwxr-xr-xdocumentation/set_versions.py20
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 @@
15import os 15import os
16import sys 16import sys
17import datetime 17import datetime
18try:
19 import yaml
20except 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
19current_version = "dev" 25# current_version = "dev"
20bitbake_version = "" # Leave empty for development branch 26# bitbake_version = "" # Leave empty for development branch
27# Obtain versions from poky.yaml instead
28with 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
23version = 'Version: ' + current_version 41version = '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"
5DISTRO_NAME_NO_CAP_LTS : "dunfell" 5DISTRO_NAME_NO_CAP_LTS : "dunfell"
6YOCTO_DOC_VERSION : "3.4.2" 6YOCTO_DOC_VERSION : "3.4.2"
7DISTRO_REL_TAG : "yocto-3.4.2" 7DISTRO_REL_TAG : "yocto-3.4.2"
8DOCCONF_VERSION : "dev"
9BITBAKE_SERIES : ""
8YOCTO_DL_URL : "https://downloads.yoctoproject.org" 10YOCTO_DL_URL : "https://downloads.yoctoproject.org"
9YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" 11YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
10YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;" 12YOCTO_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"
30release_series["gatesgarth"] = "3.2" 30release_series["gatesgarth"] = "3.2"
31release_series["dunfell"] = "3.1" 31release_series["dunfell"] = "3.1"
32 32
33# "langdale" : "2.2",
34bitbake_mapping = {
35 "kirkstone" : "2.0",
36 "honister" : "1.52",
37 "hardknott" : "1.50",
38 "gatesgarth" : "1.48",
39 "dunfell" : "1.46",
40}
41
33ourversion = None 42ourversion = None
34ourseries = None 43ourseries = None
35ourbranch = None 44ourbranch = None
45bitbakeversion = None
46docconfver = 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
38try: 49try:
@@ -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]
57else: 70else:
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
92series = [k for k in release_series] 110series = [k for k in release_series]
93previousseries = series[series.index(ourseries)+1:] 111previousseries = 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
109with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: 129with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: