Subject: [bug#38885] [WIP 4/4] gnu: docker: Update to 19.03.5.

From: Danny Milosavljevic <[email-masked]>
Date: Fri, 3 Jan 2020 02:34:33 +0100

* gnu/packages/docker.scm (docker-cli): Update to 19.03.5.
(docker)[source]: Remove patches.
[arguments]<#:phases>[patch-paths]: Modify.
[native-inputs]: Add gotestsum.
* gnu/packages/patches/docker-adjust-tests-for-changes-in-go.patch: Delete
file.
* gnu/packages/patches/docker-engine-test-noinstall.patch: Delete file.
* gnu/packages/patches/docker-use-fewer-modprobes.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): Remove them.
---
 gnu/local.mk                                  |   3 -
 gnu/packages/docker.scm                       |  13 +-
 ...ocker-adjust-tests-for-changes-in-go.patch |  67 ---------
 .../docker-engine-test-noinstall.patch        |  23 ---
 .../patches/docker-use-fewer-modprobes.patch  | 137 ------------------
 5 files changed, 6 insertions(+), 237 deletions(-)
 delete mode 100644 gnu/packages/patches/docker-adjust-tests-for-changes-in-go.patch
 delete mode 100644 gnu/packages/patches/docker-engine-test-noinstall.patch
 delete mode 100644 gnu/packages/patches/docker-use-fewer-modprobes.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8a21223de5..0edd17e9b1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -804,10 +804,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/docbook-xsl-nonrecursive-string-subst.patch	\
   %D%/packages/patches/doc++-include-directives.patch		\
   %D%/packages/patches/doc++-segfault-fix.patch			\
-  %D%/packages/patches/docker-adjust-tests-for-changes-in-go.patch	\
-  %D%/packages/patches/docker-engine-test-noinstall.patch	\
   %D%/packages/patches/docker-fix-tests.patch			\
-  %D%/packages/patches/docker-use-fewer-modprobes.patch		\
   %D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch	\
   %D%/packages/patches/doxygen-test.patch			\
   %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch	\
diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 948cc30cf6..a15c5d6004 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -46,7 +46,7 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages virtualization))
 
