all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#35282] [PATCH] gnu: docker: Patch paths of xz and docker-proxy.
@ 2019-04-15  0:12 Maxim Cournoyer
  2019-04-15  5:56 ` Danny Milosavljevic
  0 siblings, 1 reply; 8+ messages in thread
From: Maxim Cournoyer @ 2019-04-15  0:12 UTC (permalink / raw)
  To: 35282

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

This patch series make a couple cosmetic/performance changes to the
docker package, and then goes on to patch the references to the
docker-proxy binary and the xz compression tool.

Prior to this patch, importing a docker image compressed using xz such
as in:

--8<---------------cut here---------------start------------->8---
docker load < some-docker-image.tar.xz
--8<---------------cut here---------------end--------------->8---

Would fail unless xz was found in the system's profile.

Thanks,

Maxim


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-docker-Fix-indentation.patch --]
[-- Type: text/x-patch, Size: 14272 bytes --]

From 1405716eff1c15bf2a44704f4a32e6e823f73bf2 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 11 Apr 2019 21:55:48 -0400
Subject: [PATCH 1/7] gnu: docker: Fix indentation.

* gnu/packages/docker.scm (docker): Fix indentation using Emacs.
---
 gnu/packages/docker.scm | 184 ++++++++++++++++++++--------------------
 1 file changed, 92 insertions(+), 92 deletions(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 1067555296..7445856347 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -299,17 +299,17 @@ built-in registry server of Docker.")
     (version %docker-version)
     (source
      (origin
-      (method git-fetch)
-      (uri (git-reference
-            (url "https://github.com/docker/engine.git")
-            (commit (string-append "v" version))))
-      (file-name (git-file-name name version))
-      (sha256
-       (base32 "06yr5xwr181lalh8z1lk07nxlp7hn38aq8cyqjk617dfy4lz0ixx"))
-      (patches
-       (search-patches "docker-engine-test-noinstall.patch"
-                       "docker-fix-tests.patch"
-                       "docker-use-fewer-modprobes.patch"))))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/docker/engine.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "06yr5xwr181lalh8z1lk07nxlp7hn38aq8cyqjk617dfy4lz0ixx"))
+       (patches
+        (search-patches "docker-engine-test-noinstall.patch"
+                        "docker-fix-tests.patch"
+                        "docker-use-fewer-modprobes.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:modules
@@ -326,77 +326,77 @@ built-in registry server of Docker.")
          (add-after 'unpack 'patch-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "builder/builder-next/executor_unix.go"
-              (("CommandCandidates:.*runc.*")
-               (string-append "CommandCandidates: []string{\""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"},\n")))
+               (("CommandCandidates:.*runc.*")
+                (string-append "CommandCandidates: []string{\""
+                               (assoc-ref inputs "runc")
+                               "/sbin/runc\"},\n")))
              (substitute* "vendor/github.com/containerd/go-runc/runc.go"
-              (("DefaultCommand = .*")
-               (string-append "DefaultCommand = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n")))
+               (("DefaultCommand = .*")
+                (string-append "DefaultCommand = \""
+                               (assoc-ref inputs "runc")
+                               "/sbin/runc\"\n")))
              (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
-              (("defaultRuntime[ \t]*=.*")
-               (string-append "defaultRuntime = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n"))
-              (("defaultShim[ \t]*=.*")
-               (string-append "defaultShim = \""
-                              (assoc-ref inputs "containerd")
-                              "/bin/containerd-shim\"\n")))
+               (("defaultRuntime[ \t]*=.*")
+                (string-append "defaultRuntime = \""
+                               (assoc-ref inputs "runc")
+                               "/sbin/runc\"\n"))
+               (("defaultShim[ \t]*=.*")
+                (string-append "defaultShim = \""
+                               (assoc-ref inputs "containerd")
+                               "/bin/containerd-shim\"\n")))
              (substitute* "daemon/daemon_unix.go"
-              (("DefaultShimBinary = .*")
-               (string-append "DefaultShimBinary = \""
-                              (assoc-ref inputs "containerd")
-                              "/bin/containerd-shim\"\n"))
-              (("DefaultRuntimeBinary = .*")
-               (string-append "DefaultRuntimeBinary = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n"))
-              (("DefaultRuntimeName = .*")
-               (string-append "DefaultRuntimeName = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n")))
+               (("DefaultShimBinary = .*")
+                (string-append "DefaultShimBinary = \""
+                               (assoc-ref inputs "containerd")
+                               "/bin/containerd-shim\"\n"))
+               (("DefaultRuntimeBinary = .*")
+                (string-append "DefaultRuntimeBinary = \""
+                               (assoc-ref inputs "runc")
+                               "/sbin/runc\"\n"))
+               (("DefaultRuntimeName = .*")
+                (string-append "DefaultRuntimeName = \""
+                               (assoc-ref inputs "runc")
+                               "/sbin/runc\"\n")))
              (substitute* "daemon/config/config.go"
-              (("StockRuntimeName = .*")
-               (string-append "StockRuntimeName = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n")))
+               (("StockRuntimeName = .*")
+                (string-append "StockRuntimeName = \""
+                               (assoc-ref inputs "runc")
+                               "/sbin/runc\"\n")))
              (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
-              (("var defaultCommandCandidates = .*")
-               (string-append "var defaultCommandCandidates = []string{\""
-                              (assoc-ref inputs "runc") "/sbin/runc\"}")))
+               (("var defaultCommandCandidates = .*")
+                (string-append "var defaultCommandCandidates = []string{\""
+                               (assoc-ref inputs "runc") "/sbin/runc\"}")))
              (let ((source-files (filter (lambda (name)
-                                    (not (string-contains name "test")))
-                                  (find-files "." "\\.go$"))))
+                                           (not (string-contains name "test")))
+                                         (find-files "." "\\.go$"))))
                (let-syntax ((substitute-LookPath
                              (lambda (x)
                                (syntax-case x ()
                                  ((substitute-LookPath source-text package
                                                        relative-path)
                                   #`(substitute* source-files
-                                     ((#,(string-append "exec\\.LookPath\\(\""
-                                                        (syntax->datum
-                                                         #'source-text)
-                                                        "\")"))
-                                      (string-append "\""
-                                                     (assoc-ref inputs package)
-                                                     relative-path
-                                                     "\", error(nil)")))))))
+                                      ((#,(string-append "exec\\.LookPath\\(\""
+                                                         (syntax->datum
+                                                          #'source-text)
+                                                         "\")"))
+                                       (string-append "\""
+                                                      (assoc-ref inputs package)
+                                                      relative-path
+                                                      "\", error(nil)")))))))
                             (substitute-Command
                              (lambda (x)
                                (syntax-case x ()
                                  ((substitute-LookPath source-text package
                                                        relative-path)
                                   #`(substitute* source-files
-                                     ((#,(string-append "exec\\.Command\\(\""
-                                                        (syntax->datum
-                                                         #'source-text)
-                                                        "\"")) ; )
-                                      (string-append "exec.Command(\""
-                                                     (assoc-ref inputs package)
-                                                     relative-path
-                                                     "\"")))))))) ; )
+                                      ((#,(string-append "exec\\.Command\\(\""
+                                                         (syntax->datum
+                                                          #'source-text)
+                                                         "\"")) ; )
+                                       (string-append "exec.Command(\""
+                                                      (assoc-ref inputs package)
+                                                      relative-path
+                                                      "\"")))))))) ; )
                  (substitute-LookPath "ps" "procps" "/bin/ps")
                  (substitute-LookPath "mkfs.xfs" "xfsprogs" "/bin/mkfs.xfs")
                  (substitute-LookPath "lvmdiskscan" "lvm2" "/sbin/lvmdiskscan")
