diff mbox series

[1/2] set_versions.py: skip laverne branch for closest branch

Message ID 20260402-set-versions-fixes-v1-1-0609a8747b96@bootlin.com
State New
Headers show
Series set_versions.py fixes | expand

Commit Message

Antonin Godard April 2, 2026, 8:13 a.m. UTC
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 <antonin.godard@bootlin.com>
---
 documentation/set_versions.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Quentin Schulz April 2, 2026, 8:22 a.m. UTC | #1
Hi Antonin,

On 4/2/26 10:13 AM, Antonin Godard via lists.yoctoproject.org wrote:
> 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 <antonin.godard@bootlin.com>
> ---
>   documentation/set_versions.py | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/documentation/set_versions.py b/documentation/set_versions.py
> index 29638b324..465204998 100755
> --- a/documentation/set_versions.py
> +++ b/documentation/set_versions.py
> @@ -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
Antonin Godard April 2, 2026, 8:28 a.m. UTC | #2
Hi,

On Thu Apr 2, 2026 at 10:22 AM CEST, Quentin Schulz via lists.yoctoproject.org wrote:
> Hi Antonin,
>
> On 4/2/26 10:13 AM, Antonin Godard via lists.yoctoproject.org wrote:
>> 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 <antonin.godard@bootlin.com>
>> ---
>>   documentation/set_versions.py | 5 +++++
>>   1 file changed, 5 insertions(+)
>> 
>> diff --git a/documentation/set_versions.py b/documentation/set_versions.py
>> index 29638b324..465204998 100755
>> --- a/documentation/set_versions.py
>> +++ b/documentation/set_versions.py
>> @@ -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?

An oversight, I'll move it above, thanks

Antonin
diff mbox series

Patch

diff --git a/documentation/set_versions.py b/documentation/set_versions.py
index 29638b324..465204998 100755
--- a/documentation/set_versions.py
+++ b/documentation/set_versions.py
@@ -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: