[yocto-autobuilder-helper,2/6] scripts: run-docs-build: allow to pass buildtools script and docbook tarball paths

Message ID 20220419170730.124287-3-foss+yocto@0leil.net
State New
Headers show
Series [RFC] docs: update Bitbake objects.inv location for master branch | expand

Commit Message

Quentin Schulz April 19, 2022, 5:07 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Currently, the path to buildtools script and docbook tarball are
hardcoded to work on Yocto Project Autobuilder. However, this makes it
harder to contribute to this script because it is very unlikely those
paths exist on a developer PC.

Instead, let's allow to override variables by using the environment and
make the current hardcoded values the default ones.

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

Patch

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index 6e25549..6569928 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -2,6 +2,12 @@ 
 # Called with $1 as the build directory
 #             $2 as the path to yocto-docs
 #             $3 as the path to bitbake
+#
+# Environment variables:
+#   - docs_buildtools as the path to buildtools script for the docs.
+#                     Can be found here: https://autobuilder.yocto.io/pub/buildtools/
+#   - docbookarchive as the path to old (pre 3.1.5 and Sphinx migration) docs tarball
+#                     Can be found here: https://downloads.yoctoproject.org/mirror/docbook-mirror/docbook-archives-20201105.tar.xz
 
 set -e
 set -u
@@ -11,7 +17,7 @@  set -x
 builddir=$(realpath "$1")
 ypdocs=$(realpath "$2/documentation/")
 bbdocs=$(realpath "$3/doc/")
-docs_buildtools=/srv/autobuilder/autobuilder.yocto.io/pub/buildtools/x86_64-buildtools-docs-nativesdk-standalone-3.2+snapshot-20201105.sh
+docs_buildtools=${docs_buildtools:-/srv/autobuilder/autobuilder.yocto.io/pub/buildtools/x86_64-buildtools-docs-nativesdk-standalone-3.2+snapshot-20201105.sh}
 outputdir=$builddir/output
 scriptdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 
@@ -23,7 +29,7 @@  $docs_buildtools -y -d $builddir/buildtools
 
 # Getting the old docbook built docs from an archive. Not rebuilding them.
 #wget https://downloads.yoctoproject.org/mirror/docbook-mirror/docbook-archives-20201105.tar.xz
-docbookarchive=/srv/autobuilder/autobuilder.yocto.io/pub/docbook-mirror/docbook-archives-20201105.tar.xz
+docbookarchive=${docbookarchive:-/srv/autobuilder/autobuilder.yocto.io/pub/docbook-mirror/docbook-archives-20201105.tar.xz}
 mkdir $outputdir
 cd $outputdir
 echo Extracing old content from archive