scripts/release-parser.py: add bitbake version mappings to releases.json
PATCH v2 1/1 scripts/release-parser.py: add bitbake version mappings to releases.json
Instead of maintaining the bitbake <-> yocto version mappings in yocto-docs[1] and bitbake[2], let's maintain it here instead. This is part of a work-in-progress to use the generated releases.json file in these two repositories to generate the documentation.
[1]: https://git.yoctoproject.org/yocto-docs/tree/documentation/set_versions.py?id=d97cfeaa55ed42722998d3313c1857aa377f6881#n66
[2]: https://git.openembedded.org/bitbake/tree/doc/setversions.py?id=1d0d4a0066603461eacb92a766fec616c1e91257#n25
---
Tested on this build:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/104/builds/49344
Output: https://0x0.st/P9zd.json
---
Changes in v2:
- Rebased on master
- Link to v1: https://patch.msgid.link/20260305-release-parser-bitbake-mapping-v1-1-f023e03bb484@bootlin.com
--- scripts/release-parser.py | 39 ++++++++++++++++++++++++++++++++++++++- scripts/run-dashboard-index | 2 +- 2 files changed, 39 insertions(+), 2 deletions(-)
scripts/release-parser.py +38 -1
@@ -7,7 +7,10 @@ import sys from git import Repo +# this is the repository where we fetch most of our tag data GIT_REPO = sys.argv[1] +# the bitbake repository is used to associate bitbake versions to them +BITBAKE_REPO = sys.argv[2] print(f"Reading tag information in {GIT_REPO}")
@@ -20,10 +23,40 @@ SUPPORTED_RELEASES = { CURRENT_ACTIVE_DEV_CODENAME = "Wrynose" CURRENT_ACTIVE_DEV_VERSION = "6.0" CURRENT_ACTIVE_DEV_MAINTAINER = "Richard Purdie <[email protected]>" +CURRENT_ACTIVE_DEV_BITBAKE_MAPPING = "2.18" CURRENT_STABLE_BRANCH = "5.3" CURRENT_STABLE_MAINTAINER = "Yoann Congal <[email protected]>" repo = Repo(GIT_REPO) +bitbake_repo = Repo(BITBAKE_REPO) + +def get_bitbake_mapping(yocto_tag: str) -> str: + """ + Get the bitbake mapping for a yocto project tag ("yocto-X.Y"). + If the tag does not exist in bitbake, return an empty string. + For any tag lower than yocto-3.1 there were no bitbake mappings, return an empty string. + """ + if yocto_tag not in bitbake_repo.tags: + return "" + + semver_tag = yocto_tag.replace("yocto-", "") + try: + semver_tag = semver.VersionInfo.parse(semver_tag) + except ValueError: + semver_tag = semver.VersionInfo.parse(semver_tag + ".0") + + if semver_tag < semver.VersionInfo(major=3, minor=1, patch=0): + return "" + + branches = bitbake_repo.git.branch( + "--remotes", + "--sort=version:refname", + "--contains", yocto_tag, + "origin/*.*").splitlines() + if not branches: + return "" + + return branches[0].strip().replace("origin/", "") def get_git_tags(): tagmap = {}
@@ -92,6 +125,8 @@ def get_git_tags(): status = SUPPORTED_RELEASES.get(branch, "EOL") maintainer = CURRENT_STABLE_MAINTAINER if branch in SUPPORTED_RELEASES else "N/A" + bitbake_mapping = get_bitbake_mapping(tags[0].name) + # Create a dictionary for the series entry tag_dict = { "series_version": re.sub(r"[^\d\.]", "", tags[0].name),
@@ -103,7 +138,8 @@ def get_git_tags(): "status": status, "download": download, "release_notes": release_notes, - "maintainer": maintainer + "maintainer": maintainer, + "bitbake_version": bitbake_mapping, } tag_list.append(tag_dict)
@@ -124,6 +160,7 @@ tags.append( "status": "Active Development", "download": "", "maintainer": CURRENT_ACTIVE_DEV_MAINTAINER, + "bitbake_version": CURRENT_ACTIVE_DEV_BITBAKE_MAPPING, } )
scripts/run-dashboard-index +1 -1
@@ -16,7 +16,7 @@ scriptdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" dest=${DEST:[email protected]:dashboard/} cd $builddir -$scriptdir/release-parser.py $builddir/yocto-docs +$scriptdir/release-parser.py $builddir/yocto-docs $builddir/repos/bitbake $scriptdir/layer-parser.py curl --silent --output $scriptdir/dashboard/testresults.json https://git.yoctoproject.org/yocto-testresults/plain/oeselftest/reproducible/qemux86-64/testresults.json
---
base-commit: 1e27bfd901292297c8471e287d62226f4555a2e1
change-id: 20260304-release-parser-bitbake-mapping-baa27555ac04