scripts/release-parser.py: add bitbake version mappings to releases.json
PATCH 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/48264
Output: https://0x0.st/PjSE.json
--- scripts/release-parser.py | 37 +++++++++++++++++++++++++++++++++++++ scripts/run-dashboard-index | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-)
scripts/release-parser.py +37 -0
@@ -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}")
@@ -19,8 +22,38 @@ SUPPORTED_RELEASES = { CURRENT_ACTIVE_DEV_CODENAME = "Wrynose" CURRENT_ACTIVE_DEV_VERSION = "6.0" CURRENT_STABLE_BRANCH = "5.3" +CURRENT_ACTIVE_DEV_BITBAKE_MAPPING = "2.18" 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 = {}
@@ -88,6 +121,8 @@ def get_git_tags(): status = SUPPORTED_RELEASES.get(branch, "EOL") + 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),
@@ -99,6 +134,7 @@ def get_git_tags(): "status": status, "download": download, "release_notes": release_notes, + "bitbake_version": bitbake_mapping, } tag_list.append(tag_dict)
@@ -118,6 +154,7 @@ tags.append( "releases" : list(e.name for e in filter(lambda e: e.name.startswith(CURRENT_ACTIVE_DEV_VERSION), repo.tags)), "status": "Active Development", "download": "", + "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: 6c6c7e0d8291b32cf09570f3d819df4d465a7962
change-id: 20260304-release-parser-bitbake-mapping-baa27555ac04
Hi,
Gentle reminder regarding this patch. This should allow me to move forward with documentation series for yocto-docs and bitbake.
Antonin
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Gentle reminder regarding this patch. This should allow me to move forward with documentation series for yocto-docs and bitbake.
The challenge is you sent patches with "X needs to merge before Y else things break" and I just haven't had the time to focus and work it out.
This patch needs to be rebased as it doesn't apply as far as I can tell after spending too long trying to work out if I was missing a patch.
Cheers,
RIchard
Quoted 6 lines · Richard Purdie
Quoted 2 lines · Antonin Godard via lists.yoctoproject.org
Gentle reminder regarding this patch. This should allow me to move forward with documentation series for yocto-docs and bitbake.
The challenge is you sent patches with "X needs to merge before Y else things break" and I just haven't had the time to focus and work it out.
This particular patch does not depend on another series being merged, and I believe I haven't sent a series depending on this one yet. However I did recently send other series with docs <-> yab-helper dependencies (the switcher menu work) so I could see this easily being mixed up.
Quoted 2 lines
This patch needs to be rebased as it doesn't apply as far as I can tell after spending too long trying to work out if I was missing a patch.
Sorry that's on me, I did not notice Yoann's patch. I will rebase and resend this.
Antonin