mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
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>
This commit is contained in:
+20
-2
@@ -15,9 +15,27 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import datetime
|
import datetime
|
||||||
|
try:
|
||||||
|
import yaml
|
||||||
|
except ImportError:
|
||||||
|
sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\
|
||||||
|
\nPlease make sure to install pyyaml python package.\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
current_version = "dev"
|
# current_version = "dev"
|
||||||
bitbake_version = "" # Leave empty for development branch
|
# bitbake_version = "" # Leave empty for development branch
|
||||||
|
# Obtain versions from poky.yaml instead
|
||||||
|
with open("poky.yaml") as data:
|
||||||
|
buff = data.read()
|
||||||
|
subst_vars = yaml.safe_load(buff)
|
||||||
|
if "DOCCONF_VERSION" not in subst_vars:
|
||||||
|
sys.stderr.write("Please set DOCCONF_VERSION in poky.yaml")
|
||||||
|
sys.exit(1)
|
||||||
|
current_version = subst_vars["DOCCONF_VERSION"]
|
||||||
|
if "BITBAKE_SERIES" not in subst_vars:
|
||||||
|
sys.stderr.write("Please set BITBAKE_SERIES in poky.yaml")
|
||||||
|
sys.exit(1)
|
||||||
|
bitbake_version = subst_vars["BITBAKE_SERIES"]
|
||||||
|
|
||||||
# String used in sidebar
|
# String used in sidebar
|
||||||
version = 'Version: ' + current_version
|
version = 'Version: ' + current_version
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ DISTRO_NAME_NO_CAP_MINUS_ONE : "hardknott"
|
|||||||
DISTRO_NAME_NO_CAP_LTS : "dunfell"
|
DISTRO_NAME_NO_CAP_LTS : "dunfell"
|
||||||
YOCTO_DOC_VERSION : "3.4.2"
|
YOCTO_DOC_VERSION : "3.4.2"
|
||||||
DISTRO_REL_TAG : "yocto-3.4.2"
|
DISTRO_REL_TAG : "yocto-3.4.2"
|
||||||
|
DOCCONF_VERSION : "dev"
|
||||||
|
BITBAKE_SERIES : ""
|
||||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||||
YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;"
|
YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;"
|
||||||
|
|||||||
@@ -30,9 +30,20 @@ release_series["hardknott"] = "3.3"
|
|||||||
release_series["gatesgarth"] = "3.2"
|
release_series["gatesgarth"] = "3.2"
|
||||||
release_series["dunfell"] = "3.1"
|
release_series["dunfell"] = "3.1"
|
||||||
|
|
||||||
|
# "langdale" : "2.2",
|
||||||
|
bitbake_mapping = {
|
||||||
|
"kirkstone" : "2.0",
|
||||||
|
"honister" : "1.52",
|
||||||
|
"hardknott" : "1.50",
|
||||||
|
"gatesgarth" : "1.48",
|
||||||
|
"dunfell" : "1.46",
|
||||||
|
}
|
||||||
|
|
||||||
ourversion = None
|
ourversion = None
|
||||||
ourseries = None
|
ourseries = None
|
||||||
ourbranch = None
|
ourbranch = None
|
||||||
|
bitbakeversion = None
|
||||||
|
docconfver = None
|
||||||
|
|
||||||
# Test tags exist and inform the user to fetch if not
|
# Test tags exist and inform the user to fetch if not
|
||||||
try:
|
try:
|
||||||
@@ -50,10 +61,12 @@ if ourversion:
|
|||||||
# We're a tagged release
|
# We're a tagged release
|
||||||
components = ourversion.split(".")
|
components = ourversion.split(".")
|
||||||
baseversion = components[0] + "." + components[1]
|
baseversion = components[0] + "." + components[1]
|
||||||
|
docconfver = ourversion
|
||||||
for i in release_series:
|
for i in release_series:
|
||||||
if release_series[i] == baseversion:
|
if release_series[i] == baseversion:
|
||||||
ourseries = i
|
ourseries = i
|
||||||
ourbranch = i
|
ourbranch = i
|
||||||
|
bitbakeversion = bitbake_mapping[i]
|
||||||
else:
|
else:
|
||||||
# We're floating on a branch
|
# We're floating on a branch
|
||||||
branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip()
|
branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip()
|
||||||
@@ -73,8 +86,11 @@ else:
|
|||||||
print("Nearest release branch esimtated to be %s" % branch)
|
print("Nearest release branch esimtated to be %s" % branch)
|
||||||
if branch == "master":
|
if branch == "master":
|
||||||
ourseries = devbranch
|
ourseries = devbranch
|
||||||
|
docconfver = "dev"
|
||||||
|
bitbakeversion = ""
|
||||||
elif branch in release_series:
|
elif branch in release_series:
|
||||||
ourseries = branch
|
ourseries = branch
|
||||||
|
bitbakeversion = bitbake_mapping[branch]
|
||||||
else:
|
else:
|
||||||
sys.exit("Unknown series for branch %s" % branch)
|
sys.exit("Unknown series for branch %s" % branch)
|
||||||
|
|
||||||
@@ -88,6 +104,8 @@ else:
|
|||||||
ourversion = previoustags[-1] + ".999"
|
ourversion = previoustags[-1] + ".999"
|
||||||
else:
|
else:
|
||||||
ourversion = release_series[ourseries] + ".999"
|
ourversion = release_series[ourseries] + ".999"
|
||||||
|
if not docconfver:
|
||||||
|
docconfver = ourversion
|
||||||
|
|
||||||
series = [k for k in release_series]
|
series = [k for k in release_series]
|
||||||
previousseries = series[series.index(ourseries)+1:]
|
previousseries = series[series.index(ourseries)+1:]
|
||||||
@@ -104,6 +122,8 @@ replacements = {
|
|||||||
"DISTRO_NAME_NO_CAP_LTS" : lastlts[0],
|
"DISTRO_NAME_NO_CAP_LTS" : lastlts[0],
|
||||||
"YOCTO_DOC_VERSION" : ourversion,
|
"YOCTO_DOC_VERSION" : ourversion,
|
||||||
"DISTRO_REL_TAG" : "yocto-" + ourversion,
|
"DISTRO_REL_TAG" : "yocto-" + ourversion,
|
||||||
|
"DOCCONF_VERSION" : docconfver,
|
||||||
|
"BITBAKE_SERIES" : bitbakeversion,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w:
|
with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w:
|
||||||
|
|||||||
Reference in New Issue
Block a user