diff mbox series

[8/8] tools/build-docs-container: make it possible to print the distro list

Message ID 20251222-concurrent-safety-v1-8-e3d86e44cd38@bootlin.com
State New
Headers show
Series Parallel docs build improvements | expand

Commit Message

Antonin Godard Dec. 22, 2025, 12:27 p.m. UTC
Add a special "supported_distros" argument to the script to make it
possible to return the list of supported distros. This is useful for use
in a external script, to run the docs build on a specific set or all
supported distros concurrently.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 documentation/tools/build-docs-container | 49 +++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 17 deletions(-)

Comments

Quentin Schulz Jan. 12, 2026, 1:25 p.m. UTC | #1
Hi Antonin,

On 12/22/25 1:27 PM, Antonin Godard wrote:
> Add a special "supported_distros" argument to the script to make it
> possible to return the list of supported distros. This is useful for use
> in a external script, to run the docs build on a specific set or all
> supported distros concurrently.
> 
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
>   documentation/tools/build-docs-container | 49 +++++++++++++++++++++-----------
>   1 file changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/documentation/tools/build-docs-container b/documentation/tools/build-docs-container
> index c5cdd9c4c..510435c3c 100755
> --- a/documentation/tools/build-docs-container
> +++ b/documentation/tools/build-docs-container
> @@ -20,6 +20,32 @@
>   
>   set -eu -o pipefail
>   
> +declare -a _SUPPORTED_DISTROS=(
> +  almalinux:8
> +  almalinux:9
> +  centos:stream9
> +  debian:12
> +  debian:13
> +  fedora:39
> +  fedora:40
> +  fedora:41
> +  fedora:42
> +  leap:15.5
> +  leap:15.6
> +  rockylinux:8
> +  rockylinux:9
> +  ubuntu:22.04
> +  ubuntu:24.04
> +  ubuntu:25.04
> +  ubuntu:25.10
> +)
> +
> +
> +if [ "${1:-}" = "supported_distros" ]; then
> +  echo "${_SUPPORTED_DISTROS[@]}"
> +  exit 0
> +fi
> +
>   SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
>   CONTAINERCMD=${CONTAINERCMD:-docker}
>   DOCS_DIR="$SCRIPT_DIR/../.."
> @@ -35,24 +61,13 @@ $0 OCI_IMAGE [make arguments...]
>   
>      OCI_IMAGE is an image:tag of an OCI image hosted on hub.docker.com. It is one

Oopsies, centos:stream9 is not on hub.docker.com!

>      of:
> -     - almalinux:8
> -     - almalinux:9
> -     - centos:stream9
> -     - debian:12
> -     - debian:13
> -     - fedora:39
> -     - fedora:40
> -     - fedora:41
> -     - fedora:42
> -     - leap:15.5
> -     - leap:15.6
> -     - rockylinux:8
> -     - rockylinux:9
> -     - ubuntu:22.04
> -     - ubuntu:24.04
> -     - ubuntu:25.04
> -     - ubuntu:25.10
> +"
> +
> +  for distro in "${_SUPPORTED_DISTROS[@]}"; do
> +    echo "   - $distro"
> +  done
>   
> +  echo "

No need to cut the usage string in two, you can call subshells directly 
in it, e.g.:

echo "test

$(for distro in "${_SUPPORTED_DISTROS[@]}"; do
     echo "   - $distro"
done)

testestest"

Should work just fine.

No need to change it, just wanted to highlight there's also another way 
of doing it :)

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Tested-by: Quentin Schulz <quentin.schulz@cherry.de>

Thanks!
Quentin
diff mbox series

Patch

diff --git a/documentation/tools/build-docs-container b/documentation/tools/build-docs-container
index c5cdd9c4c..510435c3c 100755
--- a/documentation/tools/build-docs-container
+++ b/documentation/tools/build-docs-container
@@ -20,6 +20,32 @@ 
 
 set -eu -o pipefail
 
+declare -a _SUPPORTED_DISTROS=(
+  almalinux:8
+  almalinux:9
+  centos:stream9
+  debian:12
+  debian:13
+  fedora:39
+  fedora:40
+  fedora:41
+  fedora:42
+  leap:15.5
+  leap:15.6
+  rockylinux:8
+  rockylinux:9
+  ubuntu:22.04
+  ubuntu:24.04
+  ubuntu:25.04
+  ubuntu:25.10
+)
+
+
+if [ "${1:-}" = "supported_distros" ]; then
+  echo "${_SUPPORTED_DISTROS[@]}"
+  exit 0
+fi
+
 SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
 CONTAINERCMD=${CONTAINERCMD:-docker}
 DOCS_DIR="$SCRIPT_DIR/../.."
@@ -35,24 +61,13 @@  $0 OCI_IMAGE [make arguments...]
 
    OCI_IMAGE is an image:tag of an OCI image hosted on hub.docker.com. It is one
    of:
-     - almalinux:8
-     - almalinux:9
-     - centos:stream9
-     - debian:12
-     - debian:13
-     - fedora:39
-     - fedora:40
-     - fedora:41
-     - fedora:42
-     - leap:15.5
-     - leap:15.6
-     - rockylinux:8
-     - rockylinux:9
-     - ubuntu:22.04
-     - ubuntu:24.04
-     - ubuntu:25.04
-     - ubuntu:25.10
+"
+
+  for distro in "${_SUPPORTED_DISTROS[@]}"; do
+    echo "   - $distro"
+  done
 
+  echo "
    [make arguments] is one or more argument to pass to the make command of
    documentation/Makefile, see that file for what's supported. This is typically
    intended to be used to provide specific make targets.