diff mbox series

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

Message ID 20260429-fix-docs-bitbake-latest-branch-v1-1-25cce6bf4f26@bootlin.com
State New
Headers show
Series [yocto-autobuilder-helper] scripts/run-docs-build: use bitbake's setversions.py to get the latest branch | expand

Commit Message

Antonin Godard April 29, 2026, 9:15 a.m. UTC
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 <antonin.godard@bootlin.com>
---
NOTE: depends on https://lore.kernel.org/r/20260429-doc-get-latest-branch-v1-1-e5a0ce87cec4@bootlin.com
---
 scripts/run-docs-build | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


---
base-commit: 7ba82651cae130890e2120dccca939153ec7042e
change-id: 20260428-fix-docs-bitbake-latest-branch-6471c0a8e73a
diff mbox series

Patch

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