@@ -418,13 +418,13 @@ built-in registry server of Docker.")
                  (substitute-Command "tune2fs" "e2fsprogs" "/sbin/tune2fs")
                  (substitute-Command "blkid" "util-linux" "/sbin/blkid")
                  (substitute-Command "resize2fs" "e2fsprogs" "/sbin/resize2fs")
-; docker-mountfrom ??
-; docker
-; docker-untar ??
-; docker-applyLayer ??
-; /usr/bin/uname
-; grep
-; apparmor_parser
+                 ;; docker-mountfrom ??
+                 ;; docker
+                 ;; docker-untar ??
+                 ;; docker-applyLayer ??
+                 ;; /usr/bin/uname
+                 ;; grep
+                 ;; apparmor_parser
                  (substitute-Command "ps" "procps" "/bin/ps")
                  (substitute-Command "losetup" "util-linux" "/sbin/losetup")
                  (substitute-Command "uname" "coreutils" "/bin/uname")
@@ -434,24 +434,24 @@ built-in registry server of Docker.")
                ;; invokes other programs we don't know about and thus don't
                ;; substitute.
                (substitute* source-files
-                ;; Search for Java in PATH.
-                (("\\<exec\\.Command\\(\"java\"") ; )
-                 "xxec.Command(\"java\"") ; )
-                ;; Search for AUFS in PATH (mainline Linux doesn't support it).
-                (("\\<exec\\.Command\\(\"auplink\"") ; )
-                 "xxec.Command(\"auplink\"") ; )
-                ;; Fail on other unsubstituted commands.
-                (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
-                  _ executable) ; )
-                 (string-append "exec.Guix_doesnt_want_Command(\""
-                                executable "\"")) ;)
-                (("\\<xxec\\.Command")
-                 "exec.Command")
-                ;; Search for ZFS in PATH.
-                (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
-                ;; Fail on other unsubstituted LookPaths.
-                (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") ; ))
-                (("\\<LooxPath") "LookPath")))
+                 ;; Search for Java in PATH.
+                 (("\\<exec\\.Command\\(\"java\"") ; )
+                  "xxec.Command(\"java\"")         ; )
+                 ;; Search for AUFS in PATH (mainline Linux doesn't support it).
+                 (("\\<exec\\.Command\\(\"auplink\"") ; )
+                  "xxec.Command(\"auplink\"")         ; )
+                 ;; Fail on other unsubstituted commands.
+                 (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
+                   _ executable)        ; )
+                  (string-append "exec.Guix_doesnt_want_Command(\""
+                                 executable "\"")) ;)
+                 (("\\<xxec\\.Command")
+                  "exec.Command")
+                 ;; Search for ZFS in PATH.
+                 (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
+                 ;; Fail on other unsubstituted LookPaths.
+                 (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") ; ))
+                 (("\\<LooxPath") "LookPath")))
              #t))
          (add-after 'patch-paths 'delete-failing-tests
            (lambda _
@@ -498,7 +498,7 @@ built-in registry server of Docker.")
              ;; But go needs to have the uncanonicalized directory name, so
              ;; store that.
              (setenv "PWD" (string-append (getcwd)
-                            "/.gopath/src/github.com/docker/docker"))
+                                          "/.gopath/src/github.com/docker/docker"))
              (with-directory-excursion ".gopath/src/github.com/docker/docker"
                (invoke "hack/test/unit"))
              (setenv "PWD" #f)
@@ -512,7 +512,7 @@ built-in registry server of Docker.")
                #t))))))
     (inputs
      `(("btrfs-progs" ,btrfs-progs)
-       ("containerd" ,containerd) ; for containerd-shim
+       ("containerd" ,containerd)       ; for containerd-shim
        ("coreutils" ,coreutils)
        ("dbus" ,dbus)
        ("e2fsprogs" ,e2fsprogs)
@@ -528,7 +528,7 @@ built-in registry server of Docker.")
        ("lvm2" ,lvm2)
        ("xfsprogs" ,xfsprogs)))
     (native-inputs
-     `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc)
+     `(("eudev" ,eudev)      ; TODO: Should be propagated by lvm2 (.pc -> .pc)
        ("go" ,go)
        ("pkg-config" ,pkg-config)))
     (synopsis "Docker container component library, and daemon")
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-docker-Cleanup-extraneous-comments.patch --]
[-- Type: text/x-patch, Size: 3186 bytes --]

From 64b8226b954c18aa9fd246c26b8c5958fa5d2e86 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 11 Apr 2019 22:08:52 -0400
Subject: [PATCH 2/7] gnu: docker: Cleanup extraneous comments.

* gnu/packages/docker.scm (docker): Remove "parenthesis-balancing" comments.
---
 gnu/packages/docker.scm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 7445856347..10aa3aa5b4 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -392,11 +392,11 @@ built-in registry server of Docker.")
                                       ((#,(string-append "exec\\.Command\\(\""
                                                          (syntax->datum
                                                           #'source-text)
-                                                         "\"")) ; )
+                                                         "\""))
                                        (string-append "exec.Command(\""
                                                       (assoc-ref inputs package)
                                                       relative-path
-                                                      "\"")))))))) ; )
+                                                      "\""))))))))
                  (substitute-LookPath "ps" "procps" "/bin/ps")
                  (substitute-LookPath "mkfs.xfs" "xfsprogs" "/bin/mkfs.xfs")
                  (substitute-LookPath "lvmdiskscan" "lvm2" "/sbin/lvmdiskscan")
@@ -435,22 +435,22 @@ built-in registry server of Docker.")
                ;; substitute.
                (substitute* source-files
                  ;; Search for Java in PATH.
-                 (("\\<exec\\.Command\\(\"java\"") ; )
-                  "xxec.Command(\"java\"")         ; )
+                 (("\\<exec\\.Command\\(\"java\"")
+                  "xxec.Command(\"java\"")
                  ;; Search for AUFS in PATH (mainline Linux doesn't support it).
-                 (("\\<exec\\.Command\\(\"auplink\"") ; )
-                  "xxec.Command(\"auplink\"")         ; )
+                 (("\\<exec\\.Command\\(\"auplink\"")
+                  "xxec.Command(\"auplink\"")
                  ;; Fail on other unsubstituted commands.
                  (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
-                   _ executable)        ; )
+                   _ executable)
                   (string-append "exec.Guix_doesnt_want_Command(\""
-                                 executable "\"")) ;)
+                                 executable "\""))
                  (("\\<xxec\\.Command")
                   "exec.Command")
                  ;; Search for ZFS in PATH.
                  (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
                  ;; Fail on other unsubstituted LookPaths.
-                 (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") ; ))
+                 (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"")
                  (("\\<LooxPath") "LookPath")))
              #t))
          (add-after 'patch-paths 'delete-failing-tests
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-docker-Harmonize-LookPath-regexes.patch --]
[-- Type: text/x-patch, Size: 1967 bytes --]

From 4ec93a7d398693bc35584b7c287cd49cdfcf2d8f Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 11 Apr 2019 22:12:00 -0400
Subject: [PATCH 3/7] gnu: docker: Harmonize LookPath regexes.

* gnu/packages/docker.scm (docker)[phases]: In the patch-paths phase, update
the regexes used by SUBSTITUTE-LOOKPATH and SUBSTITUTE-COMMAND to match at the
start of the word, like it's done later.
---
 gnu/packages/docker.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 10aa3aa5b4..6e598e4d18 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -375,7 +375,7 @@ built-in registry server of Docker.")
                                  ((substitute-LookPath source-text package
                                                        relative-path)
                                   #`(substitute* source-files
-                                      ((#,(string-append "exec\\.LookPath\\(\""
+                                      ((#,(string-append "\\<exec\\.LookPath\\(\""
                                                          (syntax->datum
                                                           #'source-text)
                                                          "\")"))
@@ -389,7 +389,7 @@ built-in registry server of Docker.")
                                  ((substitute-LookPath source-text package
                                                        relative-path)
                                   #`(substitute* source-files
-                                      ((#,(string-append "exec\\.Command\\(\""
+                                      ((#,(string-append "\\<exec\\.Command\\(\""
                                                          (syntax->datum
                                                           #'source-text)
                                                          "\""))
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-docker-Make-macros-use-a-relative-path-as-argume.patch --]
[-- Type: text/x-patch, Size: 6139 bytes --]

From e6d6211902463da59ed4716c14334c88907c26c0 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 11 Apr 2019 22:57:33 -0400
Subject: [PATCH 4/7] gnu: docker: Make macros use a relative path as argument.

* gnu/packages/docker.scm (docker)[phases]: Move implementation detail inside
the SUBSTITUTE-LOOKPATH and SUBSTITUTE-COMMAND macros definition, so that the
relative path argument can be given as a relative path.
---
 gnu/packages/docker.scm | 56 ++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 6e598e4d18..0b602cee1d 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -381,7 +381,7 @@ built-in registry server of Docker.")
                                                          "\")"))
                                        (string-append "\""
                                                       (assoc-ref inputs package)
-                                                      relative-path
+                                                      "/" relative-path
                                                       "\", error(nil)")))))))
                             (substitute-Command
                              (lambda (x)
@@ -395,29 +395,29 @@ built-in registry server of Docker.")
                                                          "\""))
                                        (string-append "exec.Command(\""
                                                       (assoc-ref inputs package)
-                                                      relative-path
+                                                      "/" relative-path
                                                       "\""))))))))