-(define %docker-version "18.09.5")
+(define %docker-version "19.03.5")
 
 (define-public python-docker-py
   (package
@@ -313,12 +313,9 @@ built-in registry server of Docker.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0cirpd9l2qazp2jyanwzvrkx2m98nksjdvn43ff38p89w6133ipb"))
+        (base32 "1dlknwn0fh82nbzdzxdk6pfhqwph9vcw3vs3111wfr19y5hwncq9"))
        (patches
-        (search-patches "docker-engine-test-noinstall.patch"
-                        "docker-fix-tests.patch"
-                        "docker-use-fewer-modprobes.patch"
-                        "docker-adjust-tests-for-changes-in-go.patch"))))
+        (search-patches "docker-fix-tests.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:modules
@@ -419,6 +416,7 @@ built-in registry server of Docker.")
                                                   "/" relative-path
                                                   "\"")) ...)))))
                  (substitute-LookPath*
+                  ("containerd" "containerd" "bin/containerd")
                   ("ps" "procps" "bin/ps")
                   ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs")
                   ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan")
@@ -558,6 +556,7 @@ built-in registry server of Docker.")
     (native-inputs
      `(("eudev" ,eudev)      ; TODO: Should be propagated by lvm2 (.pc -> .pc)
        ("go" ,go)
+       ("gotestsum" ,gotestsum)
        ("pkg-config" ,pkg-config)))
     (synopsis "Docker container component library, and daemon")
     (description "This package provides a framework to assemble specialized
@@ -579,7 +578,7 @@ provisioning etc.")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
-       (base32 "0mxxjzkwdny8p2dmyjich7x1gn7hdlfppzjy2skk2k5bwv7nxpmi"))))
+       (base32 "07ldz46y74b3la4ah65v5bzbfx09yy6kncvxrr0zfx0s1214ar3m"))))
     (build-system go-build-system)
     (arguments
      `(#:import-path "github.com/docker/cli"
diff --git a/gnu/packages/patches/docker-adjust-tests-for-changes-in-go.patch b/gnu/packages/patches/docker-adjust-tests-for-changes-in-go.patch
deleted file mode 100644
index 82d92cd4de..0000000000
--- a/gnu/packages/patches/docker-adjust-tests-for-changes-in-go.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 4983ef7c1693ad6dfbe4e3809b12541241d7ff56 Mon Sep 17 00:00:00 2001
-From: Sebastiaan van Stijn <[email-masked]>
-Date: Wed, 14 Aug 2019 02:51:08 +0200
-Subject: [PATCH] Adjust tests for changes in Go 1.12.8 / 1.11.13
-
-```
-00:38:11 === Failed
-00:38:11 === FAIL: opts TestParseDockerDaemonHost (0.00s)
-00:38:11     hosts_test.go:87: tcp tcp:a.b.c.d address expected error "Invalid bind address format: tcp:a.b.c.d" return, got "parse tcp://tcp:a.b.c.d: invalid port \":a.b.c.d\" after host" and addr
-00:38:11     hosts_test.go:87: tcp tcp:a.b.c.d/path address expected error "Invalid bind address format: tcp:a.b.c.d/path" return, got "parse tcp://tcp:a.b.c.d/path: invalid port \":a.b.c.d\" after host" and addr
-00:38:11
-00:38:11 === FAIL: opts TestParseTCP (0.00s)
-00:38:11     hosts_test.go:129: tcp tcp:a.b.c.d address expected error Invalid bind address format: tcp:a.b.c.d return, got parse tcp://tcp:a.b.c.d: invalid port ":a.b.c.d" after host and addr
-00:38:11     hosts_test.go:129: tcp tcp:a.b.c.d/path address expected error Invalid bind address format: tcp:a.b.c.d/path return, got parse tcp://tcp:a.b.c.d/path: invalid port ":a.b.c.d" after host and addr
-```
-
-Signed-off-by: Sebastiaan van Stijn <[email-masked]>
-Upstream-commit: 683766613a8c1dca8f95b19ddb7e083bb3aef266
-Component: engine
----
- opts/hosts_test.go | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/opts/hosts_test.go b/opts/hosts_test.go
-index 8c54ec0f4b..7a0a943adf 100644
---- a/opts/hosts_test.go
-+++ b/opts/hosts_test.go
-@@ -53,8 +53,8 @@ func TestParseHost(t *testing.T) {
- func TestParseDockerDaemonHost(t *testing.T) {
- 	invalids := map[string]string{
- 
--		"tcp:a.b.c.d":                   "Invalid bind address format: tcp:a.b.c.d",
--		"tcp:a.b.c.d/path":              "Invalid bind address format: tcp:a.b.c.d/path",
-+		"tcp:a.b.c.d":                   "",
-+		"tcp:a.b.c.d/path":              "",
- 		"udp://127.0.0.1":               "Invalid bind address format: udp://127.0.0.1",
- 		"udp://127.0.0.1:2375":          "Invalid bind address format: udp://127.0.0.1:2375",
- 		"tcp://unix:///run/docker.sock": "Invalid proto, expected tcp: unix:///run/docker.sock",
-@@ -83,7 +83,7 @@ func TestParseDockerDaemonHost(t *testing.T) {
- 		"localhost:5555/path":         "tcp://localhost:5555/path",
- 	}
- 	for invalidAddr, expectedError := range invalids {
--		if addr, err := parseDaemonHost(invalidAddr); err == nil || err.Error() != expectedError {
-+		if addr, err := parseDaemonHost(invalidAddr); err == nil || expectedError != "" && err.Error() != expectedError {
- 			t.Errorf("tcp %v address expected error %q return, got %q and addr %v", invalidAddr, expectedError, err, addr)
- 		}
- 	}
-@@ -99,8 +99,8 @@ func TestParseTCP(t *testing.T) {
- 		defaultHTTPHost = "tcp://127.0.0.1:2376"
- 	)
- 	invalids := map[string]string{
--		"tcp:a.b.c.d":          "Invalid bind address format: tcp:a.b.c.d",
--		"tcp:a.b.c.d/path":     "Invalid bind address format: tcp:a.b.c.d/path",
-+		"tcp:a.b.c.d":          "",
-+		"tcp:a.b.c.d/path":     "",
- 		"udp://127.0.0.1":      "Invalid proto, expected tcp: udp://127.0.0.1",
- 		"udp://127.0.0.1:2375": "Invalid proto, expected tcp: udp://127.0.0.1:2375",
- 	}
-@@ -125,7 +125,7 @@ func TestParseTCP(t *testing.T) {
- 		"localhost:5555/path":         "tcp://localhost:5555/path",
- 	}
- 	for invalidAddr, expectedError := range invalids {
--		if addr, err := ParseTCPAddr(invalidAddr, defaultHTTPHost); err == nil || err.Error() != expectedError {
-+		if addr, err := ParseTCPAddr(invalidAddr, defaultHTTPHost); err == nil || expectedError != "" && err.Error() != expectedError {
- 			t.Errorf("tcp %v address expected error %v return, got %s and addr %v", invalidAddr, expectedError, err, addr)
- 		}
- 	}
diff --git a/gnu/packages/patches/docker-engine-test-noinstall.patch b/gnu/packages/patches/docker-engine-test-noinstall.patch
deleted file mode 100644
index 85d56a3465..0000000000
--- a/gnu/packages/patches/docker-engine-test-noinstall.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Last-Update: 2018-06-18
-Forwarded: not-needed
-Author: Dmitry Smirnov <[email-masked]>
-Description: prevents test-time installation that causes FTBFS.
-~~~~
- go test net: open /usr/lib/go-1.10/pkg/linux_amd64/net.a: permission denied
-~~~~
-
---- a/hack/test/unit
-+++ b/hack/test/unit
-@@ -18,12 +18,8 @@
- 
- exclude_paths="/vendor/|/integration"
- pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)")
- 
--# install test dependencies once before running tests for each package. This
--# significantly reduces the runtime.
--go test -i "${BUILDFLAGS[@]}" $pkg_list
--
- for pkg in $pkg_list; do
-     go test "${BUILDFLAGS[@]}" \
-         -cover \
-         -coverprofile=profile.out \
diff --git a/gnu/packages/patches/docker-use-fewer-modprobes.patch b/gnu/packages/patches/docker-use-fewer-modprobes.patch
deleted file mode 100644
index 4e4a45b6ce..0000000000
--- a/gnu/packages/patches/docker-use-fewer-modprobes.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-This patch makes docker find out whether a filesystem type is supported
-by trying to mount a filesystem of that type rather than invoking "modprobe".
-
-See <https://github.com/moby/moby/pull/38930>.
-
---- docker-18.09.0-checkout/daemon/graphdriver/overlay/overlay.go.orig	1970-01-01 01:00:00.000000000 +0100
-+++ docker-18.09.0-checkout/daemon/graphdriver/overlay/overlay.go	2019-03-19 09:16:03.487087490 +0100
-@@ -8,7 +8,6 @@
- 	"io"
- 	"io/ioutil"
- 	"os"
--	"os/exec"
- 	"path"
- 	"path/filepath"
- 	"strconv"
-@@ -201,9 +200,16 @@
- }
- 
- func supportsOverlay() error {
--	// We can try to modprobe overlay first before looking at
--	// proc/filesystems for when overlay is supported
--	exec.Command("modprobe", "overlay").Run()
-+	// Access overlay filesystem so that Linux loads it (if possible).
-+	mountTarget, err := ioutil.TempDir("", "supportsOverlay")
-+	if err != nil {
-+		logrus.WithField("storage-driver", "overlay2").Error("Could not create temporary directory, so assuming that 'overlay' is not supported.")
-+		return graphdriver.ErrNotSupported
-+	} else {
-+		/* The mounting will fail--after the module has been loaded.*/
-+		defer os.RemoveAll(mountTarget)
-+		unix.Mount("overlay", mountTarget, "overlay", 0, "")
-+	}
- 
- 	f, err := os.Open("/proc/filesystems")
- 	if err != nil {
---- docker-18.09.0-checkout/daemon/graphdriver/overlay2/overlay.go.orig	2019-03-18 23:42:23.728525231 +0100
-+++ docker-18.09.0-checkout/daemon/graphdriver/overlay2/overlay.go	2019-03-19 08:54:31.411906113 +0100
-@@ -10,7 +10,6 @@
- 	"io"
- 	"io/ioutil"
- 	"os"
--	"os/exec"
- 	"path"
- 	"path/filepath"
- 	"strconv"
-@@ -261,9 +260,16 @@
- }
- 
- func supportsOverlay() error {
--	// We can try to modprobe overlay first before looking at
--	// proc/filesystems for when overlay is supported
--	exec.Command("modprobe", "overlay").Run()
-+	// Access overlay filesystem so that Linux loads it (if possible).
-+	mountTarget, err := ioutil.TempDir("", "supportsOverlay2")
-+	if err != nil {
-+		logrus.WithField("storage-driver", "overlay2").Error("Could not create temporary directory, so assuming that 'overlay' is not supported.")
-+		return graphdriver.ErrNotSupported
-+	} else {
-+		/* The mounting will fail--after the module has been loaded.*/
-+		defer os.RemoveAll(mountTarget)
-+		unix.Mount("overlay", mountTarget, "overlay", 0, "")
-+	}
- 
- 	f, err := os.Open("/proc/filesystems")
- 	if err != nil {
---- docker-18.09.0-checkout/daemon/graphdriver/devmapper/deviceset.go.orig	2019-03-19 09:19:16.592844887 +0100
-+++ docker-18.09.0-checkout/daemon/graphdriver/devmapper/deviceset.go	2019-03-19 09:21:18.019361761 +0100
-@@ -540,8 +539,14 @@
- 		return err // error text is descriptive enough
- 	}
- 
--	// Check if kernel supports xfs filesystem or not.
--	exec.Command("modprobe", "xfs").Run()
-+	mountTarget, err := ioutil.TempDir("", "supportsXFS")
-+	if err != nil {
-+		return errors.Wrapf(err, "error checking for xfs support")
-+	} else {
-+		/* The mounting will fail--after the module has been loaded.*/
-+		defer os.RemoveAll(mountTarget)
-+		unix.Mount("none", mountTarget, "xfs", 0, "")
-+	}
- 
- 	f, err := os.Open("/proc/filesystems")
- 	if err != nil {
---- docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/iptables/iptables.go.orig	2019-03-19 09:47:19.430111170 +0100
-+++ docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/iptables/iptables.go	2019-03-19 10:38:01.445136177 +0100
-@@ -72,11 +71,12 @@
- }
- 
- func probe() {
--	if out, err := exec.Command("modprobe", "-va", "nf_nat").CombinedOutput(); err != nil {
--		logrus.Warnf("Running modprobe nf_nat failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
-+	path, err := exec.LookPath("iptables")
-+	if err != nil {
-+		return
- 	}
--	if out, err := exec.Command("modprobe", "-va", "xt_conntrack").CombinedOutput(); err != nil {
--		logrus.Warnf("Running modprobe xt_conntrack failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
-+	if out, err := exec.Command(path, "--wait", "-t", "nat", "-L", "-n").CombinedOutput(); err != nil {
-+		logrus.Warnf("Running iptables --wait -t nat -L -n failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
- 	}
- }
- 
---- docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/ns/init_linux.go.orig	2019-03-19 11:23:20.738316699 +0100
-+++ docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/ns/init_linux.go	2019-03-19 11:27:57.149753073 +0100
-@@ -76,12 +76,8 @@ func NlHandle() *netlink.Handle {
- func getSupportedNlFamilies() []int {
- 	fams := []int{syscall.NETLINK_ROUTE}
- 	// NETLINK_XFRM test
--	if err := loadXfrmModules(); err != nil {
--		if checkXfrmSocket() != nil {
--			logrus.Warnf("Could not load necessary modules for IPSEC rules: %v", err)
--		} else {
--			fams = append(fams, syscall.NETLINK_XFRM)
--		}
-+	if err := checkXfrmSocket(); err != nil {
-+		logrus.Warnf("Could not load necessary modules for IPSEC rules: %v", err)
- 	} else {
- 		fams = append(fams, syscall.NETLINK_XFRM)
- 	}
-@@ -99,16 +95,6 @@ func getSupportedNlFamilies() []int {
- 	return fams
- }
- 
--func loadXfrmModules() error {
--	if out, err := exec.Command("modprobe", "-va", "xfrm_user").CombinedOutput(); err != nil {
--		return fmt.Errorf("Running modprobe xfrm_user failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
--	}
--	if out, err := exec.Command("modprobe", "-va", "xfrm_algo").CombinedOutput(); err != nil {
--		return fmt.Errorf("Running modprobe xfrm_algo failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
--	}
--	return nil
--}
--
- // API check on required xfrm modules (xfrm_user, xfrm_algo)
- func checkXfrmSocket() error {
- 	fd, err := syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_RAW, syscall.NETLINK_XFRM)