diff mbox series

[yocto-autobuilder-helper,3/3] scripts/run-docs-build: pass version to bitbake docs build

Message ID 20250915-pass-bitbake-active-releases-v1-3-a5530a97b9ef@bootlin.com
State New
Headers show
Series scripts/run-docs-build: improvements for the bitbake menu | expand

Commit Message

Antonin Godard Sept. 15, 2025, 12:19 p.m. UTC
Bitbake's conf does is not aware of the current version it is building.
Pass the information, which is read from bitbake/doc/conf.py. We have to
checkout conf.py from master in additions to this, so this change
applied on all branches.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 scripts/run-docs-build | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Quentin Schulz Sept. 15, 2025, 1:30 p.m. UTC | #1
Hi Antonin,

On 9/15/25 2:19 PM, Antonin Godard via lists.yoctoproject.org wrote:
> Bitbake's conf does is not aware of the current version it is building.
> Pass the information, which is read from bitbake/doc/conf.py. We have to
> checkout conf.py from master in additions to this, so this change
> applied on all branches.
> 
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
>   scripts/run-docs-build | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/run-docs-build b/scripts/run-docs-build
> index 549032f..654b401 100755
> --- a/scripts/run-docs-build
> +++ b/scripts/run-docs-build
> @@ -138,7 +138,11 @@ 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 set_versions.py sphinx-static/switchers.js.in Makefile
> +    git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile conf.py

I don't think that's a good idea.

This forces us to never update any plugin conf.py uses otherwise we may 
not be able to build earlier versions of the docs.

I would suggest to follow what we've done for yocto-docs which is to 
have conf.py read an autogenerated poky.yaml (we can call it 
bitbake.yaml if we want) which sets the version of the docs to build.
How about current releases which are forced to "dev"? We patch them the 
same way we did for the yocto-docs, see patches in 
scripts/docs-build-patches.

> +
> +    # Pass this information to Bitbake so the docs gets built on the proper
> +    # version. See bitbake/doc/conf.py.
> +    export BITBAKE_CURRENT_VERSION="$branch"
>   
>       (
>           . $builddir/buildtools/environment-setup*
> @@ -213,7 +217,7 @@ for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
>           git am "${scriptdir}/docs-build-patches/${branch}/"000*
>       fi
>   
> -    git checkout origin/master sphinx-static/switchers.js.in set_versions.py
> +    git checkout tmp sphinx-static/switchers.js.in set_versions.py Makefile

tmp?

Cheers,
Quentin
Antonin Godard Sept. 15, 2025, 2:05 p.m. UTC | #2
On Mon Sep 15, 2025 at 3:30 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 conf does is not aware of the current version it is building.
>> Pass the information, which is read from bitbake/doc/conf.py. We have to
>> checkout conf.py from master in additions to this, so this change
>> applied on all branches.
>> 
>> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
>> ---
>>   scripts/run-docs-build | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/scripts/run-docs-build b/scripts/run-docs-build
>> index 549032f..654b401 100755
>> --- a/scripts/run-docs-build
>> +++ b/scripts/run-docs-build
>> @@ -138,7 +138,11 @@ 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 set_versions.py sphinx-static/switchers.js.in Makefile
>> +    git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile conf.py
>
> I don't think that's a good idea.
>
> This forces us to never update any plugin conf.py uses otherwise we may 
> not be able to build earlier versions of the docs.
>
> I would suggest to follow what we've done for yocto-docs which is to 
> have conf.py read an autogenerated poky.yaml (we can call it 
> bitbake.yaml if we want) which sets the version of the docs to build.

I don't really understand the advantage of having a yaml file for reading a
version value, instead of reading it from the environment. I asked the question
in another thread though so you answer here or in the other thread, up to you :)

> How about current releases which are forced to "dev"? We patch them the 
> same way we did for the yocto-docs, see patches in 
> scripts/docs-build-patches.

I see. I will adapt the former releases with a patch to use the current version
information.

>> +
>> +    # Pass this information to Bitbake so the docs gets built on the proper
>> +    # version. See bitbake/doc/conf.py.
>> +    export BITBAKE_CURRENT_VERSION="$branch"
>>   
>>       (
>>           . $builddir/buildtools/environment-setup*
>> @@ -213,7 +217,7 @@ for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
>>           git am "${scriptdir}/docs-build-patches/${branch}/"000*
>>       fi
>>   
>> -    git checkout origin/master sphinx-static/switchers.js.in set_versions.py
>> +    git checkout tmp sphinx-static/switchers.js.in set_versions.py Makefile
>
> tmp?

This slipped in from testing! Sorry.

Thanks!
Antonin
Quentin Schulz Sept. 15, 2025, 2:14 p.m. UTC | #3
On 9/15/25 4:05 PM, Antonin Godard via lists.yoctoproject.org wrote:
> On Mon Sep 15, 2025 at 3:30 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 conf does is not aware of the current version it is building.
>>> Pass the information, which is read from bitbake/doc/conf.py. We have to
>>> checkout conf.py from master in additions to this, so this change
>>> applied on all branches.
>>>
>>> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
>>> ---
>>>    scripts/run-docs-build | 8 ++++++--
>>>    1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/scripts/run-docs-build b/scripts/run-docs-build
>>> index 549032f..654b401 100755
>>> --- a/scripts/run-docs-build
>>> +++ b/scripts/run-docs-build
>>> @@ -138,7 +138,11 @@ 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 set_versions.py sphinx-static/switchers.js.in Makefile
>>> +    git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile conf.py
>>
>> I don't think that's a good idea.
>>
>> This forces us to never update any plugin conf.py uses otherwise we may
>> not be able to build earlier versions of the docs.
>>
>> I would suggest to follow what we've done for yocto-docs which is to
>> have conf.py read an autogenerated poky.yaml (we can call it
>> bitbake.yaml if we want) which sets the version of the docs to build.
> 
> I don't really understand the advantage of having a yaml file for reading a
> version value, instead of reading it from the environment. I asked the question
> in another thread though so you answer here or in the other thread, up to you :)
> 

Being as close as possible to yocto-docs's makes it that easier to patch 
and maintain whenever you need to.

Ideally, we could even just copy paste the whole script and it would 
work on both repos without changes.

It also means that if we autogenerate it the user doesn't need to think 
about anything, they get the docs, they build it, they get something as 
close as possible to what we generate without having to have to look at 
the yocto-autobuilder-helper does.

TL;DR: for consistency sake.
diff mbox series

Patch

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index 549032f..654b401 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -138,7 +138,11 @@  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 set_versions.py sphinx-static/switchers.js.in Makefile
+    git checkout origin/master releases.rst set_versions.py sphinx-static/switchers.js.in Makefile conf.py
+
+    # Pass this information to Bitbake so the docs gets built on the proper
+    # version. See bitbake/doc/conf.py.
+    export BITBAKE_CURRENT_VERSION="$branch"
 
     (
         . $builddir/buildtools/environment-setup*
@@ -213,7 +217,7 @@  for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
         git am "${scriptdir}/docs-build-patches/${branch}/"000*
     fi
 
-    git checkout origin/master sphinx-static/switchers.js.in set_versions.py
+    git checkout tmp sphinx-static/switchers.js.in set_versions.py Makefile
     if [ -e poky.yaml ]; then
         cp poky.yaml poky.yaml.in
         case $branch in