Skip to contentSkip to conversation

tools/build-docs-container: add optional option for essential packages

PATCH Superseded Antonin Godard 2 participants 3 messages Oct 3, 2025 – Oct 8, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/build-docs-container: add optional option for essential packages

The script currently only installs the files necessary to build the docs. Since we also have the essential packages listed it can be useful to include them in the containers, at least to validate that these successfully install.

Add an env variable for including these packages in the container. The default is to not include these, so the current behavior is unchanged.

---
 documentation/tools/Containerfile.apt    |  4 ++++
 documentation/tools/Containerfile.dnf    |  4 ++++
 documentation/tools/Containerfile.zypper |  4 ++++
 documentation/tools/build-docs-container | 17 +++++++++++++++++
 4 files changed, 29 insertions(+)
documentation/tools/Containerfile.apt +4 -0
index 5e30b65eb..a573786f0 100644
@@ -1,6 +1,8 @@
 ARG ARG_FROM=debian:12 # default value to avoid warning
 FROM $ARG_FROM
 
+ARG INCLUDE_ESSENTIAL_PACKAGES=0
+ARG ESSENTIAL=ubuntu_essential.sh
 ARG DOCS=ubuntu_docs.sh
 ARG DOCS_PDF=ubuntu_docs_pdf.sh
 
@@ -8,12 +10,14 @@ ENV DEBIAN_FRONTEND=noninteractive
 ARG TZ=Europe/Vienna
 
 # relative to the location of the dockerfile
+COPY --chmod=777 ${ESSENTIAL} /temp/host_packages_essential.sh
 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 \
+ && if [ "$INCLUDE_ESSENTIAL_PACKAGES" = "1" ]; then yes | /temp/host_packages_essential.sh; fi \
  && yes | /temp/host_packages_docs.sh \
  && yes | /temp/host_packages_docs_pdf.sh \
  && apt-get --yes autoremove \
documentation/tools/Containerfile.dnf +4 -0
index 3dae74445..65c526705 100644
@@ -1,17 +1,21 @@
 ARG ARG_FROM=fedora:40 # default value to avoid warning
 FROM $ARG_FROM
 
+ARG INCLUDE_ESSENTIAL_PACKAGES=0
+ARG ESSENTIAL=fedora_essential.sh
 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 ${ESSENTIAL} /temp/host_packages_essential.sh
 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 \
+ && if [ "$INCLUDE_ESSENTIAL_PACKAGES" = "1" ]; then yes | /temp/host_packages_essential.sh; fi \
  && yes | /temp/host_packages_docs.sh \
  && yes | /temp/host_packages_docs_pdf.sh \
  && yes | /temp/pip3_docs.sh \
documentation/tools/Containerfile.zypper +4 -0
index f27ad1b47..3850b9ff9 100644
@@ -1,11 +1,14 @@
 ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning
 FROM $ARG_FROM
 
+ARG INCLUDE_ESSENTIAL_PACKAGES=0
+ARG ESSENTIAL=opensuse_essential.sh
 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 ${ESSENTIAL} /temp/host_packages_essential.sh
 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
