diff mbox series

[yocto-autobuilder-helper,v2] scripts/docs-build-patches: support custom BitBake switchers.js menu

Message ID 20260205-bitbake-custom-switchers-v2-1-7679968e0539@bootlin.com
State New
Headers show
Series [yocto-autobuilder-helper,v2] scripts/docs-build-patches: support custom BitBake switchers.js menu | expand

Commit Message

Antonin Godard Feb. 5, 2026, 3:26 p.m. UTC
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
IMPORTANT: this depends on
https://lore.kernel.org/r/20260205-fix-switchers-js-v3-1-61b4401adfdf@bootlin.com
being merged on master.
---
Changes in v2:
- Re-adapt after bitbake patch was resent.
- Link to v1: https://patch.msgid.link/20260204-bitbake-custom-switchers-v1-1-5b2ec5229fad@bootlin.com
---
 ...doc-conf.py-adapt-for-custom-switchers.js.patch | 39 ++++++++++++++++++++
 ...doc-conf.py-adapt-for-custom-switchers.js.patch | 40 +++++++++++++++++++++
 scripts/docs-build-patches/bitbake/1.50            |  1 +
 scripts/docs-build-patches/bitbake/1.52            |  1 +
 scripts/docs-build-patches/bitbake/2.0             |  1 +
 scripts/docs-build-patches/bitbake/2.10            |  1 +
 scripts/docs-build-patches/bitbake/2.12            |  1 +
 ...doc-conf.py-adapt-for-custom-switchers.js.patch | 41 ++++++++++++++++++++++
 scripts/docs-build-patches/bitbake/2.2             |  1 +
 scripts/docs-build-patches/bitbake/2.4             |  1 +
 scripts/docs-build-patches/bitbake/2.6             |  1 +
 scripts/docs-build-patches/bitbake/2.8             |  1 +
 scripts/run-docs-build                             | 12 ++++---
 13 files changed, 136 insertions(+), 5 deletions(-)


---
base-commit: ec17abb0b2d759b800cefec4fcac61cee74dbefc
change-id: 20260204-bitbake-custom-switchers-b3812e99e625
diff mbox series

Patch

