diff options
Diffstat (limited to 'documentation/tools')
21 files changed, 280 insertions, 0 deletions
diff --git a/documentation/tools/Containerfile.almalinux b/documentation/tools/Containerfile.almalinux new file mode 120000 index 0000000000..7237e9b99f --- /dev/null +++ b/documentation/tools/Containerfile.almalinux | |||
@@ -0,0 +1 @@ | |||
Containerfile.dnf \ No newline at end of file | |||
diff --git a/documentation/tools/Containerfile.apt b/documentation/tools/Containerfile.apt new file mode 100644 index 0000000000..5e30b65eb8 --- /dev/null +++ b/documentation/tools/Containerfile.apt | |||
@@ -0,0 +1,26 @@ | |||
1 | ARG ARG_FROM=debian:12 # default value to avoid warning | ||
2 | FROM $ARG_FROM | ||
3 | |||
4 | ARG DOCS=ubuntu_docs.sh | ||
5 | ARG DOCS_PDF=ubuntu_docs_pdf.sh | ||
6 | |||
7 | ENV DEBIAN_FRONTEND=noninteractive | ||
8 | ARG TZ=Europe/Vienna | ||
9 | |||
10 | # relative to the location of the dockerfile | ||
11 | COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh | ||
12 | COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh | ||
13 | |||
14 | RUN ln -fs "/usr/share/zoneinfo/$TZ" /etc/localtime \ | ||
15 | && apt-get update \ | ||
16 | && apt-get install -y sudo \ | ||
17 | && yes | /temp/host_packages_docs.sh \ | ||
18 | && yes | /temp/host_packages_docs_pdf.sh \ | ||
19 | && apt-get --yes autoremove \ | ||
20 | && apt-get clean \ | ||
21 | && rm -rf /temp | ||
22 | |||
23 | RUN git config --global --add safe.directory /docs | ||
24 | |||
25 | ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"] | ||
26 | CMD ["publish"] | ||
diff --git a/documentation/tools/Containerfile.debian b/documentation/tools/Containerfile.debian new file mode 120000 index 0000000000..5a7a425197 --- /dev/null +++ b/documentation/tools/Containerfile.debian | |||
@@ -0,0 +1 @@ | |||
Containerfile.apt \ No newline at end of file | |||
diff --git a/documentation/tools/Containerfile.dnf b/documentation/tools/Containerfile.dnf new file mode 100644 index 0000000000..3dae744455 --- /dev/null +++ b/documentation/tools/Containerfile.dnf | |||
@@ -0,0 +1,25 @@ | |||
1 | ARG ARG_FROM=fedora:40 # default value to avoid warning | ||
2 | FROM $ARG_FROM | ||
3 | |||
4 | ARG DOCS=fedora_docs.sh | ||
5 | ARG DOCS_PDF=fedora_docs_pdf.sh | ||
6 | ARG PIP3=pip3_docs.sh | ||
7 | |||
8 | # relative to the location of the dockerfile | ||
9 | COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh | ||
10 | COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh | ||
11 | COPY --chmod=777 ${PIP3} /temp/pip3_docs.sh | ||
12 | |||
13 | RUN dnf update -y \ | ||
14 | && dnf install -y sudo \ | ||
15 | && yes | /temp/host_packages_docs.sh \ | ||
16 | && yes | /temp/host_packages_docs_pdf.sh \ | ||
17 | && yes | /temp/pip3_docs.sh \ | ||
18 | && dnf autoremove -y \ | ||
19 | && dnf clean all -y \ | ||
20 | && rm -rf /temp | ||
21 | |||
22 | RUN git config --global --add safe.directory /docs | ||
23 | |||
24 | ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"] | ||
25 | CMD ["publish"] | ||
diff --git a/documentation/tools/Containerfile.fedora b/documentation/tools/Containerfile.fedora new file mode 120000 index 0000000000..7237e9b99f --- /dev/null +++ b/documentation/tools/Containerfile.fedora | |||
@@ -0,0 +1 @@ | |||
Containerfile.dnf \ No newline at end of file | |||
diff --git a/documentation/tools/Containerfile.ubuntu b/documentation/tools/Containerfile.ubuntu new file mode 120000 index 0000000000..5a7a425197 --- /dev/null +++ b/documentation/tools/Containerfile.ubuntu | |||
@@ -0,0 +1 @@ | |||
Containerfile.apt \ No newline at end of file | |||
diff --git a/documentation/tools/Containerfile.zypper b/documentation/tools/Containerfile.zypper new file mode 100644 index 0000000000..f27ad1b476 --- /dev/null +++ b/documentation/tools/Containerfile.zypper | |||
@@ -0,0 +1,32 @@ | |||
1 | ARG ARG_FROM=opensuse/leap:15.4 # default value to avoid warning | ||
2 | FROM $ARG_FROM | ||
3 | |||
4 | ARG DOCS=opensuse_docs.sh | ||
5 | ARG DOCS_PDF=opensuse_docs_pdf.sh | ||
6 | ARG PIP3=pip3_docs.sh | ||
7 | |||
8 | # relative to the location of the dockerfile | ||
9 | COPY --chmod=777 ${DOCS} /temp/host_packages_docs.sh | ||
10 | COPY --chmod=777 ${DOCS_PDF} /temp/host_packages_docs_pdf.sh | ||
11 | COPY --chmod=777 ${PIP3} /temp/pip3_docs.sh | ||
12 | |||
13 | # Zypper doesn't have environment variables to specify whether to run in | ||
14 | # non-interactive mode like Debian does with DEBIAN_FRONTEND and piping yes to | ||
15 | # the scripts doesn't need to be enough as well, so let's force all zypper calls | ||
16 | # to be non-interactive by adding the appropriate flag in the scripts. | ||
17 | RUN for script in /temp/*.sh; do \ | ||
18 | sed -i 's/zypper/zypper --non-interactive/' $script; \ | ||
19 | done | ||
20 | |||
21 | RUN zypper update -y \ | ||
22 | && zypper install -y sudo \ | ||
23 | && yes | /temp/host_packages_docs.sh \ | ||
24 | && yes | /temp/host_packages_docs_pdf.sh \ | ||
25 | && yes | /temp/pip3_docs.sh \ | ||
26 | && zypper clean --all \ | ||
27 | && rm -rf /temp | ||
28 | |||
29 | RUN git config --global --add safe.directory /docs | ||
30 | |||
31 | ENTRYPOINT ["/usr/bin/env", "make", "-C", "documentation/"] | ||
32 | CMD ["publish"] | ||
diff --git a/documentation/tools/build-docs-container b/documentation/tools/build-docs-container new file mode 100755 index 0000000000..6b4d425434 --- /dev/null +++ b/documentation/tools/build-docs-container | |||
@@ -0,0 +1,175 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # -*- vim: set expandtab tabstop=2 shiftwidth=2: | ||
3 | # | ||
4 | # Build a container ready to build the documentation be reading the dependencies | ||
5 | # listed in shell scripts in documentation/tools/host_packages_scripts, and | ||
6 | # start a documentation build in this container. | ||
7 | # | ||
8 | # Usage: | ||
9 | # | ||
10 | # ./documentation/tools/build-docs-container <image> [<make target>] | ||
11 | # | ||
12 | # e.g.: | ||
13 | # | ||
14 | # ./documentation/tools/build-docs-container ubuntu:24.04 html | ||
15 | # | ||
16 | # Will build the docs in an Ubuntu 24.04 container in html. | ||
17 | # | ||
18 | # The container engine can be selected by exporting CONTAINERCMD in the | ||
19 | # environment. The default is docker, but podman can also be used. | ||
20 | |||
21 | set -eu -o pipefail | ||
22 | |||
23 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
24 | CONTAINERCMD=${CONTAINERCMD:-docker} | ||
25 | DOCS_DIR="$SCRIPT_DIR/../.." | ||
26 | SH_DIR="$SCRIPT_DIR/host_packages_scripts" | ||
27 | |||
28 | function usage() | ||
29 | { | ||
30 | echo "$0 -- script to build documentation from within a container | ||
31 | |||
32 | $0 OCI_IMAGE [make arguments...] | ||
33 | |||
34 | OCI_IMAGE is an image:tag of an OCI image hosted on hub.docker.com. It is one | ||
35 | of: | ||
36 | - debian:12 | ||
37 | - fedora:38 | ||
38 | - fedora:39 | ||
39 | - fedora:40 | ||
40 | - leap:15.4 | ||
41 | - leap:15.5 | ||
42 | - ubuntu:22.04 | ||
43 | - ubuntu:24.04 | ||
44 | |||
45 | [make arguments] is one or more argument to pass to the make command of | ||
46 | documentation/Makefile, see that file for what's supported. This is typically | ||
47 | intended to be used to provide specific make targets. | ||
48 | Default: publish | ||
49 | " | ||
50 | } | ||
51 | |||
52 | main () | ||
53 | { | ||
54 | if [ "$#" -lt 1 ]; then | ||
55 | usage | ||
56 | exit 1 | ||
57 | fi | ||
58 | |||
59 | local image="$1" | ||
60 | shift | ||
61 | |||
62 | OCI=$(which "$CONTAINERCMD") | ||
63 | |||
64 | # docker build doesn't accept 2 colons, so "sanitize" the name | ||
65 | local sanitized_dockername | ||
66 | sanitized_dockername=$(echo "$image" | tr ':.' '-') | ||
67 | |||
68 | local version | ||
69 | version=$(echo "$image" | awk -F: '{print $NF}') | ||
70 | |||
71 | case $image in | ||
72 | # Missing latexmk texlive-gnu-freefont packages at the very least | ||
73 | # "almalinux:8"*|\ | ||
74 | # "almalinux:9"*) | ||
75 | # containerfile=Containerfile.almalinux | ||
76 | # docs=almalinux_docs.sh | ||
77 | # docs_pdf=almalinux_docs_pdf.sh | ||
78 | # pip3=pip3_docs.sh | ||
79 | # ;; | ||
80 | # Missing python3-saneyaml | ||
81 | # "debian:11"*|\ | ||
82 | "debian:12"*) | ||
83 | containerfile=Containerfile.debian | ||
84 | docs=ubuntu_docs.sh | ||
85 | docs_pdf=ubuntu_docs_pdf.sh | ||
86 | ;; | ||
87 | "fedora:38"*|\ | ||
88 | "fedora:39"*|\ | ||
89 | "fedora:40"*) | ||
90 | containerfile=Containerfile.fedora | ||
91 | docs=fedora_docs.sh | ||
92 | docs_pdf=fedora_docs_pdf.sh | ||
93 | pip3=pip3_docs.sh | ||
94 | ;; | ||
95 | "leap:15.4"*|\ | ||
96 | "leap:15.5"*) | ||
97 | # Seems like issue with permissions package, c.f. | ||
98 | # | ||
99 | # Updating /etc/sysconfig/security ... | ||
100 | # /dev/zero: chown: Permission denied | ||
101 | # /dev/null: chown: Permission denied | ||
102 | # /dev/full: chown: Permission denied | ||
103 | # ERROR: not all operations were successful. | ||
104 | # Checking permissions and ownerships - using the permissions files | ||
105 | # /etc/permissions | ||
106 | # /etc/permissions.easy | ||
107 | # /etc/permissions.local | ||
108 | # setting / to root:root 0755. (wrong permissions 0555) | ||
109 | # setting /dev/zero to root:root 0666. (wrong owner/group 65534:65534) | ||
110 | # setting /dev/null to root:root 0666. (wrong owner/group 65534:65534) | ||
111 | # setting /dev/full to root:root 0666. (wrong owner/group 65534:65534) | ||
112 | # warning: %post(permissions-20240826-150600.10.12.1.x86_64) scriptlet failed, exit status 1 | ||
113 | # | ||
114 | # "leap:15.6"*) | ||
115 | image=opensuse/leap:$version | ||
116 | containerfile=Containerfile.zypper | ||
117 | docs=opensuse_docs.sh | ||
118 | docs_pdf=opensuse_docs_pdf.sh | ||
119 | pip3=pip3_docs.sh | ||
120 | ;; | ||
121 | # Missing python3-saneyaml | ||
122 | # "ubuntu:18.04"*|\ | ||
123 | # "ubuntu:20.04"*|\ | ||
124 | # Cannot fetch packages anymore | ||
125 | # "ubuntu:23.04"*|\ | ||
126 | "ubuntu:22.04"*|\ | ||
127 | "ubuntu:24.04"*) | ||
128 | containerfile=Containerfile.ubuntu | ||
129 | docs=ubuntu_docs.sh | ||
130 | docs_pdf=ubuntu_docs_pdf.sh | ||
131 | ;; | ||
132 | *) | ||
133 | echo "$image not supported!" | ||
134 | usage | ||
135 | exit 1 | ||
136 | ;; | ||
137 | esac | ||
138 | |||
139 | $OCI build \ | ||
140 | --tag "yocto-docs-$sanitized_dockername:latest" \ | ||
141 | --build-arg ARG_FROM="docker.io/$image" \ | ||
142 | --build-arg DOCS="$docs" \ | ||
143 | --build-arg DOCS_PDF="$docs_pdf" \ | ||
144 | --build-arg PIP3="${pip3:-}" \ | ||
145 | --file "$SCRIPT_DIR/$containerfile" \ | ||
146 | "$SH_DIR/" | ||
147 | |||
148 | local -a args_run=( | ||
149 | --rm | ||
150 | --interactive | ||
151 | --tty | ||
152 | --volume="$DOCS_DIR:/docs:rw" | ||
153 | --workdir=/docs | ||
154 | --security-opt label=disable | ||
155 | ) | ||
156 | |||
157 | if [ "$OCI" = "docker" ]; then | ||
158 | args_run+=( | ||
159 | --user="$(id -u)":"$(id -g)" | ||
160 | ) | ||
161 | elif [ "$OCI" = "podman" ]; then | ||
162 | # we need net access to fetch bitbake terms | ||
163 | args_run+=( | ||
164 | --cap-add=NET_RAW | ||
165 | --userns=keep-id | ||
166 | ) | ||
167 | fi | ||
168 | |||
169 | $OCI run \ | ||
170 | "${args_run[@]}" \ | ||
171 | "yocto-docs-$sanitized_dockername" \ | ||
172 | "$@" | ||
173 | } | ||
174 | |||
175 | main "$@" | ||
diff --git a/documentation/tools/host_packages_scripts/almalinux_docs.sh b/documentation/tools/host_packages_scripts/almalinux_docs.sh new file mode 100644 index 0000000000..8188d529a1 --- /dev/null +++ b/documentation/tools/host_packages_scripts/almalinux_docs.sh | |||
@@ -0,0 +1 @@ | |||
sudo dnf install git glibc-locale-source librsvg2-tools make python3-pip which | |||
diff --git a/documentation/tools/host_packages_scripts/almalinux_docs_pdf.sh b/documentation/tools/host_packages_scripts/almalinux_docs_pdf.sh new file mode 100644 index 0000000000..8341eb8c25 --- /dev/null +++ b/documentation/tools/host_packages_scripts/almalinux_docs_pdf.sh | |||
@@ -0,0 +1 @@ | |||
sudo dnf install latexmk texlive-collection-fontsrecommended texlive-collection-latex texlive-collection-latexrecommended texlive-collection-xetex texlive-fncychap texlive-gnu-freefont texlive-tex-gyre texlive-xetex | |||
diff --git a/documentation/tools/host_packages_scripts/almalinux_essential.sh b/documentation/tools/host_packages_scripts/almalinux_essential.sh new file mode 100644 index 0000000000..76c5280eeb --- /dev/null +++ b/documentation/tools/host_packages_scripts/almalinux_essential.sh | |||
@@ -0,0 +1,5 @@ | |||
1 | sudo dnf install -y epel-release | ||
2 | sudo yum install dnf-plugins-core | ||
3 | sudo dnf config-manager --set-enabled crb | ||
4 | sudo dnf makecache | ||
5 | sudo dnf install bzip2 ccache chrpath cpio cpp diffstat diffutils gawk gcc gcc-c++ git glibc-devel glibc-langpack-en gzip libacl make patch perl perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3 python3-GitPython python3-jinja2 python3-pexpect python3-pip rpcgen socat tar texinfo unzip wget which xz zstd | ||
diff --git a/documentation/tools/host_packages_scripts/fedora_docs.sh b/documentation/tools/host_packages_scripts/fedora_docs.sh new file mode 100644 index 0000000000..8188d529a1 --- /dev/null +++ b/documentation/tools/host_packages_scripts/fedora_docs.sh | |||
@@ -0,0 +1 @@ | |||
sudo dnf install git glibc-locale-source librsvg2-tools make python3-pip which | |||
diff --git a/documentation/tools/host_packages_scripts/fedora_docs_pdf.sh b/documentation/tools/host_packages_scripts/fedora_docs_pdf.sh new file mode 100644 index 0000000000..816f1c36ec --- /dev/null +++ b/documentation/tools/host_packages_scripts/fedora_docs_pdf.sh | |||
@@ -0,0 +1 @@ | |||
sudo dnf install 'texlive-collection-lang*' latexmk texlive-collection-fontsextra texlive-collection-fontsrecommended texlive-collection-latex texlive-collection-latexextra texlive-collection-latexrecommended texlive-collection-xetex texlive-fncychap texlive-gnu-freefont texlive-tex-gyre texlive-xetex | |||
diff --git a/documentation/tools/host_packages_scripts/fedora_essential.sh b/documentation/tools/host_packages_scripts/fedora_essential.sh new file mode 100644 index 0000000000..ea14134398 --- /dev/null +++ b/documentation/tools/host_packages_scripts/fedora_essential.sh | |||
@@ -0,0 +1 @@ | |||
sudo dnf install bzip2 ccache chrpath cpio cpp diffstat diffutils file findutils gawk gcc gcc-c++ git glibc-devel glibc-langpack-en gzip hostname libacl make patch perl perl-Data-Dumper perl-File-Compare perl-File-Copy perl-FindBin perl-Text-ParseWords perl-Thread-Queue perl-bignum perl-locale python python3 python3-GitPython python3-jinja2 python3-pexpect python3-pip rpcgen socat tar texinfo unzip wget which xz zstd | |||
diff --git a/documentation/tools/host_packages_scripts/opensuse_docs.sh b/documentation/tools/host_packages_scripts/opensuse_docs.sh new file mode 100644 index 0000000000..7d36eb0f99 --- /dev/null +++ b/documentation/tools/host_packages_scripts/opensuse_docs.sh | |||
@@ -0,0 +1 @@ | |||
sudo zypper install git glibc-i18ndata make python3-pip rsvg-convert which | |||
diff --git a/documentation/tools/host_packages_scripts/opensuse_docs_pdf.sh b/documentation/tools/host_packages_scripts/opensuse_docs_pdf.sh new file mode 100644 index 0000000000..ee9f07886c --- /dev/null +++ b/documentation/tools/host_packages_scripts/opensuse_docs_pdf.sh | |||
@@ -0,0 +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 | |||
diff --git a/documentation/tools/host_packages_scripts/opensuse_essential.sh b/documentation/tools/host_packages_scripts/opensuse_essential.sh new file mode 100644 index 0000000000..0d37e9bd5a --- /dev/null +++ b/documentation/tools/host_packages_scripts/opensuse_essential.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | sudo zypper install bzip2 chrpath diffstat gcc gcc-c++ git gzip hostname libacl1 make makeinfo patch python python-curses python-xml python3 python3-Jinja2 python3-curses python3-pexpect python3-pip rpcgen socat tar wget which xz zstd | ||
2 | sudo pip3 install GitPython | ||
diff --git a/documentation/tools/host_packages_scripts/pip3_docs.sh b/documentation/tools/host_packages_scripts/pip3_docs.sh new file mode 100644 index 0000000000..fd6ad98053 --- /dev/null +++ b/documentation/tools/host_packages_scripts/pip3_docs.sh | |||
@@ -0,0 +1 @@ | |||
sudo pip3 install sphinx sphinx_rtd_theme pyyaml | |||
diff --git a/documentation/tools/host_packages_scripts/ubuntu_docs.sh b/documentation/tools/host_packages_scripts/ubuntu_docs.sh new file mode 100644 index 0000000000..d2a1832e27 --- /dev/null +++ b/documentation/tools/host_packages_scripts/ubuntu_docs.sh | |||
@@ -0,0 +1 @@ | |||
sudo apt install git librsvg2-bin locales make python3-saneyaml python3-saneyaml python3-sphinx-rtd-theme sphinx | |||
diff --git a/documentation/tools/host_packages_scripts/ubuntu_docs_pdf.sh b/documentation/tools/host_packages_scripts/ubuntu_docs_pdf.sh new file mode 100644 index 0000000000..d6310bd21d --- /dev/null +++ b/documentation/tools/host_packages_scripts/ubuntu_docs_pdf.sh | |||
@@ -0,0 +1 @@ | |||
sudo apt install fonts-freefont-otf latexmk tex-gyre texlive-fonts-extra texlive-fonts-recommended texlive-lang-all texlive-latex-extra texlive-latex-recommended texlive-xetex | |||
diff --git a/documentation/tools/host_packages_scripts/ubuntu_essential.sh b/documentation/tools/host_packages_scripts/ubuntu_essential.sh new file mode 100644 index 0000000000..6584a0403d --- /dev/null +++ b/documentation/tools/host_packages_scripts/ubuntu_essential.sh | |||
@@ -0,0 +1 @@ | |||
sudo apt-get install build-essential chrpath cpio debianutils diffstat file gawk gcc git iputils-ping libacl1 locales python3 python3-git python3-jinja2 python3-pexpect python3-pip python3-subunit socat texinfo unzip wget xz-utils zstd | |||