-                 (substitute-LookPath "ps" "procps" "/bin/ps")
-                 (substitute-LookPath "mkfs.xfs" "xfsprogs" "/bin/mkfs.xfs")
-                 (substitute-LookPath "lvmdiskscan" "lvm2" "/sbin/lvmdiskscan")
-                 (substitute-LookPath "pvdisplay" "lvm2" "/sbin/pvdisplay")
-                 (substitute-LookPath "blkid" "util-linux" "/sbin/blkid")
-                 (substitute-LookPath "unpigz" "pigz" "/bin/unpigz")
-                 (substitute-LookPath "iptables" "iptables" "/sbin/iptables")
-                 (substitute-LookPath "iptables-legacy" "iptables" "/sbin/iptables")
-                 (substitute-LookPath "ip" "iproute2" "/sbin/ip")
-                 (substitute-Command "modprobe" "kmod" "/bin/modprobe")
-                 (substitute-Command "pvcreate" "lvm2" "/sbin/pvcreate")
-                 (substitute-Command "vgcreate" "lvm2" "/sbin/vgcreate")
-                 (substitute-Command "lvcreate" "lvm2" "/sbin/lvcreate")
-                 (substitute-Command "lvconvert" "lvm2" "/sbin/lvconvert")
-                 (substitute-Command "lvchange" "lvm2" "/sbin/lvchange")
-                 (substitute-Command "mkfs.xfs" "xfsprogs" "/sbin/mkfs.xfs")
-                 (substitute-Command "xfs_growfs" "xfsprogs" "/sbin/xfs_growfs")
-                 (substitute-Command "mkfs.ext4" "e2fsprogs" "/sbin/mkfs.ext4")
-                 (substitute-Command "tune2fs" "e2fsprogs" "/sbin/tune2fs")
-                 (substitute-Command "blkid" "util-linux" "/sbin/blkid")
-                 (substitute-Command "resize2fs" "e2fsprogs" "/sbin/resize2fs")
+                 (substitute-LookPath "ps" "procps" "bin/ps")
+                 (substitute-LookPath "mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
+                 (substitute-LookPath "lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
+                 (substitute-LookPath "pvdisplay" "lvm2" "sbin/pvdisplay")
+                 (substitute-LookPath "blkid" "util-linux" "sbin/blkid")
+                 (substitute-LookPath "unpigz" "pigz" "bin/unpigz")
+                 (substitute-LookPath "iptables" "iptables" "sbin/iptables")
+                 (substitute-LookPath "iptables-legacy" "iptables" "sbin/iptables")
+                 (substitute-LookPath "ip" "iproute2" "sbin/ip")
+                 (substitute-Command "modprobe" "kmod" "bin/modprobe")
+                 (substitute-Command "pvcreate" "lvm2" "sbin/pvcreate")
+                 (substitute-Command "vgcreate" "lvm2" "sbin/vgcreate")
+                 (substitute-Command "lvcreate" "lvm2" "sbin/lvcreate")
+                 (substitute-Command "lvconvert" "lvm2" "sbin/lvconvert")
+                 (substitute-Command "lvchange" "lvm2" "sbin/lvchange")
+                 (substitute-Command "mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
+                 (substitute-Command "xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
+                 (substitute-Command "mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
+                 (substitute-Command "tune2fs" "e2fsprogs" "sbin/tune2fs")
+                 (substitute-Command "blkid" "util-linux" "sbin/blkid")
+                 (substitute-Command "resize2fs" "e2fsprogs" "sbin/resize2fs")
                  ;; docker-mountfrom ??
                  ;; docker
                  ;; docker-untar ??
@@ -425,11 +425,11 @@ built-in registry server of Docker.")
                  ;; /usr/bin/uname
                  ;; grep
                  ;; apparmor_parser
-                 (substitute-Command "ps" "procps" "/bin/ps")
-                 (substitute-Command "losetup" "util-linux" "/sbin/losetup")
-                 (substitute-Command "uname" "coreutils" "/bin/uname")
-                 (substitute-Command "dbus-launch" "dbus" "/bin/dbus-launch")
-                 (substitute-Command "git" "git" "/bin/git"))
+                 (substitute-Command "ps" "procps" "bin/ps")
+                 (substitute-Command "losetup" "util-linux" "sbin/losetup")
+                 (substitute-Command "uname" "coreutils" "bin/uname")
+                 (substitute-Command "dbus-launch" "dbus" "bin/dbus-launch")
+                 (substitute-Command "git" "git" "bin/git"))
                ;; Make compilation fail when, in future versions, Docker
                ;; invokes other programs we don't know about and thus don't
                ;; substitute.
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-docker-Optimize-substitution-macros.patch --]
[-- Type: text/x-patch, Size: 8694 bytes --]

From aa63b48d0d4a5d48d745e9be8e7222e9f73f0af8 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 13 Apr 2019 22:00:45 -0400
Subject: [PATCH 5/7] gnu: docker: Optimize substitution macros.

This change halves the time needed to patch the paths.

* gnu/packages/docker.scm (docker)[phases]{patch-paths}: Allow passing
multiple SOURCE-TEXT, PACKAGE and RELATIVE-PATH tuples so that the rewrite
rules can be generated and processed by a single use of the SUBSTITUTE*
macro.  Rename SUBSTITUTE-LOOKPATH to SUBSTITUTE-LOOKPATH* and
substitute-Command to SUBSTITUTE-COMMAND* to denote the change.  Adapt the
uses of SUBSTITUTE-LOOKPATH* and SUBSTITUTE-COMMAND*.
---
 gnu/packages/docker.scm | 120 ++++++++++++++++++++--------------------
 1 file changed, 59 insertions(+), 61 deletions(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 0b602cee1d..912827b79b 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -369,67 +369,65 @@ built-in registry server of Docker.")
              (let ((source-files (filter (lambda (name)
                                            (not (string-contains name "test")))
                                          (find-files "." "\\.go$"))))
-               (let-syntax ((substitute-LookPath
-                             (lambda (x)
-                               (syntax-case x ()
-                                 ((substitute-LookPath source-text package
-                                                       relative-path)
-                                  #`(substitute* source-files
-                                      ((#,(string-append "\\<exec\\.LookPath\\(\""
-                                                         (syntax->datum
-                                                          #'source-text)
-                                                         "\")"))
-                                       (string-append "\""
-                                                      (assoc-ref inputs package)
-                                                      "/" relative-path
-                                                      "\", error(nil)")))))))
-                            (substitute-Command
-                             (lambda (x)
-                               (syntax-case x ()
-                                 ((substitute-LookPath source-text package
-                                                       relative-path)
-                                  #`(substitute* source-files
-                                      ((#,(string-append "\\<exec\\.Command\\(\""
-                                                         (syntax->datum
-                                                          #'source-text)
-                                                         "\""))
-                                       (string-append "exec.Command(\""
-                                                      (assoc-ref inputs package)
-                                                      "/" relative-path
-                                                      "\""))))))))
-                 (substitute-LookPath "ps" "procps" "bin/ps")
-                 (substitute-LookPath "mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
-                 (substitute-LookPath "lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
-                 (substitute-LookPath "pvdisplay" "lvm2" "sbin/pvdisplay")
-                 (substitute-LookPath "blkid" "util-linux" "sbin/blkid")
-                 (substitute-LookPath "unpigz" "pigz" "bin/unpigz")
-                 (substitute-LookPath "iptables" "iptables" "sbin/iptables")
-                 (substitute-LookPath "iptables-legacy" "iptables" "sbin/iptables")
-                 (substitute-LookPath "ip" "iproute2" "sbin/ip")
-                 (substitute-Command "modprobe" "kmod" "bin/modprobe")
-                 (substitute-Command "pvcreate" "lvm2" "sbin/pvcreate")
-                 (substitute-Command "vgcreate" "lvm2" "sbin/vgcreate")
-                 (substitute-Command "lvcreate" "lvm2" "sbin/lvcreate")
-                 (substitute-Command "lvconvert" "lvm2" "sbin/lvconvert")
-                 (substitute-Command "lvchange" "lvm2" "sbin/lvchange")
-                 (substitute-Command "mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
-                 (substitute-Command "xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
-                 (substitute-Command "mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
-                 (substitute-Command "tune2fs" "e2fsprogs" "sbin/tune2fs")
-                 (substitute-Command "blkid" "util-linux" "sbin/blkid")
-                 (substitute-Command "resize2fs" "e2fsprogs" "sbin/resize2fs")
-                 ;; docker-mountfrom ??
-                 ;; docker
-                 ;; docker-untar ??
-                 ;; docker-applyLayer ??
-                 ;; /usr/bin/uname
-                 ;; grep
-                 ;; apparmor_parser
-                 (substitute-Command "ps" "procps" "bin/ps")
-                 (substitute-Command "losetup" "util-linux" "sbin/losetup")
-                 (substitute-Command "uname" "coreutils" "bin/uname")
-                 (substitute-Command "dbus-launch" "dbus" "bin/dbus-launch")
-                 (substitute-Command "git" "git" "bin/git"))
+               (let-syntax ((substitute-LookPath*
+                             (syntax-rules ()
+                               ((_ (source-text package relative-path) ...)
+                                (substitute* source-files
+                                  (((string-append "\\<exec\\.LookPath\\(\""
+                                                   source-text
+                                                   "\")"))
+                                   (string-append "\""
+                                                  (assoc-ref inputs package)
+                                                  "/" relative-path
+                                                  "\", error(nil)")) ...))))
+                            (substitute-Command*
+                             (syntax-rules ()
+                               ((_ (source-text package relative-path) ...)
+                                (substitute* source-files
+                                  (((string-append "\\<exec\\.Command\\(\""
+                                                   source-text
+                                                   "\""))
+                                   (string-append "exec.Command(\""
+                                                  (assoc-ref inputs package)
+                                                  "/" relative-path
+                                                  "\"")) ...)))))
+                 (substitute-LookPath*
+                  ("ps" "procps" "bin/ps")
+                  ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
+                  ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
+                  ("pvdisplay" "lvm2" "sbin/pvdisplay")
+                  ("blkid" "util-linux" "sbin/blkid")
+                  ("unpigz" "pigz" "bin/unpigz")
+                  ("iptables" "iptables" "sbin/iptables")
+                  ("iptables-legacy" "iptables" "sbin/iptables")
+                  ("ip" "iproute2" "sbin/ip"))
+
+                 (substitute-Command*
+                  ("modprobe" "kmod" "bin/modprobe")
+                  ("pvcreate" "lvm2" "sbin/pvcreate")
+                  ("vgcreate" "lvm2" "sbin/vgcreate")
+                  ("lvcreate" "lvm2" "sbin/lvcreate")
+                  ("lvconvert" "lvm2" "sbin/lvconvert")
+                  ("lvchange" "lvm2" "sbin/lvchange")
+                  ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs")
+                  ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs")
+                  ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4")
+                  ("tune2fs" "e2fsprogs" "sbin/tune2fs")
+                  ("blkid" "util-linux" "sbin/blkid")
+                  ("resize2fs" "e2fsprogs" "sbin/resize2fs")
+                  ("ps" "procps" "bin/ps")
+                  ("losetup" "util-linux" "sbin/losetup")
+                  ("uname" "coreutils" "bin/uname")
+                  ("dbus-launch" "dbus" "bin/dbus-launch")
+                  ("git" "git" "bin/git")))
+               ;; docker-mountfrom ??
+               ;; docker
+               ;; docker-untar ??
+               ;; docker-applyLayer ??
+               ;; /usr/bin/uname
+               ;; grep
+               ;; apparmor_parser
+
                ;; Make compilation fail when, in future versions, Docker
                ;; invokes other programs we don't know about and thus don't
                ;; substitute.
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-docker-Patch-the-reference-to-the-docker-proxy.patch --]
[-- Type: text/x-patch, Size: 1805 bytes --]

From a2d9cbcc7ad2c86767ff77e026956d07025c5e27 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 13 Apr 2019 22:48:09 -0400
Subject: [PATCH 6/7] gnu: docker: Patch the reference to the docker proxy.

* gnu/packages/docker.scm (docker)[inputs]: Add docker-libnetwork-cmd-proxy.
* gnu/packages/docker.scm (docker)[phases]{patch-paths}: Patch proxy.go to
refer to the docker-proxy binary by its absolute path.
---
 gnu/packages/docker.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 912827b79b..9dde4c6cb0 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -366,6 +366,11 @@ built-in registry server of Docker.")
                (("var defaultCommandCandidates = .*")
                 (string-append "var defaultCommandCandidates = []string{\""
                                (assoc-ref inputs "runc") "/sbin/runc\"}")))
+             (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
+               (("var userlandProxyCommandName = .*")
+                (string-append "var userlandProxyCommandName = \""
+                               (assoc-ref inputs "docker-proxy")
+                               "/bin/proxy\"\n")))
              (let ((source-files (filter (lambda (name)
                                            (not (string-contains name "test")))
                                          (find-files "." "\\.go$"))))
@@ -513,6 +518,7 @@ built-in registry server of Docker.")
        ("containerd" ,containerd)       ; for containerd-shim
        ("coreutils" ,coreutils)
        ("dbus" ,dbus)
+       ("docker-proxy" ,docker-libnetwork-cmd-proxy)
        ("e2fsprogs" ,e2fsprogs)
        ("git" ,git)
        ("iproute2" ,iproute)
-- 
2.20.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-gnu-docker-Refer-to-xz-by-its-absolute-path.patch --]
[-- Type: text/x-patch, Size: 1554 bytes --]

From 646c93fa6a2a75b877153da6c006fd3a17c8dd32 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 13 Apr 2019 22:58:55 -0400
Subject: [PATCH 7/7] gnu: docker: Refer to xz by its absolute path.

* gnu/packages/docker.scm (docker)[inputs]: Add xz.
[phases]{patch-paths}: Patch the reference to xz.
---
 gnu/packages/docker.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 9dde4c6cb0..78bff8a323 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -371,6 +371,9 @@ built-in registry server of Docker.")
                 (string-append "var userlandProxyCommandName = \""
                                (assoc-ref inputs "docker-proxy")
                                "/bin/proxy\"\n")))
+             (substitute* "pkg/archive/archive.go"
+               (("string\\{\"xz")
+                (string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz")))
              (let ((source-files (filter (lambda (name)
                                            (not (string-contains name "test")))
                                          (find-files "." "\\.go$"))))
@@ -530,7 +533,8 @@ built-in registry server of Docker.")
        ("runc" ,runc)
        ("util-linux" ,util-linux)
        ("lvm2" ,lvm2)
-       ("xfsprogs" ,xfsprogs)))
+       ("xfsprogs" ,xfsprogs)
+       ("xz" ,xz)))
     (native-inputs
      `(("eudev" ,eudev)      ; TODO: Should be propagated by lvm2 (.pc -> .pc)
        ("go" ,go)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-06 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-15  0:12 [bug#35282] [PATCH] gnu: docker: Patch paths of xz and docker-proxy Maxim Cournoyer
2019-04-15  5:56 ` Danny Milosavljevic
2019-04-15 19:05   ` Maxim Cournoyer
2019-04-15 20:19   ` [bug#35282] [PATCHv2] " Maxim Cournoyer
2019-04-15 21:44     ` Danny Milosavljevic
2019-04-16 14:54       ` Maxim Cournoyer
2019-05-06  1:43         ` T460s laptop
2019-05-06 14:48           ` bug#35282: " Ricardo Wurmus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.