Subject: [bug#74746] [PATCH 3/6] gnu: docker: Update substitutions in patch-paths phase.

From: Arthur Rodrigues <[email-masked]>
Date: Wed, 11 Jun 2025 15:07:39 +0000

Change-Id: I9d8c6fbc189858bb061deeadbcc616787a0abbc3
---
 gnu/packages/docker.scm | 63 +++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 34 deletions(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index b03b551a05..755e2d7211 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -356,67 +356,62 @@ (define-public docker
       #~(modify-phases %standard-phases
           (add-after 'unpack 'patch-paths
             (lambda* (#:key inputs #:allow-other-keys)
-              (substitute* "builder/builder-next/executor_unix.go"
-                (("CommandCandidates:.*runc.*")
-                 (string-append "CommandCandidates: []string{\""
+              (substitute* "builder/builder-next/executor_linux.go"
+                (("runcCmds := .*")
+                 (string-append "runcCmds := []string{\""
                                 (search-input-file inputs "/sbin/runc")
-                                "\"},\n")))
+                                "\"}")))
               (substitute* "vendor/github.com/containerd/go-runc/runc.go"
                 (("DefaultCommand = .*")
                  (string-append "DefaultCommand = \""
                                 (search-input-file inputs "/sbin/runc")
                                 "\"\n")))
-              (substitute* "vendor/github.com/containerd/containerd/\
-runtime/v1/linux/runtime.go"
-                (("defaultRuntime[ \t]*=.*")
-                 (string-append "defaultRuntime = \""
-                                (search-input-file inputs "/sbin/runc")
-                                "\"\n"))
-                (("defaultShim[ \t]*=.*")
-                 (string-append "defaultShim = \""
-                                (search-input-file inputs "/bin/containerd-shim")
-                                "\"\n")))
-              (substitute* "daemon/daemon_unix.go"
-                (("DefaultShimBinary = .*")
-                 (string-append "DefaultShimBinary = \""
-                                (search-input-file inputs "/bin/containerd-shim")
-                                "\"\n"))
-                (("DefaultRuntimeBinary = .*")
-                 (string-append "DefaultRuntimeBinary = \""
-                                (search-input-file inputs "/sbin/runc")
-                                "\"\n")))
+              (substitute* "daemon/runtime_unix_test.go"
+                (("Path: \"/bin/true\",")
+                 (string-append "Path: \""
+                                (search-input-file inputs "/bin/true")
+                                "\","))
+                (("Path: \"/bin/false\",")
+                 (string-append "Path: \""
+                                (search-input-file inputs "/bin/false")
+                                "\",")))
               (substitute* "daemon/runtime_unix.go"
                 (("defaultRuntimeName = .*")
                  (string-append "defaultRuntimeName = \""
                                 (search-input-file inputs "/sbin/runc")
                                 "\"\n")))
               (substitute* "daemon/config/config.go"
-                (("StockRuntimeName = .*")
-                 (string-append "StockRuntimeName = \""
+                (("DefaultRuntimeBinary = .*")
+                 (string-append "DefaultRuntimeBinary = \""
                                 (search-input-file inputs "/sbin/runc")
                                 "\"\n"))
                 (("DefaultInitBinary = .*")
                  (string-append "DefaultInitBinary = \""
                                 (search-input-file inputs "/bin/tini-static")
                                 "\"\n")))
-              (substitute* "daemon/config/config_common_unix_test.go"
+              (substitute* "daemon/config/config_linux_test.go"
                 (("expectedInitPath: \"docker-init\"")
                  (string-append "expectedInitPath: \""
                                 (search-input-file inputs "/bin/tini-static")
                                 "\"")))
+              (substitute* "vendor.mod"
+                (("go 1.23.0")
+                 (string-append "go 1.23")))
+              ;; Avoid installation of proxy in unit tests
+              (substitute* "hack/test/unit"
+                (("if ! type docker-proxy")
+                 (string-append "if type docker-proxy"))
+                ;; Disable testing libnetwork, since we don't package it as an output
+                (("libnetwork_pkg_list=.*")
+                 (string-append "libnetwork_pkg_list=\"\"\n"))
+                (("BUILDFLAGS=.*")
+                 (string-append "BUILDFLAGS=(-tags 'netgo')\n")))
+
               (substitute* "vendor/github.com/moby/buildkit/executor/\
 runcexecutor/executor.go"
                 (("var defaultCommandCandidates = .*")
                  (string-append "var defaultCommandCandidates = []string{\""
                                 (search-input-file inputs "/sbin/runc") "\"}")))
-              (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
-                (("var userlandProxyCommandName = .*")
-                 (string-append "var userlandProxyCommandName = \""
-                                (search-input-file inputs "/bin/proxy")
-                                "\"\n")))
-              (substitute* "pkg/archive/archive.go"
-                (("string\\{\"xz")
-                 (string-append "string{\"" (search-input-file inputs "/bin/xz"))))
 
               (let ((source-files (filter (lambda (name)
                                             (not (string-contains name "test")))
-- 
2.49.0