Message ID | 20250915-pass-bitbake-active-releases-v1-2-a5530a97b9ef@bootlin.com |
---|---|
State | New |
Headers | show |
Series | scripts/run-docs-build: improvements for the bitbake menu | expand |
Hi Antonin, On 9/15/25 2:19 PM, Antonin Godard via lists.yoctoproject.org wrote: > BitBake's doc now supports setting the active releases in the switchers > menu from an environment variable. Pass the active releases from the > list in yocto-docs/documentation/set_versions.py. This way we only have > to maintain active releases from the yocto-docs location. > > The latest_branch information is retrieved from it, otherwise we land on > the in-development branch (2.14) instead of the latest stable one > (2.12) - at the time of writing this commit message. > > Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> > --- > scripts/run-docs-build | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/scripts/run-docs-build b/scripts/run-docs-build > index aa1847d..549032f 100755 > --- a/scripts/run-docs-build > +++ b/scripts/run-docs-build > @@ -111,6 +111,11 @@ tar --exclude=eclipse -xJf ${docbookarchive_localpath} > > $scriptdir/docs_add_banner.py > > +# Retrieve the active bitbake releases from the yocto active releases, by using > +# set_versions.py from yocto-docs > +BITBAKE_ACTIVE_RELEASES=$("$ypdocs"/set_versions.py bitbake-active-releases) > +export BITBAKE_ACTIVE_RELEASES > + > cd $bbdocs > mkdir -p $outputdir/bitbake > > @@ -121,7 +126,8 @@ mkdir -p $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]*") > +# Get the latest branch from the active releases in BITBAKE_ACTIVE_RELEASES > +latest_branch="$(echo "$BITBAKE_ACTIVE_RELEASES" | cut -d',' -f1 | sort -V | tail -n 1)" I see... Bitbake development differs from YP's. BitBake already has a branch named after the next release, while YP only branches off soon before merging? Another option could be to simply list the tags, and the take the numerically highest one and extract the first two numbers. git tag --contains "$first_sphinx_commit" --sort='-version:refname' '[0-9]*.[0-9]*' | grep --max-count=1 -o "^[0-9]\+\.[0-9]\+" will return the branch, provided it's also one number dot one number for the branch from which we have a tag named one number dot one number dot one number (which may be 0). This avoids to rely on a script from outside of the bitbake repo or an environment variable. Cheers, Quentin
Hi Antonin, On 9/15/25 2:19 PM, Antonin Godard via lists.yoctoproject.org wrote: > BitBake's doc now supports setting the active releases in the switchers > menu from an environment variable. Pass the active releases from the > list in yocto-docs/documentation/set_versions.py. This way we only have > to maintain active releases from the yocto-docs location. > > The latest_branch information is retrieved from it, otherwise we land on > the in-development branch (2.14) instead of the latest stable one > (2.12) - at the time of writing this commit message. > > Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> > --- > scripts/run-docs-build | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/scripts/run-docs-build b/scripts/run-docs-build > index aa1847d..549032f 100755 > --- a/scripts/run-docs-build > +++ b/scripts/run-docs-build > @@ -111,6 +111,11 @@ tar --exclude=eclipse -xJf ${docbookarchive_localpath} > > $scriptdir/docs_add_banner.py > > +# Retrieve the active bitbake releases from the yocto active releases, by using > +# set_versions.py from yocto-docs > +BITBAKE_ACTIVE_RELEASES=$("$ypdocs"/set_versions.py bitbake-active-releases) > +export BITBAKE_ACTIVE_RELEASES > + > cd $bbdocs > mkdir -p $outputdir/bitbake > > @@ -121,7 +126,8 @@ mkdir -p $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]*") > +# Get the latest branch from the active releases in BITBAKE_ACTIVE_RELEASES > +latest_branch="$(echo "$BITBAKE_ACTIVE_RELEASES" | cut -d',' -f1 | sort -V | tail -n 1)" > > for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)'); do > if [ "$branch" = "HEAD" ]; then > @@ -132,7 +138,7 @@ for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --for > git checkout $branch > git reset --hard > git clean -ffdx > - git checkout origin/master releases.rst > + git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile I don't think we should be checking out Makefile from master, we would have to keep in mind that the Makefile needs to be backwards compatible forever. This is a big burden to carry IMO. If we really need something from the current Makefile, we can always patch the bitbake docs the same way we patch the yocto-docs on the fly. Cheers, Quentin
On Mon Sep 15, 2025 at 3:21 PM CEST, Quentin Schulz via lists.yoctoproject.org wrote: > Hi Antonin, > > On 9/15/25 2:19 PM, Antonin Godard via lists.yoctoproject.org wrote: >> BitBake's doc now supports setting the active releases in the switchers >> menu from an environment variable. Pass the active releases from the >> list in yocto-docs/documentation/set_versions.py. This way we only have >> to maintain active releases from the yocto-docs location. >> >> The latest_branch information is retrieved from it, otherwise we land on >> the in-development branch (2.14) instead of the latest stable one >> (2.12) - at the time of writing this commit message. >> >> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> >> --- >> scripts/run-docs-build | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/run-docs-build b/scripts/run-docs-build >> index aa1847d..549032f 100755 >> --- a/scripts/run-docs-build >> +++ b/scripts/run-docs-build >> @@ -111,6 +111,11 @@ tar --exclude=eclipse -xJf ${docbookarchive_localpath} >> >> $scriptdir/docs_add_banner.py >> >> +# Retrieve the active bitbake releases from the yocto active releases, by using >> +# set_versions.py from yocto-docs >> +BITBAKE_ACTIVE_RELEASES=$("$ypdocs"/set_versions.py bitbake-active-releases) >> +export BITBAKE_ACTIVE_RELEASES >> + >> cd $bbdocs >> mkdir -p $outputdir/bitbake >> >> @@ -121,7 +126,8 @@ mkdir -p $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]*") >> +# Get the latest branch from the active releases in BITBAKE_ACTIVE_RELEASES >> +latest_branch="$(echo "$BITBAKE_ACTIVE_RELEASES" | cut -d',' -f1 | sort -V | tail -n 1)" > > I see... Bitbake development differs from YP's. BitBake already has a > branch named after the next release, while YP only branches off soon > before merging? Yes exactly. With the current form, we'd get 2.14 as the default landing page. > Another option could be to simply list the tags, and the take the > numerically highest one and extract the first two numbers. > > git tag --contains "$first_sphinx_commit" --sort='-version:refname' > '[0-9]*.[0-9]*' | grep --max-count=1 -o "^[0-9]\+\.[0-9]\+" > > will return the branch, provided it's also one number dot one number for > the branch from which we have a tag named one number dot one number dot > one number (which may be 0). > > This avoids to rely on a script from outside of the bitbake repo or an > environment variable. Good idea, I'll see how that works out. Thanks, Antonin
On Mon Sep 15, 2025 at 3:31 PM CEST, Quentin Schulz via lists.yoctoproject.org wrote: > Hi Antonin, > > On 9/15/25 2:19 PM, Antonin Godard via lists.yoctoproject.org wrote: >> BitBake's doc now supports setting the active releases in the switchers >> menu from an environment variable. Pass the active releases from the >> list in yocto-docs/documentation/set_versions.py. This way we only have >> to maintain active releases from the yocto-docs location. >> >> The latest_branch information is retrieved from it, otherwise we land on >> the in-development branch (2.14) instead of the latest stable one >> (2.12) - at the time of writing this commit message. >> >> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> >> --- >> scripts/run-docs-build | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/run-docs-build b/scripts/run-docs-build >> index aa1847d..549032f 100755 >> --- a/scripts/run-docs-build >> +++ b/scripts/run-docs-build >> @@ -111,6 +111,11 @@ tar --exclude=eclipse -xJf ${docbookarchive_localpath} >> >> $scriptdir/docs_add_banner.py >> >> +# Retrieve the active bitbake releases from the yocto active releases, by using >> +# set_versions.py from yocto-docs >> +BITBAKE_ACTIVE_RELEASES=$("$ypdocs"/set_versions.py bitbake-active-releases) >> +export BITBAKE_ACTIVE_RELEASES >> + >> cd $bbdocs >> mkdir -p $outputdir/bitbake >> >> @@ -121,7 +126,8 @@ mkdir -p $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]*") >> +# Get the latest branch from the active releases in BITBAKE_ACTIVE_RELEASES >> +latest_branch="$(echo "$BITBAKE_ACTIVE_RELEASES" | cut -d',' -f1 | sort -V | tail -n 1)" >> >> for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)'); do >> if [ "$branch" = "HEAD" ]; then >> @@ -132,7 +138,7 @@ for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --for >> git checkout $branch >> git reset --hard >> git clean -ffdx >> - git checkout origin/master releases.rst >> + git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile > > I don't think we should be checking out Makefile from master, we would > have to keep in mind that the Makefile needs to be backwards compatible > forever. This is a big burden to carry IMO. > > If we really need something from the current Makefile, we can always > patch the bitbake docs the same way we patch the yocto-docs on the fly. Indeed, I don't think the Makefile was necessary to backport anyway, I'll remove it. Thanks, Antonin
diff --git a/scripts/run-docs-build b/scripts/run-docs-build index aa1847d..549032f 100755 --- a/scripts/run-docs-build +++ b/scripts/run-docs-build @@ -111,6 +111,11 @@ tar --exclude=eclipse -xJf ${docbookarchive_localpath} $scriptdir/docs_add_banner.py +# Retrieve the active bitbake releases from the yocto active releases, by using +# set_versions.py from yocto-docs +BITBAKE_ACTIVE_RELEASES=$("$ypdocs"/set_versions.py bitbake-active-releases) +export BITBAKE_ACTIVE_RELEASES + cd $bbdocs mkdir -p $outputdir/bitbake @@ -121,7 +126,8 @@ mkdir -p $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]*") +# Get the latest branch from the active releases in BITBAKE_ACTIVE_RELEASES +latest_branch="$(echo "$BITBAKE_ACTIVE_RELEASES" | cut -d',' -f1 | sort -V | tail -n 1)" for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)'); do if [ "$branch" = "HEAD" ]; then @@ -132,7 +138,7 @@ for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --for git checkout $branch git reset --hard git clean -ffdx - git checkout origin/master releases.rst + git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile ( . $builddir/buildtools/environment-setup*
BitBake's doc now supports setting the active releases in the switchers menu from an environment variable. Pass the active releases from the list in yocto-docs/documentation/set_versions.py. This way we only have to maintain active releases from the yocto-docs location. The latest_branch information is retrieved from it, otherwise we land on the in-development branch (2.14) instead of the latest stable one (2.12) - at the time of writing this commit message. Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- scripts/run-docs-build | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)