[yocto-autobuilder-helper][PATCH] scripts/run-docs-build: use bitbake's setversions.py to get the latest branch

Antonin Godard <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <20260429-fix-docs-bitbake-latest-branch-v1-1-25cce6bf4f26@bootlin.com>
The current script uses the list of branches to determine the current
latest bitbake version to show as the default page on
https://docs.yoctoproject.org/bitbake. However, this is not necessarily
the right branch, for example if the branch was created before it was
officially released.

Use the setversions.py script's --get-latest-branch argument for that,
which returns the latest branch based on what is found in the
releases.json file. Double check that this branch looks correct and exit
if not.

Signed-off-by: Antonin Godard <[email protected]>
---
NOTE: depends on https://lore.kernel.org/r/[email protected]
---
 scripts/run-docs-build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index acd8a24..090e5b0 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -111,7 +111,12 @@ mkdir $outputdir/bitbake
 # see the latest releases.
 first_sphinx_commit=84ccba0f4aff91528f764523fe1205a354c889ed
 
-latest_branch=$(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)' --sort='-version:refname' | grep --max-count=1 "[0-9]*\.[0-9]*")
+latest_branch=$(./setversions.py --get-latest-branch 2>/dev/null)
+if ! echo "$latest_branch" | grep -qE "^[0-9]+\.[0-9]+$"; then
+  echo "Got unexpected branch from ./set_versions.py: $latest_branch"
+  echo "Should be in X.Y format"
+  exit 1
+fi
 
 for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)'); do
     if [ "$branch" = "HEAD" ]; then

---
base-commit: 7ba82651cae130890e2120dccca939153ec7042e
change-id: 20260428-fix-docs-bitbake-latest-branch-6471c0a8e73a
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.