diff mbox series

[v2] doc/setversions.py: add --get-latest-branch argument

Message ID 20260430-doc-get-latest-branch-v2-1-fda956696a61@bootlin.com
State Accepted, archived
Commit fdfb4925f4e8ca27f4da47e1bb38059a4a7dde58
Headers show
Series [v2] doc/setversions.py: add --get-latest-branch argument | expand

Commit Message

Antonin Godard April 30, 2026, 1:18 p.m. UTC
Add a --get-latest-branch argument that can be used to show the latest
branch from the parsed releases.json file. This will be used by the
Autobuilder to know what the version of the default bitbake docs page
should be.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
https://lore.kernel.org/r/20260429-fix-docs-bitbake-latest-branch-v1-1-25cce6bf4f26@bootlin.com

Note: Companion patch on yocto-autobuilder-helper:
---
Changes in v2:
- Fixup help message as suggested by Quentin
- Link to v1: https://patch.msgid.link/20260429-doc-get-latest-branch-v1-1-e5a0ce87cec4@bootlin.com

To: bitbake-devel@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: docs@lists.yoctoproject.org
---
 doc/setversions.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)


---
base-commit: b79667b6599494a0ed209d48bf8bbb7e8921d926
change-id: 20260428-doc-get-latest-branch-d17e0de248a3

Comments

Quentin Schulz May 7, 2026, 10:54 a.m. UTC | #1
Hi Antonin,

On 4/30/26 3:18 PM, Antonin Godard via lists.openembedded.org wrote:
> Add a --get-latest-branch argument that can be used to show the latest
> branch from the parsed releases.json file. This will be used by the
> Autobuilder to know what the version of the default bitbake docs page
> should be.
> 
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
> https://lore.kernel.org/r/20260429-fix-docs-bitbake-latest-branch-v1-1-25cce6bf4f26@bootlin.com
> 
> Note: Companion patch on yocto-autobuilder-helper:
> ---
> Changes in v2:
> - Fixup help message as suggested by Quentin
> - Link to v1: https://patch.msgid.link/20260429-doc-get-latest-branch-v1-1-e5a0ce87cec4@bootlin.com
> 
> To: bitbake-devel@lists.openembedded.org
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: docs@lists.yoctoproject.org
> ---
>   doc/setversions.py | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/doc/setversions.py b/doc/setversions.py
> index f1aea0a4225..dc0bb11e75e 100755
> --- a/doc/setversions.py
> +++ b/doc/setversions.py
> @@ -13,6 +13,7 @@
>   # SPDX-License-Identifier: MIT
>   #
>   
> +import argparse
>   import itertools
>   import json
>   import os
> @@ -23,6 +24,15 @@ import textwrap
>   
>   from urllib.request import urlopen, URLError
>   
> +parser = argparse.ArgumentParser(
> +    description="Parse https://dashboard.yoctoproject.org/releases.json to get current releases information"
> +)
> +parser.add_argument("--get-latest-branch",
> +                    help="Print current latest branch and exit",
> +                    action="store_true",
> +                    default=False)
> +args = parser.parse_args()
> +
>   # NOTE: the following variables contain default values in case we are not able to fetch
>   # the releases.json file from https://dashboard.yoctoproject.org/releases.json
>   DEVBRANCH = "2.18"
> @@ -85,6 +95,10 @@ if RELEASES_FROM_JSON:
>       # current releases is also an LTS
>       ACTIVERELEASES = list(dict.fromkeys([current_branch] + LTSSERIES))
>   
> +if args.get_latest_branch:
> +    print(ACTIVERELEASES[0])

I don't remember how https://dashboard.yoctoproject.org/releases.json is 
generated and whether the first entry in the array is necessarily the 
latest available release, but if that's the case then that's fine, so:

Acked-by: Quentin Schulz <quentin.schulz@cherry.de>

Thanks!
Quentin
diff mbox series

Patch

diff --git a/doc/setversions.py b/doc/setversions.py
index f1aea0a4225..dc0bb11e75e 100755
--- a/doc/setversions.py
+++ b/doc/setversions.py
@@ -13,6 +13,7 @@ 
 # SPDX-License-Identifier: MIT
 #
 
+import argparse
 import itertools
 import json
 import os
@@ -23,6 +24,15 @@  import textwrap
 
 from urllib.request import urlopen, URLError
 
+parser = argparse.ArgumentParser(
+    description="Parse https://dashboard.yoctoproject.org/releases.json to get current releases information"
+)
+parser.add_argument("--get-latest-branch",
+                    help="Print current latest branch and exit",
+                    action="store_true",
+                    default=False)
+args = parser.parse_args()
+
 # NOTE: the following variables contain default values in case we are not able to fetch
 # the releases.json file from https://dashboard.yoctoproject.org/releases.json
 DEVBRANCH = "2.18"
@@ -85,6 +95,10 @@  if RELEASES_FROM_JSON:
     # current releases is also an LTS
     ACTIVERELEASES = list(dict.fromkeys([current_branch] + LTSSERIES))
 
+if args.get_latest_branch:
+    print(ACTIVERELEASES[0])
+    sys.exit(0)
+
 print(f"ACTIVERELEASES calculated to be {ACTIVERELEASES}", file=sys.stderr)
 print(f"DEVBRANCH calculated to be {DEVBRANCH}", file=sys.stderr)
 print(f"LTSSERIES calculated to be {LTSSERIES}", file=sys.stderr)