diff mbox series

tools/build-docs-container: use CONTAINERCMD to append args

Message ID 20251009-fix-build-docs-container-args-v1-1-169ce4248462@bootlin.com
State Superseded
Headers show
Series tools/build-docs-container: use CONTAINERCMD to append args | expand

Commit Message

Antonin Godard Oct. 9, 2025, 10:05 a.m. UTC
What we have is OCI = $(which $CONTAINERCMD) = /usr/bin/{docker,podman}.
So we never pass these if conditions. Compare against CONTAINERCMD instead.

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


---
base-commit: 09c7800333b17b21e50d2a089a3ae1b123697243
change-id: 20251009-fix-build-docs-container-args-d50c9ecbf7bf

Best regards,
--  
Antonin Godard <antonin.godard@bootlin.com>

Comments

Quentin Schulz Oct. 9, 2025, 12:32 p.m. UTC | #1
Hi Antonin,

On 10/9/25 12:05 PM, Antonin Godard via lists.yoctoproject.org wrote:
> What we have is OCI = $(which $CONTAINERCMD) = /usr/bin/{docker,podman}.
> So we never pass these if conditions. Compare against CONTAINERCMD instead.
> 
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>

Nope, this won't work if you call the script with docker but run with 
podman. This would be the case if you have podman-docker package 
installed on fedora for example, c.f. 
https://packages.fedoraproject.org/pkgs/podman/podman-docker/.

So we do really want to test OCI I think.

A few options:
- "$(basename "$OCI")"
- if [[ "$OCI" =~ "/docker$" ]];
   elif [[ "$OCI" =~ "/podman$" ]]
   c.f. 
https://www.gnu.org/software/bash/manual/html_node/Conditional-Constructs.html#index-_005b_005b
- if echo "$OCI" | grep -q -w docker; then
   elif echo "$OCI" | grep -q -w podman; then

This script has worked fine for me with podman-docker script with only 
podman installed on my system, can you tell me what the issue is so 
we're sure we're fixing the issues?

Cheers,
Quentin
Antonin Godard Oct. 13, 2025, 7:08 a.m. UTC | #2
On Thu Oct 9, 2025 at 2:32 PM CEST, Quentin Schulz via lists.yoctoproject.org wrote:
> Hi Antonin,
>
> On 10/9/25 12:05 PM, Antonin Godard via lists.yoctoproject.org wrote:
>> What we have is OCI = $(which $CONTAINERCMD) = /usr/bin/{docker,podman}.
>> So we never pass these if conditions. Compare against CONTAINERCMD instead.
>> 
>> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
>
> Nope, this won't work if you call the script with docker but run with 
> podman. This would be the case if you have podman-docker package 
> installed on fedora for example, c.f. 
> https://packages.fedoraproject.org/pkgs/podman/podman-docker/.

Oh I see... I did not guess that.

I'll send a v2.

Thanks,
Antonin
diff mbox series

Patch

diff --git a/documentation/tools/build-docs-container b/documentation/tools/build-docs-container
index 70e05f295..a93e0668b 100755
--- a/documentation/tools/build-docs-container
+++ b/documentation/tools/build-docs-container
@@ -157,11 +157,11 @@  main ()
     --security-opt label=disable
   )
 
-  if [ "$OCI" = "docker" ]; then
+  if [ "$CONTAINERCMD" = "docker" ]; then
     args_run+=(
       --user="$(id -u)":"$(id -g)"
     )
-  elif [ "$OCI" = "podman" ]; then
+  elif [ "$CONTAINERCMD" = "podman" ]; then
     # we need net access to fetch bitbake terms
     args_run+=(
       --cap-add=NET_RAW