set_versions.py fixes
cover set_versions.py fixes
---
Antonin Godard (2):
set_versions.py: skip laverne branch for closest branch set_versions.py: fix get_latest_tag and milestone tags
documentation/set_versions.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
---
base-commit: dc1574b9f71532c469f355af2ff5ff5664083e48
change-id: 20260402-set-versions-fixes-a74b25ed253c
PATCH 1/2 set_versions.py: skip laverne branch for closest branch
The laverne branch was created but never branched off, which breaks the algorithm trying to determine the closest branch as it always gets count
0. Skip this branch as it is old and we'll never branch off of it now.
This fixes the following issue:
Branch laverne has count 0
Nearest release branch estimated to be laverne
Traceback (most recent call last):
File "/data/yoctoproject/ws/repos/yocto-docs/documentation/./set_versions.py", line 167, in <module>
bitbakeversion = bitbake_mapping[ourseries]
~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'laverne'
--- documentation/set_versions.py | 5 +++++ 1 file changed, 5 insertions(+)
documentation/set_versions.py +5 -0
@@ -142,6 +142,11 @@ if ourversion is None: result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + # The laverne branch was created but never branched off, which + # breaks this algorithm as this always gets count 0. Skip this + # branch as it is old and we'll never branch off of it now. + if b == "laverne": + continue if result.returncode == 0: count = result.stdout.count('\n') if not possible_branch or count < branch_count:
Signature · 1 line
2.53.0
Re: [docs] [PATCH 1/2] set_versions.py: skip laverne branch for closest branch
Hi Antonin,
Quoted 24 lines · Antonin Godard via lists.yoctoproject.org
The laverne branch was created but never branched off, which breaks the algorithm trying to determine the closest branch as it always gets count
0. Skip this branch as it is old and we'll never branch off of it now.This fixes the following issue:
Branch laverne has count 0
Nearest release branch estimated to be laverne
Traceback (most recent call last):
File "/data/yoctoproject/ws/repos/yocto-docs/documentation/./set_versions.py", line 167, in <module>
bitbakeversion = bitbake_mapping[ourseries]
~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'laverne'Signed-off-by Antonin Godard <[email protected]>--- documentation/set_versions.py | 5 +++++ 1 file changed, 5 insertions(+)documentation/set_versions.py +0
-0
documentation/set_versions.py if ourversion is None: · line 149
Quoted 8 lines
documentation/set_versions.py +5
-0@@ -142,6 +142,11 @@ if ourversion is None: result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + # The laverne branch was created but never branched off, which + # breaks this algorithm as this always gets count 0. Skip this + # branch as it is old and we'll never branch off of it now. + if b == "laverne": + continue
Why run the command if we're gonna skip the loop regardless of the result of the command? Just do the continue before the subprocess.run?
Cheers,
Quentin
Re: [docs] [PATCH 1/2] set_versions.py: skip laverne branch for closest branch
Hi,
Quoted 22 lines · Quentin Schulz via lists.yoctoproject.org
Hi Antonin,
Quoted 19 lines · Antonin Godard via lists.yoctoproject.org
The laverne branch was created but never branched off, which breaks the algorithm trying to determine the closest branch as it always gets count
0. Skip this branch as it is old and we'll never branch off of it now.This fixes the following issue:
Branch laverne has count 0
Nearest release branch estimated to be laverne
Traceback (most recent call last):
File "/data/yoctoproject/ws/repos/yocto-docs/documentation/./set_versions.py", line 167, in <module>
bitbakeversion = bitbake_mapping[ourseries]
~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'laverne'Signed-off-by Antonin Godard <[email protected]>--- documentation/set_versions.py | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 16 lines
documentation/set_versions.py if ourversion is None: · line 149
Quoted 13 lines
documentation/set_versions.py +5
-0@@ -142,6 +142,11 @@ if ourversion is None: result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + # The laverne branch was created but never branched off, which + # breaks this algorithm as this always gets count 0. Skip this + # branch as it is old and we'll never branch off of it now. + if b == "laverne": + continueWhy run the command if we're gonna skip the loop regardless of the result of the command? Just do the continue before the subprocess.run?
An oversight, I'll move it above, thanks
Antonin
PATCH 2/2 set_versions.py: fix get_latest_tag and milestone tags
In reply to Antonin GodardMilestone tags have a different format, e.g. 6.0_M1. This was breaking this algorithm with:
File ".../yocto-docs/documentation/./set_versions.py", line 277, in get_latest_tag
branch_versions = sorted(
[v.replace("yocto-" + release_series[branch] + ".", "")
.replace("yocto-" + release_series[branch], "0") for v in branch_versions],
key=int)ValueError: invalid literal for int() with base 10: '0_M1'
--- documentation/set_versions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
documentation/set_versions.py +5 -1
@@ -274,9 +274,13 @@ def get_latest_tag(branch: str) -> str: branch_versions = subprocess.run(["git", "tag", "--list", f'yocto-{release_series[branch]}*'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).stdout.split() + # Sort the branches as integers + # On milestone tags (e.g. 6.0_M2), remove everything after "_" (including + # "_") branch_versions = sorted( [v.replace("yocto-" + release_series[branch] + ".", "") - .replace("yocto-" + release_series[branch], "0") for v in branch_versions], + .replace("yocto-" + release_series[branch], "0") + .split("_")[0] for v in branch_versions], key=int) if not branch_versions: return ""
Signature · 1 line
2.53.0