@@ -12,6 +12,9 @@
# - docbookarchive_url 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
# - PUBLISH (0/1) for whether the files should be rsync'ed to docs.yoctoproject.org
+#
+# We source multiple external files here, ignore this warning.
+# shellcheck disable=SC1090
set -e
set -u
@@ -24,36 +27,36 @@ bbdocs=$(realpath "$3/doc/")
outputdir=$builddir/output
scriptdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
PUBLISH=${PUBLISH:-1}
-sharedir=`jq -r '.["BASE_SHAREDDIR"]' < $HOME/config-local.json`
+sharedir="$(jq -r '.["BASE_SHAREDDIR"]' < "$HOME"/config-local.json)"
# Modified 5.1 tools image to include rsvg, switch to next released version
buildtools_url=${buildtools_url:-https://downloads.yoctoproject.org/releases/yocto/milestones/yocto-6.0_M2/buildtools/x86_64-buildtools-docs-nativesdk-standalone-5.3.99%2Bsnapshot-be8cdcf13a658e9e81ff2f7b71d1c8c37a920ce7.sh}
buildtools_url_old=${buildtools_url_old:-https://downloads.yoctoproject.org/releases/yocto/yocto-4.1.2/buildtools/x86_64-buildtools-docs-nativesdk-standalone-4.1.2.sh}
docbookarchive_url=${docbookarchive_url:-https://downloads.yoctoproject.org/mirror/docbook-mirror/docbook-archives-20201105.tar.xz}
-buildtools_name=`basename $buildtools_url`
+buildtools_name="$(basename "$buildtools_url")"
buildtools_localpath=${sharedir}/cluster-downloads-cache/${buildtools_name}
-if [ ! -e ${buildtools_localpath} ]; then
- mkdir -p `dirname ${buildtools_localpath}`
- wget ${buildtools_url} -O ${buildtools_localpath}
- chmod a+x ${buildtools_localpath}
+if [ ! -e "${buildtools_localpath}" ]; then
+ mkdir -p "$(dirname "${buildtools_localpath}")"
+ wget "${buildtools_url}" -O "${buildtools_localpath}"
+ chmod a+x "${buildtools_localpath}"
fi
-cd $builddir
+cd "$builddir"
mkdir buildtools
-${buildtools_localpath} -y -d $builddir/buildtools
+${buildtools_localpath} -y -d "$builddir"/buildtools
-buildtools_name_old=`basename $buildtools_url_old`
+buildtools_name_old="$(basename "$buildtools_url_old")"
buildtools_localpath_old=${sharedir}/cluster-downloads-cache/${buildtools_name_old}
-if [ ! -e ${buildtools_localpath_old} ]; then
- mkdir -p `dirname ${buildtools_localpath_old}`
- wget ${buildtools_url_old} -O ${buildtools_localpath_old}
- chmod a+x ${buildtools_localpath_old}
+if [ ! -e "${buildtools_localpath_old}" ]; then
+ mkdir -p "$(dirname "${buildtools_localpath_old}")"
+ wget "${buildtools_url_old}" -O "${buildtools_localpath_old}"
+ chmod a+x "${buildtools_localpath_old}"
fi
-cd $builddir
+cd "$builddir"
mkdir buildtools-old
-${buildtools_localpath_old} -y -d $builddir/buildtools-old
+${buildtools_localpath_old} -y -d "$builddir"/buildtools-old
# To build the latexpdf output we need Xetex (which can handle international characters)
@@ -84,25 +87,25 @@ fi
export FONTCONFIG_PATH="$scriptdir/docsfontconfig"
# Getting the old docbook built docs from an archive. Not rebuilding them.
-docbookarchive_localpath=${sharedir}/cluster-downloads-cache/`basename ${docbookarchive_url}`
-if [ ! -e ${docbookarchive_localpath} ]; then
- mkdir -p `dirname ${docbookarchive_localpath}`
- wget ${docbookarchive_url} -O ${docbookarchive_localpath}
+docbookarchive_localpath="${sharedir}/cluster-downloads-cache/$(basename "${docbookarchive_url}")"
+if [ ! -e "${docbookarchive_localpath}" ]; then
+ mkdir -p "$(dirname "${docbookarchive_localpath}")"
+ wget "${docbookarchive_url}" -O "${docbookarchive_localpath}"
fi
-mkdir $outputdir
-cd $outputdir
+mkdir "$outputdir"
+cd "$outputdir"
echo Extracting old content from archive
-tar --exclude=eclipse -xJf ${docbookarchive_localpath}
+tar --exclude=eclipse -xJf "${docbookarchive_localpath}"
-$scriptdir/docs_add_banner.py
+"$scriptdir"/docs_add_banner.py
# generate the releases.json in PWD
-$scriptdir/release-parser.py "$ypdocs/.." "$bbdocs/.."
+"$scriptdir"/release-parser.py "$ypdocs/.." "$bbdocs/.."
cp releases.json "$builddir"
-cd $bbdocs
-mkdir $outputdir/bitbake
+cd "$bbdocs"
+mkdir "$outputdir"/bitbake
# A decision was made to keep updating all the Sphinx generated docs for the moment,
# even the ones corresponding to no longer supported releases
@@ -123,20 +126,20 @@ for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --for
continue
fi
- echo Building bitbake $branch branch
- git checkout $branch
+ echo "Building bitbake $branch branch"
+ git checkout "$branch"
git reset --hard
git clean -ffdx
if [ -e "${scriptdir}/docs-build-patches/bitbake/${branch}" ]; then
- echo Adding patch for $branch
+ echo "Adding patch for $branch"
git am -3 "${scriptdir}/docs-build-patches/bitbake/${branch}/"000*
fi
git checkout origin/master sphinx-static/switchers.js.in setversions.py
(
- . $builddir/buildtools/environment-setup*
+ . "$builddir"/buildtools/environment-setup*
make clean
cp "$builddir"/releases.json "$bbdocs"/
SPHINXOPTS="-j auto" make publish
@@ -144,19 +147,19 @@ for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --for
if [ "$branch" = "master-next" ]; then
branch="next"
- mkdir $outputdir/bitbake/$branch
+ mkdir "$outputdir/bitbake/$branch"
elif [ "$branch" = "master" ]; then
branch="dev"
- mkdir $outputdir/bitbake/$branch
+ mkdir "$outputdir/bitbake/$branch"
elif [ "$branch" = "$latest_branch" ]; then
branch=""
- mkdir $outputdir/bitbake/$latest_branch
- cp -r ./_build/final/* $outputdir/bitbake/$latest_branch
+ mkdir "$outputdir/bitbake/$latest_branch"
+ cp -r ./_build/final/* "$outputdir/bitbake/$latest_branch"
else
- mkdir $outputdir/bitbake/$branch
+ mkdir "$outputdir/bitbake/$branch"
fi
- cp -r ./_build/final/* $outputdir/bitbake/$branch
+ cp -r ./_build/final/* "$outputdir/bitbake/$branch"
git reset --hard
git clean -ffdx
done
@@ -164,11 +167,11 @@ done
if [ "$PUBLISH" -ne 0 ]; then
# only sync bitbake folder for now. We need bitbake to be published first
# since the bitbake intersphinx index will be downloaded to build yocto-docs
- cd $outputdir
+ cd "$outputdir"
rsync -irlp --checksum --ignore-times --delete bitbake docs@docs.yoctoproject.org:docs/
fi
-cd $ypdocs
+cd "$ypdocs"
# transition must build after master for the switchers.js file
# Again, keeping even the no longer supported releases (see above comment)
@@ -206,13 +209,13 @@ for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
continue
fi
- echo Building $branch
- git checkout $branch
+ echo "Building $branch"
+ git checkout "$branch"
git reset --hard
git clean -ffdx
if [ -e "${scriptdir}/docs-build-patches/${branch}/" ]; then
- echo Adding patch for $branch
+ echo "Adding patch for $branch"
git apply -3 "${scriptdir}/docs-build-patches/${branch}/"000*
fi
@@ -227,9 +230,9 @@ for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
(
# Anything older than scarthgap needs the older buildtools
if git merge-base --is-ancestor 0cdc0afd3332459d30cfc8f4c2e62bdcc23f5ed5 HEAD; then
- . $builddir/buildtools/environment-setup*
+ . "$builddir"/buildtools/environment-setup*
else
- . $builddir/buildtools-old/environment-setup*
+ . "$builddir"/buildtools-old/environment-setup*
fi
make clean
@@ -244,28 +247,28 @@ for branch in "$ypdocsbranch" dunfell $(git branch --remote --contains "$first_s
if [ "$branch" = "master-next" ]; then
branch="next"
- mkdir -p $outputdir/$branch
+ mkdir -p "$outputdir/$branch"
elif [ "$branch" = "master" ]; then
branch="dev"
- mkdir -p $outputdir/$branch
+ mkdir -p "$outputdir/$branch"
elif [ "$branch" = "$latest_tag" ]; then
branch=""
- mkdir -p $outputdir/$latest_tag
- cp -r ./_build/final/* $outputdir/$latest_tag
- echo Linking to $latest_tag as current
- ln -s $latest_tag $outputdir/current
+ mkdir -p "$outputdir/$latest_tag"
+ cp -r ./_build/final/* "$outputdir/$latest_tag"
+ echo "Linking to $latest_tag as current"
+ ln -s "$latest_tag" "$outputdir"/current
elif [ "$branch" = "transition" ]; then
branch=""
else
- mkdir -p $outputdir/$branch
+ mkdir -p "$outputdir/$branch"
fi
- cp -r ./_build/final/* $outputdir/$branch
+ cp -r ./_build/final/* "$outputdir/$branch"
git reset --hard
git clean -ffdx
done
if [ "$PUBLISH" -ne 0 ]; then
- cd $outputdir
+ cd "$outputdir"
rsync -irlp --checksum --ignore-times --delete . docs@docs.yoctoproject.org:docs/
fi
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> --- scripts/run-docs-build | 107 +++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 52 deletions(-)