add script for containers building the documentation
cover add script for containers building the documentation
Based on initial work done by Antonin Godard[1].
This does two things:
- move all the installation steps to fulfil the system requirements for each distro into separate files,
- add a script for using those separate files for building a container which allows to build the documentation within,
Note that Ubuntu (at least 24.04) and openSUSE instructions do not work right now. Ubuntu has an issue with locales which are already reported and fixes sent to the ML[2] (I have not tested the possible fix). openSUSE seems to be running the sphinx build from a 3.6 Python interpreter which has an incompatible API with the Python calls used in Sphinx for our documentation.
[1] https://lore.kernel.org/yocto-docs/[email protected]/
[2] https://lore.kernel.org/yocto-docs/[email protected]/
---
Quentin Schulz (2):
docs: use literalinclude for system requirements
tools: add script for building documentation inside containers
documentation/poky.yaml.in | 26 ------ documentation/ref-manual/system-requirements.rst | 45 ++++----- documentation/tools/Containerfile.almalinux | 1 + documentation/tools/Containerfile.apt | 21 +++++ documentation/tools/Containerfile.debian | 1 + documentation/tools/Containerfile.dnf | 19 ++++ documentation/tools/Containerfile.fedora | 1 + documentation/tools/Containerfile.ubuntu | 1 + documentation/tools/Containerfile.zypper | 18 ++++ .../tools/almalinux_host_packages_docs.sh | 2 + .../tools/almalinux_host_packages_essential.sh | 5 + documentation/tools/build-docs-container | 101 +++++++++++++++++++++ documentation/tools/fedora_host_packages_docs.sh | 2 + .../tools/fedora_host_packages_essential.sh | 1 + documentation/tools/opensuse_host_packages_docs.sh | 2 + .../tools/opensuse_host_packages_essential.sh | 2 + documentation/tools/ubuntu_host_packages_docs.sh | 2 + .../tools/ubuntu_host_packages_essential.sh | 2 + 18 files changed, 205 insertions(+), 47 deletions(-)
---
base-commit: 5835cb574881d57785f099c768467177d077e867
change-id: 20241210-instructions-shell-container-c5a84c043a35
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
RFC PATCH 1/2 docs: use literalinclude for system requirements
From: Quentin Schulz <[email protected]>
The YAML variables for the host dependencies are updated by hand and actually only used inside code blocks.
It's also slowly getting more difficult to make sense of the content of those variables as they are both the list of packages to install with the distro's package manager and sometimes additional commands, which all need to have the indentation of the block where the variable is used matched. This is impossible so we just guess it's going to be at a specific indentation.
Instead, let's migrate all instructions into separate shell scripts that are then literalinclude'd into the Sphinx documentation.
This allows a few things:
- ability to run shellcheck on the scripts if we ever want to
- manually calling the appropriate script from a supported distro to build stuff (distro or bitbake/yocto stuff)
- use this script to create containers to do CI of documentation on different distros, to make sure our instructions are all up to date,
--- documentation/poky.yaml.in | 26 ------------- documentation/ref-manual/system-requirements.rst | 45 ++++++++++++---------- .../tools/almalinux_host_packages_docs.sh | 2 + .../tools/almalinux_host_packages_essential.sh | 5 +++ documentation/tools/fedora_host_packages_docs.sh | 2 + .../tools/fedora_host_packages_essential.sh | 1 + documentation/tools/opensuse_host_packages_docs.sh | 2 + .../tools/opensuse_host_packages_essential.sh | 2 + documentation/tools/ubuntu_host_packages_docs.sh | 2 + .../tools/ubuntu_host_packages_essential.sh | 2 + 10 files changed, 42 insertions(+), 47 deletions(-)
documentation/poky.yaml.in +0 -26
@@ -10,32 +10,6 @@ BITBAKE_SERIES : "" YOCTO_DL_URL : "https://downloads.yoctoproject.org" YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;" -UBUNTU_HOST_PACKAGES_ESSENTIAL : "gawk wget git diffstat unzip texinfo gcc \ - build-essential chrpath socat cpio python3 python3-pip python3-pexpect \ - xz-utils debianutils iputils-ping python3-git python3-jinja2 \ - python3-subunit zstd liblz4-tool file locales libacl1 - \n\ $ sudo locale-gen en_US.UTF-8" -FEDORA_HOST_PACKAGES_ESSENTIAL : "gawk make wget tar bzip2 gzip python3 unzip perl patch \ - diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \ - ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat \ - python3-pexpect findutils which file cpio python python3-pip xz python3-GitPython \ - python3-jinja2 rpcgen perl-FindBin perl-File-Compare \ - perl-File-Copy perl-locale zstd lz4 hostname glibc-langpack-en libacl" -OPENSUSE_HOST_PACKAGES_ESSENTIAL : "python gcc gcc-c++ git chrpath make wget python-xml \ - diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip \ - python3-pexpect xz which python3-Jinja2 rpcgen \ - zstd lz4 bzip2 gzip hostname libacl1 - \n\ $ sudo pip3 install GitPython" -ALMALINUX_HOST_PACKAGES_ESSENTIAL : "-y epel-release - \n\ $ sudo yum install dnf-plugins-core - \n\ $ sudo dnf config-manager --set-enabled crb - \n\ $ sudo dnf makecache - \n\ $ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch \ - diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache \ - socat perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip \ - python3-GitPython python3-jinja2 python3-pexpect xz which \ - rpcgen zstd lz4 cpio glibc-langpack-en libacl" -PIP3_HOST_PACKAGES_DOC : "$ sudo pip3 install sphinx sphinx_rtd_theme pyyaml" MIN_PYTHON_VERSION : "3.8.0" MIN_TAR_VERSION : "1.28" MIN_GIT_VERSION : "1.8.3.1"
documentation/ref-manual/system-requirements.rst +24 -21
88 lines not on this page · raw message
documentation/tools/almalinux_host_packages_docs.sh new file +2 -0
@@ -0,0 +1,2 @@ +sudo dnf install git make python3-pip which inkscape texlive-fncychap +sudo pip3 install sphinx sphinx_rtd_theme pyyaml
documentation/tools/almalinux_host_packages_essential.sh new file +5 -0
@@ -0,0 +1,5 @@ +sudo dnf install -y epel-release +sudo yum install dnf-plugins-core +sudo dnf config-manager --set-enabled crb +sudo dnf makecache +sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache socat perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip python3-GitPython python3-jinja2 python3-pexpect xz which rpcgen zstd lz4 cpio glibc-langpack-en libacl
documentation/tools/fedora_host_packages_docs.sh new file +2 -0
@@ -0,0 +1,2 @@ +sudo dnf install git make python3-pip which inkscape texlive-fncychap +sudo pip3 install sphinx sphinx_rtd_theme pyyaml
documentation/tools/fedora_host_packages_essential.sh new file +1 -0
@@ -0,0 +1 @@ +sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat python3-pexpect findutils which file cpio python python3-pip xz python3-GitPython python3-jinja2 rpcgen perl-FindBin perl-File-Compare perl-File-Copy perl-locale zstd lz4 hostname glibc-langpack-en libacl
documentation/tools/opensuse_host_packages_docs.sh new file +2 -0
@@ -0,0 +1,2 @@ +sudo zypper install git make python3-pip which inkscape texlive-fncychap +sudo pip3 install sphinx sphinx_rtd_theme pyyaml
documentation/tools/opensuse_host_packages_essential.sh new file +2 -0
@@ -0,0 +1,2 @@ +sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip python3-pexpect xz which python3-Jinja2 rpcgen zstd lz4 bzip2 gzip hostname libacl1 +sudo pip3 install GitPython
documentation/tools/ubuntu_host_packages_docs.sh new file +2 -0
@@ -0,0 +1,2 @@ +sudo apt install git make inkscape texlive-latex-extra +sudo apt install sphinx python3-saneyaml python3-sphinx-rtd-theme
documentation/tools/ubuntu_host_packages_essential.sh new file +2 -0
@@ -0,0 +1,2 @@ +sudo apt-get install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1 +sudo locale-gen en_US.UTF-8
Signature · 1 line
2.47.1
Re: [docs] [PATCH RFC 1/2] docs: use literalinclude for system requirements
Hi Quentin,
Quoted 22 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
The YAML variables for the host dependencies are updated by hand and actually only used inside code blocks.
It's also slowly getting more difficult to make sense of the content of those variables as they are both the list of packages to install with the distro's package manager and sometimes additional commands, which all need to have the indentation of the block where the variable is used matched. This is impossible so we just guess it's going to be at a specific indentation.
Instead, let's migrate all instructions into separate shell scripts that are then literalinclude'd into the Sphinx documentation.
This allows a few things:
- ability to run shellcheck on the scripts if we ever want to
- manually calling the appropriate script from a supported distro to build stuff (distro or bitbake/yocto stuff)
- use this script to create containers to do CI of documentation on different distros, to make sure our instructions are all up to date,
Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>--- documentation/poky.yaml.in | 26 ------------- documentation/ref-manual/system-requirements.rst | 45 ++++++++++++---------- .../tools/almalinux_host_packages_docs.sh | 2 +
Maybe I would put the scripts in a subdirectory called "host_packages_scripts" and rename the scripts "almalinux_docs.sh", "almalinux_essential.sh", etc. for shorter names. Same for Containerfiles in the next patch, maybe storing them in a subdirectory would make sense.
If putting them at the same level is because of the build context requiring files to be all at the same place, let's leave it like this.
Otherwise, this needs to be rebased and updated after the dependencies were updated on master.
Thanks,
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [docs] [PATCH RFC 1/2] docs: use literalinclude for system requirements
Hi Antonin,
Quoted 31 lines · Antonin Godard
Hi Quentin,
Quoted 22 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
The YAML variables for the host dependencies are updated by hand and actually only used inside code blocks.
It's also slowly getting more difficult to make sense of the content of those variables as they are both the list of packages to install with the distro's package manager and sometimes additional commands, which all need to have the indentation of the block where the variable is used matched. This is impossible so we just guess it's going to be at a specific indentation.
Instead, let's migrate all instructions into separate shell scripts that are then literalinclude'd into the Sphinx documentation.
This allows a few things:
- ability to run shellcheck on the scripts if we ever want to
- manually calling the appropriate script from a supported distro to build stuff (distro or bitbake/yocto stuff)
- use this script to create containers to do CI of documentation on different distros, to make sure our instructions are all up to date,Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>--- documentation/poky.yaml.in | 26 ------------- documentation/ref-manual/system-requirements.rst | 45 ++++++++++++---------- .../tools/almalinux_host_packages_docs.sh | 2 +
Quoted 8 lines
Maybe I would put the scripts in a subdirectory called "
host_packages_scripts" and rename the scripts "almalinux_docs.sh", "almalinux_essential.sh", etc. for shorter names. Same for Containerfiles in the next patch, maybe storing them in a subdirectory would make sense.If putting them at the same level is because of the build context requiring files to be all at the same place, let's leave it like this.
Will check for a v3 but should be doable I believe.
Quoted 4 lines
Otherwise, this needs to be rebased and updated after the dependencies were updated on master.
That's already done in the v2 I sent yesterday :)
Cheers,
Quentin
Re: [docs] [PATCH RFC 1/2] docs: use literalinclude for system requirements
Hi Quentin,
Quoted 43 lines · Quentin Schulz
Hi Antonin,
Quoted 31 lines · Antonin Godard
Hi Quentin,
Quoted 22 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
The YAML variables for the host dependencies are updated by hand and actually only used inside code blocks.
It's also slowly getting more difficult to make sense of the content of those variables as they are both the list of packages to install with the distro's package manager and sometimes additional commands, which all need to have the indentation of the block where the variable is used matched. This is impossible so we just guess it's going to be at a specific indentation.
Instead, let's migrate all instructions into separate shell scripts that are then literalinclude'd into the Sphinx documentation.
This allows a few things:
- ability to run shellcheck on the scripts if we ever want to
- manually calling the appropriate script from a supported distro to build stuff (distro or bitbake/yocto stuff)
- use this script to create containers to do CI of documentation on different distros, to make sure our instructions are all up to date,Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>--- documentation/poky.yaml.in | 26 ------------- documentation/ref-manual/system-requirements.rst | 45 ++++++++++++---------- .../tools/almalinux_host_packages_docs.sh | 2 +Quoted 8 lines
Maybe I would put the scripts in a subdirectory called "
host_packages_scripts" and rename the scripts "almalinux_docs.sh", "almalinux_essential.sh", etc. for shorter names. Same for Containerfiles in the next patch, maybe storing them in a subdirectory would make sense.If putting them at the same level is because of the build context requiring files to be all at the same place, let's leave it like this.
Quoted 8 lines
Will check for a v3 but should be doable I believe.
Quoted 4 lines
Otherwise, this needs to be rebased and updated after the dependencies were updated on master.
That's already done in the v2 I sent yesterday :)
Strange, I did not receive it, and I can't find it on lore.kernel.org/yocto-docs. Is the issue on my side?
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [docs] [PATCH RFC 1/2] docs: use literalinclude for system requirements
Hi Antonin,
Quoted 49 lines · Antonin Godard
Hi Quentin,
Quoted 46 lines · Quentin Schulz
Hi Antonin,
Quoted 31 lines · Antonin Godard
Hi Quentin,
Quoted 22 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
The YAML variables for the host dependencies are updated by hand and actually only used inside code blocks.
It's also slowly getting more difficult to make sense of the content of those variables as they are both the list of packages to install with the distro's package manager and sometimes additional commands, which all need to have the indentation of the block where the variable is used matched. This is impossible so we just guess it's going to be at a specific indentation.
Instead, let's migrate all instructions into separate shell scripts that are then literalinclude'd into the Sphinx documentation.
This allows a few things:
- ability to run shellcheck on the scripts if we ever want to
- manually calling the appropriate script from a supported distro to build stuff (distro or bitbake/yocto stuff)
- use this script to create containers to do CI of documentation on different distros, to make sure our instructions are all up to date,Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>--- documentation/poky.yaml.in | 26 ------------- documentation/ref-manual/system-requirements.rst | 45 ++++++++++++---------- .../tools/almalinux_host_packages_docs.sh | 2 +Quoted 8 lines
Maybe I would put the scripts in a subdirectory called "
host_packages_scripts" and rename the scripts "almalinux_docs.sh", "almalinux_essential.sh", etc. for shorter names. Same for Containerfiles in the next patch, maybe storing them in a subdirectory would make sense.If putting them at the same level is because of the build context requiring files to be all at the same place, let's leave it like this.
Will check for a v3 but should be doable I believe.
Quoted 1 line
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Otherwise, this needs to be rebased and updated after the dependencies were updated on master.
That's already done in the v2 I sent yesterday :)
Strange, I did not receive it, and I can't find it on lore.kernel.org/yocto-docs. Is the issue on my side?
Typical PEBKAC, forgot to run b4 prep --auto-to-cc on the patch series before sending it (it warned me I hadn't run the command yet but I had sent the v1 already so I thought it was a spurious warning message) so I sent it to a whopping amount of one recipient... myself.
Will send with the requested changes as v2 once ready :) Thanks for the heads up.
Cheers,
Quentin
RFC PATCH 2/2 tools: add script for building documentation inside containers
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This adds a script for building a container and building the documentation within that new container image.
The openSUSE instructions now require a --non-interactive flag otherwise they fail to run. Sadly there doesn't seem to be a way to have this in an environment variable à-la DEBIAN_FRONTEND=noninteractive.
Note that the Ubuntu and openSUSE instructions currently do not work.
--- documentation/tools/Containerfile.almalinux | 1 + documentation/tools/Containerfile.apt | 21 +++++ documentation/tools/Containerfile.debian | 1 + documentation/tools/Containerfile.dnf | 19 ++++ documentation/tools/Containerfile.fedora | 1 + documentation/tools/Containerfile.ubuntu | 1 + documentation/tools/Containerfile.zypper | 18 ++++ documentation/tools/build-docs-container | 101 +++++++++++++++++++++ documentation/tools/opensuse_host_packages_docs.sh | 2 +- .../tools/opensuse_host_packages_essential.sh | 2 +- 10 files changed, 165 insertions(+), 2 deletions(-)
documentation/tools/Containerfile.almalinux new file +1 -0
@@ -0,0 +1 @@ +Containerfile.dnf
documentation/tools/Containerfile.apt new file +21 -0
@@ -0,0 +1,21 @@ +ARG ARG_FROM=debian:12 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=ubuntu_host_packages_docs.sh + +ENV DEBIAN_FRONTEND=noninteractive + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN apt-get update \ + && apt-get install -y sudo \ + && yes | /temp/host_packages_docs.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"]
documentation/tools/Containerfile.debian new file +1 -0
@@ -0,0 +1 @@ +Containerfile.apt
documentation/tools/Containerfile.dnf new file +19 -0
@@ -0,0 +1,19 @@ +ARG ARG_FROM=fedora:40 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=fedora_host_packages_docs.sh + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN dnf update -y \ + && dnf install -y sudo \ + && yes | /temp/host_packages_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"]
documentation/tools/Containerfile.fedora new file +1 -0
@@ -0,0 +1 @@ +Containerfile.dnf
documentation/tools/Containerfile.ubuntu new file +1 -0
@@ -0,0 +1 @@ +Containerfile.apt
documentation/tools/Containerfile.zypper new file +18 -0
@@ -0,0 +1,18 @@ +ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=opensuse_host_packages_docs.sh + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN zypper update -y \ + && zypper install -y sudo \ + && yes | /temp/host_packages_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"]
documentation/tools/build-docs-container new file +101 -0
101 lines not on this page · raw message
documentation/tools/opensuse_host_packages_docs.sh +1 -1
@@ -1,2 +1,2 @@ -sudo zypper install git make python3-pip which inkscape texlive-fncychap +sudo zypper --non-interactive install git make python3-pip which inkscape texlive-fncychap sudo pip3 install sphinx sphinx_rtd_theme pyyaml
documentation/tools/opensuse_host_packages_essential.sh +1 -1
@@ -1,2 +1,2 @@ -sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip python3-pexpect xz which python3-Jinja2 rpcgen zstd lz4 bzip2 gzip hostname libacl1 +sudo zypper --non-interactive install python gcc gcc-c++ git chrpath make wget python-xml diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip python3-pexpect xz which python3-Jinja2 rpcgen zstd lz4 bzip2 gzip hostname libacl1 sudo pip3 install GitPython
Signature · 1 line
2.47.1
Re: [docs] [PATCH RFC 2/2] tools: add script for building documentation inside containers
Hi Quentin,
Quoted 50 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This adds a script for building a container and building the documentation within that new container image.
The openSUSE instructions now require a --non-interactive flag otherwise they fail to run. Sadly there doesn't seem to be a way to have this in an environment variable à-la DEBIAN_FRONTEND=noninteractive.
Note that the Ubuntu and openSUSE instructions currently do not work.
Signed-off-by Quentin Schulz <[email protected]>--- documentation/tools/Containerfile.almalinux | 1 + documentation/tools/Containerfile.apt | 21 +++++ documentation/tools/Containerfile.debian | 1 + documentation/tools/Containerfile.dnf | 19 ++++ documentation/tools/Containerfile.fedora | 1 + documentation/tools/Containerfile.ubuntu | 1 + documentation/tools/Containerfile.zypper | 18 ++++ documentation/tools/build-docs-container | 101 +++++++++++++++++++++ documentation/tools/opensuse_host_packages_docs.sh | 2 +- .../tools/opensuse_host_packages_essential.sh | 2 +- 10 files changed, 165 insertions(+), 2 deletions(-)documentation/tools/Containerfile.almalinux new file +1
-0@@ -0,0 +1 @@ +Containerfile.dnfdocumentation/tools/Containerfile.apt new file +11
-0@@ -0,0 +1,21 @@ +ARG ARG_FROM=debian:12 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=ubuntu_host_packages_docs.sh + +ENV DEBIAN_FRONTEND=noninteractive + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN apt-get update \
documentation/tools/Containerfile.apt line 21
Quoted 10 lines
documentation/tools/Containerfile.apt new file +10
-0+ && apt-get install -y sudo \ + && yes | /temp/host_packages_docs.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"]
Are we able to override this from the command-line, with the build-docs-container script? I assume everything passed in "$*" below replaces CMD?
Quoted 79 lines
documentation/tools/Containerfile.debian new file +1
-0@@ -0,0 +1 @@ +Containerfile.aptdocumentation/tools/Containerfile.dnf new file +19
-0@@ -0,0 +1,19 @@ +ARG ARG_FROM=fedora:40 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=fedora_host_packages_docs.sh + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN dnf update -y \ + && dnf install -y sudo \ + && yes | /temp/host_packages_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"]documentation/tools/Containerfile.fedora new file +1
-0@@ -0,0 +1 @@ +Containerfile.dnfdocumentation/tools/Containerfile.ubuntu new file +1
-0@@ -0,0 +1 @@ +Containerfile.aptdocumentation/tools/Containerfile.zypper new file +18
-0@@ -0,0 +1,18 @@ +ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=opensuse_host_packages_docs.sh + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN zypper update -y \ + && zypper install -y sudo \ + && yes | /temp/host_packages_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"]documentation/tools/build-docs-container new file +0
-0
documentation/tools/build-docs-container line 4
Quoted 4 lines
documentation/tools/build-docs-container new file +4
-0@@ -0,0 +1,101 @@ +#!/usr/bin/env bash +# +# Build a container ready to build the documentation be reading the dependencies +# listed in poky.yaml.in, and start a documentation build in this container.
Needs an update, since we don't read poky.yaml.in here.
Quoted 110 lines
documentation/tools/build-docs-container new file +97
-0+# +# 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/../.." + +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 + host_packages_docs=almalinux_host_packages_docs.sh + ;; + debian*) + containerfile=Containerfile.debian + host_packages_docs=ubuntu_host_packages_docs.sh + ;; + fedora*) + containerfile=Containerfile.fedora + host_packages_docs=fedora_host_packages_docs.sh + ;; + opensuse* | leap*) + image=opensuse/leap:$version + containerfile=Containerfile.zypper + host_packages_docs=opensuse_host_packages_docs.sh + ;; + ubuntu*) + containerfile=Containerfile.ubuntu + host_packages_docs=ubuntu_host_packages_docs.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 HOST_DOCS_PACKAGES="$host_packages_docs" \ + --file "$SCRIPT_DIR/$containerfile" \ + "$SCRIPT_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 "$@"documentation/tools/opensuse_host_packages_docs.sh +1
-1@@ -1,2 +1,2 @@ -sudo zypper install git make python3-pip which inkscape texlive-fncychap +sudo zypper --non-interactive install git make python3-pip which inkscape texlive-fncychap sudo pip3 install sphinx sphinx_rtd_theme pyyamldocumentation/tools/opensuse_host_packages_essential.sh +0
-0
documentation/tools/opensuse_host_packages_essential.sh line 2
Quoted 3 lines
documentation/tools/opensuse_host_packages_essential.sh +1
-1@@ -1,2 +1,2 @@ -sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip python3-pexpect xz which python3-Jinja2 rpcgen zstd lz4 bzip2 gzip hostname libacl1 +sudo zypper --non-interactive install python gcc gcc-c++ git chrpath make wget python-xml diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip python3-pexpect xz which python3-Jinja2 rpcgen zstd lz4 bzip2 gzip hostname libacl1 sudo pip3 install GitPython
Looks good to me otherwise!
With the rebase I'd take these patches :)
Thanks,
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [docs] [PATCH RFC 2/2] tools: add script for building documentation inside containers
Hi Antonin,
Quoted 59 lines · Antonin Godard
Hi Quentin,
Quoted 56 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This adds a script for building a container and building the documentation within that new container image.
The openSUSE instructions now require a --non-interactive flag otherwise they fail to run. Sadly there doesn't seem to be a way to have this in an environment variable à-la DEBIAN_FRONTEND=noninteractive.
Note that the Ubuntu and openSUSE instructions currently do not work.
Signed-off-by Quentin Schulz <[email protected]>--- documentation/tools/Containerfile.almalinux | 1 + documentation/tools/Containerfile.apt | 21 +++++ documentation/tools/Containerfile.debian | 1 + documentation/tools/Containerfile.dnf | 19 ++++ documentation/tools/Containerfile.fedora | 1 + documentation/tools/Containerfile.ubuntu | 1 + documentation/tools/Containerfile.zypper | 18 ++++ documentation/tools/build-docs-container | 101 +++++++++++++++++++++ documentation/tools/opensuse_host_packages_docs.sh | 2 +- .../tools/opensuse_host_packages_essential.sh | 2 +- 10 files changed, 165 insertions(+), 2 deletions(-)documentation/tools/Containerfile.almalinux new file +1
-0@@ -0,0 +1 @@ +Containerfile.dnfdocumentation/tools/Containerfile.apt new file +17
-0@@ -0,0 +1,21 @@ +ARG ARG_FROM=debian:12 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=ubuntu_host_packages_docs.sh + +ENV DEBIAN_FRONTEND=noninteractive + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN apt-get update \ + && apt-get install -y sudo \ + && yes | /temp/host_packages_docs.sh \ + && apt-get --yes autoremove \ + && apt-get clean \ + && rm -rf /temp +
Quoted 9 lines
documentation/tools/Containerfile.apt line 21
Quoted 4 lines
documentation/tools/Containerfile.apt new file +4
-0+RUN git config --global --add safe.directory /docs + +ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"] +CMD ["publish"]Are we able to override this from the command-line, with the build-docs-container script? I assume everything passed in "$*" below replaces CMD?
Yes, I'm currently calling the script like that:
./tools/build-docs-container fedora:40 html./tools/build-docs-container fedora:40 latexpdf
or ./tools/build-docs-container fedora:40 latexpdf html (in v2, broken in v1).
If you omit it, it'll call "publish", which is what you decided would be the default in **your** v1. We can have nothing instead which would call "all" I guess instead? Up to you.
Cheers,
Quentin
Re: [docs] [PATCH RFC 2/2] tools: add script for building documentation inside containers
Hi Quentin,
Quoted 77 lines · Quentin Schulz
Hi Antonin,
Quoted 59 lines · Antonin Godard
Hi Quentin,
Quoted 56 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This adds a script for building a container and building the documentation within that new container image.
The openSUSE instructions now require a --non-interactive flag otherwise they fail to run. Sadly there doesn't seem to be a way to have this in an environment variable à-la DEBIAN_FRONTEND=noninteractive.
Note that the Ubuntu and openSUSE instructions currently do not work.
Signed-off-by Quentin Schulz <[email protected]>--- documentation/tools/Containerfile.almalinux | 1 + documentation/tools/Containerfile.apt | 21 +++++ documentation/tools/Containerfile.debian | 1 + documentation/tools/Containerfile.dnf | 19 ++++ documentation/tools/Containerfile.fedora | 1 + documentation/tools/Containerfile.ubuntu | 1 + documentation/tools/Containerfile.zypper | 18 ++++ documentation/tools/build-docs-container | 101 +++++++++++++++++++++ documentation/tools/opensuse_host_packages_docs.sh | 2 +- .../tools/opensuse_host_packages_essential.sh | 2 +- 10 files changed, 165 insertions(+), 2 deletions(-)documentation/tools/Containerfile.almalinux new file +1
-0@@ -0,0 +1 @@ +Containerfile.dnfdocumentation/tools/Containerfile.apt new file +17
-0@@ -0,0 +1,21 @@ +ARG ARG_FROM=debian:12 # default value to avoid warning +FROM $ARG_FROM + +ARG HOST_DOCS_PACKAGES=ubuntu_host_packages_docs.sh + +ENV DEBIAN_FRONTEND=noninteractive + +# relative to the location of the dockerfile +COPY --chmod=777 ${HOST_DOCS_PACKAGES} /temp/host_packages_docs.sh + +RUN apt-get update \ + && apt-get install -y sudo \ + && yes | /temp/host_packages_docs.sh \ + && apt-get --yes autoremove \ + && apt-get clean \ + && rm -rf /temp +Quoted 9 lines
documentation/tools/Containerfile.apt line 21
Quoted 4 lines
documentation/tools/Containerfile.apt new file +4
-0+RUN git config --global --add safe.directory /docs + +ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"] +CMD ["publish"]Are we able to override this from the command-line, with the build-docs-container script? I assume everything passed in "$*" below replaces CMD?
Yes, I'm currently calling the script like that:
./tools/build-docs-containerfedora:40 html./tools/build-docs-containerfedora:40 latexpdf
Quoted 6 lines
or
./tools/build-docs-containerfedora:40 latexpdf html (in v2, broken in v1).If you omit it, it'll call "publish", which is what you decided would be the default in **your** v1. We can have nothing instead which would call "all" I guess instead? Up to you.
"publish" is similar to all, but goes a bit further to assemble the documents and gives a better representation of the final state of the docs IMO (how they're actually published). I think the main advantage is the "final" directory in the build dir, which gathers everything in one place.
TLDR: the extra cost of running publish instead of all is low, we might as well just run it by default :)
Antonin
Signature · 3 lines
Antonin Godard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com