@@ -20,6 +23,7 @@ RUN for script in /temp/*.sh; do \
 
 RUN zypper update -y \
  && zypper install -y sudo \
+ && if [ "$INCLUDE_ESSENTIAL_PACKAGES" = "1" ]; then yes | /temp/host_packages_essential.sh; fi \
  && yes | /temp/host_packages_docs.sh \
  && yes | /temp/host_packages_docs_pdf.sh \
  && yes | /temp/pip3_docs.sh \
documentation/tools/build-docs-container +17 -0
index 6b4d42543..704731232 100755
@@ -24,6 +24,7 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
 CONTAINERCMD=${CONTAINERCMD:-docker}
 DOCS_DIR="$SCRIPT_DIR/../.."
 SH_DIR="$SCRIPT_DIR/host_packages_scripts"
+INCLUDE_ESSENTIAL_PACKAGES=${INCLUDE_ESSENTIAL_PACKAGES:-0}
 
 function usage()
 {
@@ -46,6 +47,16 @@ $0 OCI_IMAGE [make arguments...]
    documentation/Makefile, see that file for what's supported. This is typically
    intended to be used to provide specific make targets.
    Default: publish
+
+   Environment variables:
+
+   - CONTAINERCMD can be set to 'docker' or 'podman' to select the
+     container engine (default: 'docker').
+
+   - INCLUDE_ESSENTIAL_PACKAGES can be set to 0 or 1 to also include essential
+     packages listed in documentation/tools/host_packages_scripts/*_essential.sh.
+     This is not required to build the documentation but can be useful to validate
+     the installation of packages listed in these files (default: 0).
 "
 }
 
@@ -81,6 +92,7 @@ main ()
     # "debian:11"*|\
     "debian:12"*)
       containerfile=Containerfile.debian
+      essential=ubuntu_essential.sh
       docs=ubuntu_docs.sh
       docs_pdf=ubuntu_docs_pdf.sh
       ;;
@@ -88,6 +100,7 @@ main ()
     "fedora:39"*|\
     "fedora:40"*)
       containerfile=Containerfile.fedora
+      essential=fedora_essential.sh
       docs=fedora_docs.sh
       docs_pdf=fedora_docs_pdf.sh
       pip3=pip3_docs.sh
@@ -114,6 +127,7 @@ main ()
     # "leap:15.6"*)
       image=opensuse/leap:$version
       containerfile=Containerfile.zypper
+      essential=opensuse_essential.sh
       docs=opensuse_docs.sh
       docs_pdf=opensuse_docs_pdf.sh
       pip3=pip3_docs.sh
@@ -126,6 +140,7 @@ main ()
     "ubuntu:22.04"*|\
     "ubuntu:24.04"*)
       containerfile=Containerfile.ubuntu
+      essential=ubuntu_essential.sh
       docs=ubuntu_docs.sh
       docs_pdf=ubuntu_docs_pdf.sh
       ;;
@@ -139,6 +154,8 @@ main ()
   $OCI build \
     --tag "yocto-docs-$sanitized_dockername:latest" \
     --build-arg ARG_FROM="docker.io/$image" \
+    --build-arg INCLUDE_ESSENTIAL_PACKAGES="${INCLUDE_ESSENTIAL_PACKAGES}" \
+    --build-arg ESSENTIAL="$essential" \
     --build-arg DOCS="$docs" \
     --build-arg DOCS_PDF="$docs_pdf" \
     --build-arg PIP3="${pip3:-}" \

---
base-commit: a84c234acfedfa714419006c743405e2f9acaedc
change-id: 20251003-build-docs-container-essentials-6ad50b7e3467

Best regards,

Signature · 1 line
Antonin Godard <[email protected]>
#1 lore raw

Hi Antonin,

Quoted 110 lines · Antonin Godard via lists.yoctoproject.org

The script currently only installs the files necessary to build the docs. Since we also have the essential packages listed it can be useful to include them in the containers, at least to validate that these successfully install.

Add an env variable for including these packages in the container. The default is to not include these, so the current behavior is unchanged.

---
  documentation/tools/Containerfile.apt    |  4 ++++
  documentation/tools/Containerfile.dnf    |  4 ++++
  documentation/tools/Containerfile.zypper |  4 ++++
  documentation/tools/build-docs-container | 17 +++++++++++++++++
  4 files changed, 29 insertions(+)
documentation/tools/Containerfile.apt +4 -0
index 5e30b65eb..a573786f0 100644
@@ -1,6 +1,8 @@
  ARG ARG_FROM=debian:12 # default value to avoid warning
  FROM $ARG_FROM
 
+ARG INCLUDE_ESSENTIAL_PACKAGES=0
+ARG ESSENTIAL=ubuntu_essential.sh
  ARG DOCS=ubuntu_docs.sh
  ARG DOCS_PDF=ubuntu_docs_pdf.sh
 
@@ -8,12 +10,14 @@ ENV DEBIAN_FRONTEND=noninteractive
  ARG TZ=Europe/Vienna
 
  # relative to the location of the dockerfile
+COPY --chmod=777 ${ESSENTIAL} /temp/host_packages_essential.sh
  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 \
+ && if [ "$INCLUDE_ESSENTIAL_PACKAGES" = "1" ]; then yes | /temp/host_packages_essential.sh; fi \
   && yes | /temp/host_packages_docs.sh \
   && yes | /temp/host_packages_docs_pdf.sh \
   && apt-get --yes autoremove \
documentation/tools/Containerfile.dnf +4 -0
index 3dae74445..65c526705 100644
@@ -1,17 +1,21 @@
  ARG ARG_FROM=fedora:40 # default value to avoid warning
  FROM $ARG_FROM
 
+ARG INCLUDE_ESSENTIAL_PACKAGES=0
+ARG ESSENTIAL=fedora_essential.sh
  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 ${ESSENTIAL} /temp/host_packages_essential.sh
  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 \
+ && if [ "$INCLUDE_ESSENTIAL_PACKAGES" = "1" ]; then yes | /temp/host_packages_essential.sh; fi \
   && yes | /temp/host_packages_docs.sh \
   && yes | /temp/host_packages_docs_pdf.sh \
   && yes | /temp/pip3_docs.sh \
documentation/tools/Containerfile.zypper +4 -0
index f27ad1b47..3850b9ff9 100644
@@ -1,11 +1,14 @@
  ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning
  FROM $ARG_FROM
 
+ARG INCLUDE_ESSENTIAL_PACKAGES=0
+ARG ESSENTIAL=opensuse_essential.sh
  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 ${ESSENTIAL} /temp/host_packages_essential.sh
  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
@@ -20,6 +23,7 @@ RUN for script in /temp/*.sh; do \
 
  RUN zypper update -y \
   && zypper install -y sudo \
+ && if [ "$INCLUDE_ESSENTIAL_PACKAGES" = "1" ]; then yes | /temp/host_packages_essential.sh; fi \
   && yes | /temp/host_packages_docs.sh \
   && yes | /temp/host_packages_docs_pdf.sh \
   && yes | /temp/pip3_docs.sh \
documentation/tools/build-docs-container +1 -0
index 6b4d42543..704731232 100755
@@ -24,6 +24,7 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
  CONTAINERCMD=${CONTAINERCMD:-docker}
  DOCS_DIR="$SCRIPT_DIR/../.."
  SH_DIR="$SCRIPT_DIR/host_packages_scripts"
+INCLUDE_ESSENTIAL_PACKAGES=${INCLUDE_ESSENTIAL_PACKAGES:-0}
 
  function usage()
  {

documentation/tools/build-docs-container $0 OCI_IMAGE [make arguments...] · line 56

Quoted 10 lines
documentation/tools/build-docs-container +7 -0
@@ -46,6 +47,16 @@ $0 OCI_IMAGE [make arguments...]
     documentation/Makefile, see that file for what's supported. This is typically
     intended to be used to provide specific make targets.
     Default: publish
+
+   Environment variables:
+
+   - CONTAINERCMD can be set to 'docker' or 'podman' to select the
+     container engine (default: 'docker').
+
+   - INCLUDE_ESSENTIAL_PACKAGES can be set to 0 or 1 to also include essential

s/0 or//

Otherwise the wording is a bit confusing.

Quoted 23 lines
documentation/tools/build-docs-container +5 -0
+     packages listed in documentation/tools/host_packages_scripts/*_essential.sh.
+     This is not required to build the documentation but can be useful to validate
+     the installation of packages listed in these files (default: 0).
  "
  }
 
@@ -81,6 +92,7 @@ main ()
      # "debian:11"*|\
      "debian:12"*)
        containerfile=Containerfile.debian
+      essential=ubuntu_essential.sh
        docs=ubuntu_docs.sh
        docs_pdf=ubuntu_docs_pdf.sh
        ;;
@@ -88,6 +100,7 @@ main ()
      "fedora:39"*|\
      "fedora:40"*)
        containerfile=Containerfile.fedora
+      essential=fedora_essential.sh
        docs=fedora_docs.sh
        docs_pdf=fedora_docs_pdf.sh
        pip3=pip3_docs.sh

documentation/tools/build-docs-container main () · line 127

Quoted 1 line
documentation/tools/build-docs-container +0 -0
@@ -114,6 +127,7 @@ main ()
      # "leap:15.6"*)

Not in this git diff but it's in the tree, we now enabled leap:15.6 but we kept the comment, so either we shouldn't have added support for leap:15.6 to the docs because it doesn't work, or it works and then we should remove the comment.

I'm not convinced this is the right way of testing the essential packages but I see the benefit for now and have nothing better to suggest except building a separate container which will do a world build of bitbake + oe-core for all supported machines but that is a LOT to ask for a test :)

Cheers,
Quentin

#2 lore raw

On Mon Oct 6, 2025 at 6:04 PM CEST, Quentin Schulz via lists.yoctoproject.org wrote:
[...]

Quoted 4 lines

Not in this git diff but it's in the tree, we now enabled leap:15.6 but we kept the comment, so either we shouldn't have added support for leap:15.6 to the docs because it doesn't work, or it works and then we should remove the comment.

I was able to build the PDF with leap:15.6, with Docker. I am trying Podman just in case... But I will remove the comment, thanks.

Quoted 5 lines

I'm not convinced this is the right way of testing the essential packages but I see the benefit for now and have nothing better to suggest except building a separate container which will do a world build of bitbake + oe-core for all supported machines but that is a LOT to ask for a test :)

Yes, that's not ideal, but as it stands it is a "nice-to-have solution" to validate that what we list here successfully installs. For the build, there's the Autobuilder. In an ideal world, this list of packages would be shared between the AB and ydocs...

Thanks,
Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com