diff --git a/scripts/docs-build-patches/bitbake/1.46/0001-doc-conf.py-adapt-for-custom-switchers.js.patch b/scripts/docs-build-patches/bitbake/1.46/0001-doc-conf.py-adapt-for-custom-switchers.js.patch
new file mode 100644
index 0000000..c089595
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/1.46/0001-doc-conf.py-adapt-for-custom-switchers.js.patch
@@ -0,0 +1,39 @@ 
+From 9ae0da4650aea70ed85982a5d5121238175e6f21 Mon Sep 17 00:00:00 2001
+From: Antonin Godard <antonin.godard@bootlin.com>
+Date: Thu, 5 Feb 2026 15:50:45 +0100
+Subject: [PATCH] doc/conf.py: adapt for custom switchers.js
+
+Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
+---
+ doc/conf.py | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/doc/conf.py b/doc/conf.py
+index fc2ee081119..4d066101a79 100644
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -16,8 +16,12 @@
+ 
+ import sys
+ import datetime
++import os
+ 
+-current_version = "dev"
++sys.path.insert(0, os.path.abspath('.'))
++import setversions
++
++current_version = setversions.get_current_version()
+ 
+ # String used in sidebar
+ version = 'Version: ' + current_version
+@@ -26,6 +30,10 @@ if current_version == 'dev':
+ # Version seen in documentation_options.js and hence in js switchers code
+ release = current_version
+ 
++setversions.write_switchers_js("sphinx-static/switchers.js.in",
++                               "sphinx-static/switchers.js",
++                               current_version)
++
+ # -- Project information -----------------------------------------------------
+ 
+ project = 'Bitbake'
diff --git a/scripts/docs-build-patches/bitbake/1.48/0001-doc-conf.py-adapt-for-custom-switchers.js.patch b/scripts/docs-build-patches/bitbake/1.48/0001-doc-conf.py-adapt-for-custom-switchers.js.patch
new file mode 100644
index 0000000..3d7653a
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/1.48/0001-doc-conf.py-adapt-for-custom-switchers.js.patch
@@ -0,0 +1,40 @@ 
+From dfe8e1431208a593b0c6f525831d52960a384174 Mon Sep 17 00:00:00 2001
+From: Antonin Godard <antonin.godard@bootlin.com>
+Date: Thu, 5 Feb 2026 15:50:45 +0100
+Subject: [PATCH] doc/conf.py: adapt for custom switchers.js
+
+Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
+---
+ doc/conf.py | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/doc/conf.py b/doc/conf.py
+index 354dff36f71..4d88286a4b8 100644
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -15,8 +15,13 @@
+ # sys.path.insert(0, os.path.abspath('.'))
+ 
+ import datetime
++import os
++import sys
+ 
+-current_version = "dev"
++sys.path.insert(0, os.path.abspath('.'))
++import setversions
++
++current_version = setversions.get_current_version()
+ 
+ # String used in sidebar
+ version = 'Version: ' + current_version
+@@ -25,6 +30,10 @@ if current_version == 'dev':
+ # Version seen in documentation_options.js and hence in js switchers code
+ release = current_version
+ 
++setversions.write_switchers_js("sphinx-static/switchers.js.in",
++                               "sphinx-static/switchers.js",
++                               current_version)
++
+ # -- Project information -----------------------------------------------------
+ 
+ project = 'Bitbake'
diff --git a/scripts/docs-build-patches/bitbake/1.50 b/scripts/docs-build-patches/bitbake/1.50
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/1.50
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/1.52 b/scripts/docs-build-patches/bitbake/1.52
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/1.52
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.0 b/scripts/docs-build-patches/bitbake/2.0
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.0
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.10 b/scripts/docs-build-patches/bitbake/2.10
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.10
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.12 b/scripts/docs-build-patches/bitbake/2.12
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.12
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.16/0001-doc-conf.py-adapt-for-custom-switchers.js.patch b/scripts/docs-build-patches/bitbake/2.16/0001-doc-conf.py-adapt-for-custom-switchers.js.patch
new file mode 100644
index 0000000..a8224d0
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.16/0001-doc-conf.py-adapt-for-custom-switchers.js.patch
@@ -0,0 +1,41 @@ 
+From ef23395086f4e3d6720d1b137ba4a7dd12f95540 Mon Sep 17 00:00:00 2001
+From: Antonin Godard <antonin.godard@bootlin.com>
+Date: Thu, 5 Feb 2026 15:50:45 +0100
+Subject: [PATCH] doc/conf.py: adapt for custom switchers.js
+
+Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
+---
+ doc/conf.py | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/doc/conf.py b/doc/conf.py
+index bce386624e..e74905b6fc 100644
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -16,10 +16,14 @@
+ 
+ import sys
+ import datetime
++import os
+ 
+ from pathlib import Path
+ 
+-current_version = "dev"
++sys.path.insert(0, os.path.abspath('.'))
++import setversions
++
++current_version = setversions.get_current_version()
+ 
+ # String used in sidebar
+ version = 'Version: ' + current_version
+@@ -28,6 +32,10 @@ if current_version == 'dev':
+ # Version seen in documentation_options.js and hence in js switchers code
+ release = current_version
+ 
++setversions.write_switchers_js("sphinx-static/switchers.js.in",
++                               "sphinx-static/switchers.js",
++                               current_version)
++
+ # -- Project information -----------------------------------------------------
+ 
+ project = 'Bitbake'
diff --git a/scripts/docs-build-patches/bitbake/2.2 b/scripts/docs-build-patches/bitbake/2.2
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.2
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.4 b/scripts/docs-build-patches/bitbake/2.4
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.4
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.6 b/scripts/docs-build-patches/bitbake/2.6
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.6
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/docs-build-patches/bitbake/2.8 b/scripts/docs-build-patches/bitbake/2.8
new file mode 120000
index 0000000..644f9b3
--- /dev/null
+++ b/scripts/docs-build-patches/bitbake/2.8
@@ -0,0 +1 @@ 
+1.46
\ No newline at end of file
diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index b83799a..04ae26a 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -118,7 +118,13 @@  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
+
+    if [ -e "${scriptdir}/docs-build-patches/bitbake/${branch}" ]; then
+        echo Adding patch for $branch
+        git am -3 "${scriptdir}/docs-build-patches/bitbake/${branch}/"000*
+    fi
+
+    git checkout origin/master releases.rst sphinx-static/switchers.js.in setversions.py
 
     (
         . $builddir/buildtools/environment-setup*
@@ -243,10 +249,6 @@  for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
     git clean -ffdx
 done
 
-# Update bitbake switchers.js with the copy from master ypdocs
-cd $outputdir/bitbake
-find . -name switchers.js -exec cp $outputdir/current/_static/switchers.js {} \;
-
 if [ "$PUBLISH" -ne 0 ]; then
     cd $outputdir
     rsync -irlp --checksum --ignore-times --delete . docs@docs.yoctoproject.org:docs/