[yocto-autobuilder-helper,5/6] scripts: run-docs-build: simplify sphinx-buildable yocto-docs tag list fetching

Message ID 20220318163651.3016936-5-foss+yocto@0leil.net
State New
Headers show
Series [yocto-autobuilder-helper,1/6] scripts: run-docs-build: factor out all bitbake branches building | expand

Commit Message

Quentin Schulz March 18, 2022, 4:36 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

The commit that introduced Sphinx support in yocto-docs is
01dd5af7954e24552aca022917669b27bb0541ed. Any tag containing this commit
is buildable by sphinx.

Dunfell tags don't all have Sphinx support. However, all tags containing
the introducing commit c25fe058b88b893b0d146f3ed27320b47cdec236 are
buildable by sphinx.

Therefore, let's just list all tags which contains either of those two
commits instead of the complex series of pipes and shell commands.

Cc: Quentin Schulz <foss+yocto@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 scripts/run-docs-build | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

Comments

Michael Opdenacker March 21, 2022, 9:11 a.m. UTC | #1
On 3/18/22 17:36, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> The commit that introduced Sphinx support in yocto-docs is
> 01dd5af7954e24552aca022917669b27bb0541ed. Any tag containing this commit
> is buildable by sphinx.
>
> Dunfell tags don't all have Sphinx support. However, all tags containing
> the introducing commit c25fe058b88b893b0d146f3ed27320b47cdec236 are
> buildable by sphinx.
>
> Therefore, let's just list all tags which contains either of those two
> commits instead of the complex series of pipes and shell commands.
>
> Cc: Quentin Schulz <foss+yocto@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>  scripts/run-docs-build | 36 +++++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 19 deletions(-)


Thanks for the simplification!
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cheers
Michael.

Patch

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index 1656975..ab5b6db 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -102,27 +102,25 @@  for branch in dunfell transition $(git branch --remote --contains "$first_sphinx
 done
 
 # Yocto Project releases/tags
-v_sphinx='yocto-3.1.5' #This and newer versions have Sphinx docs.
+first_dunfell_sphinx_commit=c25fe058b88b893b0d146f3ed27320b47cdec236
+
 cd $ypdocs
-for tag in $(git tag --list 'yocto-*'); do
-    first=$(printf '%s\n%s' $tag $v_sphinx | sort --version-sort | head -n1)
-    if [ "$first" = "$v_sphinx" ]; then
-        echo Processing $tag
-        cd $ypdocs
-        git checkout $tag
-	if [ -e "${scriptdir}/docs-build-patches/${tag}/" ]; then
-            echo Adding patch for $tag
-            git am "${scriptdir}/docs-build-patches/${tag}/"000*
-        fi
-        git checkout master releases.rst
-        make clean
-        make publish
-        version=$(echo $tag | cut -c7-)
-        mkdir $outputdir/$version
-        cp -r ./_build/final/* $outputdir/$version
-        git reset --hard
-        echo Finished processing $tag
+for tag in $(git tag --contains "$first_sphinx_commit" --contains "$first_dunfell_sphinx_commit" 'yocto-*'); do
+    echo Processing $tag
+    cd $ypdocs
+    git checkout $tag
+    if [ -e "${scriptdir}/docs-build-patches/${tag}/" ]; then
+        echo Adding patch for $tag
+        git am "${scriptdir}/docs-build-patches/${tag}/"000*
     fi
+    git checkout master releases.rst
+    make clean
+    make publish
+    version=$(echo $tag | cut -c7-)
+    mkdir $outputdir/$version
+    cp -r ./_build/final/* $outputdir/$version
+    git reset --hard
+    echo Finished processing $tag
 done
 
 # get current release (e.g. most recent tag), and add a 'current' link