new file mode 120000
@@ -0,0 +1 @@
+Containerfile.dnf
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,26 @@
+ARG ARG_FROM=debian:12 # default value to avoid warning
+FROM $ARG_FROM
+
+ARG DOCS=ubuntu_docs.sh
+ARG DOCS_PDF=ubuntu_docs_pdf.sh
+
+ENV DEBIAN_FRONTEND=noninteractive
+ARG TZ=Europe/Vienna
+
+# relative to the location of the dockerfile
+COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh
+COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh
+
+RUN ln -fs "/usr/share/zoneinfo/$TZ" /etc/localtime \
+ && apt-get update \
+ && apt-get install -y sudo \
+ && yes | /temp/host_packages_docs.sh \
+ && yes | /temp/host_packages_docs_pdf.sh \
+ && apt-get --yes autoremove \
+ && apt-get clean \
+ && rm -rf /temp
+
+RUN git config --global --add safe.directory /docs
+
+ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"]
+CMD ["publish"]
new file mode 120000
@@ -0,0 +1 @@
+Containerfile.apt
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,25 @@
+ARG ARG_FROM=fedora:40 # default value to avoid warning
+FROM $ARG_FROM
+
+ARG DOCS=fedora_docs.sh
+ARG DOCS_PDF=fedora_docs_pdf.sh
+ARG PIP3=pip3_docs.sh
+
+# relative to the location of the dockerfile
+COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh
+COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh
+COPY --chmod=777 ${PIP3} /temp/pip3_docs.sh
+
+RUN dnf update -y \
+ && dnf install -y sudo \
+ && yes | /temp/host_packages_docs.sh \
+ && yes | /temp/host_packages_docs_pdf.sh \
+ && yes | /temp/pip3_docs.sh \
+ && dnf autoremove -y \
+ && dnf clean all -y \
+ && rm -rf /temp
+
+RUN git config --global --add safe.directory /docs
+
+ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"]
+CMD ["publish"]
new file mode 120000
@@ -0,0 +1 @@
+Containerfile.dnf
\ No newline at end of file
new file mode 120000
@@ -0,0 +1 @@
+Containerfile.apt
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,24 @@
+ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning
+FROM $ARG_FROM
+
+ARG DOCS=opensuse_docs.sh
+ARG DOCS_PDF=opensuse_docs_pdf.sh
+ARG PIP3=pip3_docs.sh
+
+# relative to the location of the dockerfile
+COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh
+COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh
+COPY --chmod=777 ${PIP3} /temp/pip3_docs.sh
+
+RUN zypper update -y \
+ && zypper install -y sudo \
+ && yes | /temp/host_packages_docs.sh \
+ && yes | /temp/host_packages_docs_pdf.sh \
+ && yes | /temp/pip3_docs.sh \
+ && zypper clean --all \
+ && rm -rf /temp
+
+RUN git config --global --add safe.directory /docs
+
+ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"]
+CMD ["publish"]
new file mode 100755
@@ -0,0 +1,113 @@
+#!/usr/bin/env bash
+#
+# Build a container ready to build the documentation be reading the dependencies
+# listed in shell scripts in documentation/tools/host_packages_scripts, and
+# start a documentation build in this container.
+#
+# Usage:
+#
+# ./documentation/tools/build-docs-container <image> [<make target>]
+#
+# e.g.:
+#
+# ./documentation/tools/build-docs-container ubuntu:24.04 html
+#
+# Will build the docs in an Ubuntu 24.04 container in html.
+#
+# The container engine can be selected by exporting CONTAINERCMD in the
+# environment. The default is docker, but podman can also be used.
+
+set -eu -o pipefail
+
+SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
+CONTAINERCMD=${CONTAINERCMD:-docker}
+DOCS_DIR="$SCRIPT_DIR/../.."
+SH_DIR="$SCRIPT_DIR/host_packages_scripts"
+
+main ()
+{
+ local image="$1"
+ shift
+
+ OCI=$(which "$CONTAINERCMD")
+
+ # docker build doesn't accept 2 colons, so "sanitize" the name
+ local sanitized_dockername
+ sanitized_dockername=$(echo "$image" | tr ':.' '-')
+
+ local version
+ version=$(echo "$image" | awk -F: '{print $NF}')
+
+ case $image in
+ almalinux*)
+ containerfile=Containerfile.almalinux
+ docs=almalinux_docs.sh
+ docs_pdf=almalinux_docs_pdf.sh
+ pip3=pip3_docs.sh
+ ;;
+ debian*)
+ containerfile=Containerfile.debian
+ docs=ubuntu_docs.sh
+ docs_pdf=ubuntu_docs_pdf.sh
+ ;;
+ fedora*)
+ containerfile=Containerfile.fedora
+ docs=fedora_docs.sh
+ docs_pdf=fedora_docs_pdf.sh
+ pip3=pip3_docs.sh
+ ;;
+ opensuse* | leap*)
+ image=opensuse/leap:$version
+ containerfile=Containerfile.zypper
+ docs=opensuse_docs.sh
+ docs_pdf=opensuse_docs_pdf.sh
+ pip3=pip3_docs.sh
+ ;;
+ ubuntu*)
+ containerfile=Containerfile.ubuntu
+ docs=ubuntu_docs.sh
+ docs_pdf=ubuntu_docs_pdf.sh
+ ;;
+ *)
+ echo "$image not supported"
+ exit 1
+ ;;
+ esac
+
+ $OCI build \
+ --tag "yocto-docs-$sanitized_dockername:latest" \
+ --build-arg ARG_FROM="docker.io/$image" \
+ --build-arg DOCS="$docs" \
+ --build-arg DOCS_PDF="$docs_pdf" \
+ --build-arg PIP3="${pip3:-}" \
+ --file "$SCRIPT_DIR/$containerfile" \
+ "$SH_DIR/"
+
+ local -a args_run=(
+ --rm
+ --interactive
+ --tty
+ --volume="$DOCS_DIR:/docs:rw"
+ --workdir=/docs
+ --security-opt label=disable
+ )
+
+ if [ "$OCI" = "docker" ]; then
+ args_run+=(
+ --user="$(id -u)":"$(id -g)"
+ )
+ elif [ "$OCI" = "podman" ]; then
+ # we need net access to fetch bitbake terms
+ args_run+=(
+ --cap-add=NET_RAW
+ --userns=keep-id
+ )
+ fi
+
+ $OCI run \
+ "${args_run[@]}" \
+ "yocto-docs-$sanitized_dockername" \
+ "$@"
+}
+
+main "$@"
@@ -1 +1 @@
-sudo zypper install git glibc-i18ndata make python3-pip rsvg-convert which
+sudo zypper --non-interactive install git glibc-i18ndata make python3-pip rsvg-convert which
@@ -1 +1 @@
-sudo zypper install 'texlive-collection-lang*' texlive-collection-fontsextra texlive-collection-fontsrecommended texlive-collection-latex texlive-collection-latexextra texlive-collection-latexrecommended texlive-collection-xetex texlive-fncychap texlive-gnu-freefont texlive-latexmk texlive-tex-gyre texlive-xetex
+sudo zypper --non-interactive install 'texlive-collection-lang*' texlive-collection-fontsextra texlive-collection-fontsrecommended texlive-collection-latex texlive-collection-latexextra texlive-collection-latexrecommended texlive-collection-xetex texlive-fncychap texlive-gnu-freefont texlive-latexmk texlive-tex-gyre texlive-xetex
@@ -1,2 +1,2 @@
-sudo zypper install bzip2 chrpath diffstat gcc gcc-c++ git gzip hostname libacl1 lz4 make makeinfo patch python python-curses python-xml python3 python3-Jinja2 python3-curses python3-pexpect python3-pip rpcgen socat tar wget which xz zstd
+sudo zypper --non-interactive install bzip2 chrpath diffstat gcc gcc-c++ git gzip hostname libacl1 lz4 make makeinfo patch python python-curses python-xml python3 python3-Jinja2 python3-curses python3-pexpect python3-pip rpcgen socat tar wget which xz zstd
sudo pip3 install GitPython