Archived
1
0
Fork 0

gnu: docker: Switch to gexp and new input style.

* gnu/packages/docker.scm (docker)[arguments]: Rewrite as gexps.  Switch
to using search-input-file.
[inputs]: Use new style inputs.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Pierre Langlois 2022-05-10 00:35:19 +01:00 committed by Maxim Cournoyer
parent 185ae9b410
commit 168a4955a3
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -324,136 +324,135 @@ built-in registry server of Docker.")
(base32 "0hn7fg717rggwk6dbicrwa7aglqp7dp0jp5rvn6p9gfcnrp2w97d")))) (base32 "0hn7fg717rggwk6dbicrwa7aglqp7dp0jp5rvn6p9gfcnrp2w97d"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:modules (list
((guix build gnu-build-system) #:modules
'((guix build gnu-build-system)
((guix build go-build-system) #:prefix go:) ((guix build go-build-system) #:prefix go:)
(guix build union) (guix build union)
(guix build utils)) (guix build utils))
#:imported-modules #:imported-modules
(,@%gnu-build-system-modules `(,@%gnu-build-system-modules
(guix build union) (guix build union)
(guix build go-build-system)) (guix build go-build-system))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'patch-paths (add-after 'unpack 'patch-paths
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(substitute* "builder/builder-next/executor_unix.go" (substitute* "builder/builder-next/executor_unix.go"
(("CommandCandidates:.*runc.*") (("CommandCandidates:.*runc.*")
(string-append "CommandCandidates: []string{\"" (string-append "CommandCandidates: []string{\""
(assoc-ref inputs "runc") (search-input-file inputs "/sbin/runc")
"/sbin/runc\"},\n"))) "\"},\n")))
(substitute* "vendor/github.com/containerd/go-runc/runc.go" (substitute* "vendor/github.com/containerd/go-runc/runc.go"
(("DefaultCommand = .*") (("DefaultCommand = .*")
(string-append "DefaultCommand = \"" (string-append "DefaultCommand = \""
(assoc-ref inputs "runc") (search-input-file inputs "/sbin/runc")
"/sbin/runc\"\n"))) "\"\n")))
(substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go" (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
(("defaultRuntime[ \t]*=.*") (("defaultRuntime[ \t]*=.*")
(string-append "defaultRuntime = \"" (string-append "defaultRuntime = \""
(assoc-ref inputs "runc") (search-input-file inputs "/sbin/runc")
"/sbin/runc\"\n")) "\"\n"))
(("defaultShim[ \t]*=.*") (("defaultShim[ \t]*=.*")
(string-append "defaultShim = \"" (string-append "defaultShim = \""
(assoc-ref inputs "containerd") (search-input-file inputs "/bin/containerd-shim")
"/bin/containerd-shim\"\n"))) "\"\n")))
(substitute* "daemon/daemon_unix.go" (substitute* "daemon/daemon_unix.go"
(("DefaultShimBinary = .*") (("DefaultShimBinary = .*")
(string-append "DefaultShimBinary = \"" (string-append "DefaultShimBinary = \""
(assoc-ref inputs "containerd") (search-input-file inputs "/bin/containerd-shim")
"/bin/containerd-shim\"\n")) "\"\n"))
(("DefaultRuntimeBinary = .*") (("DefaultRuntimeBinary = .*")
(string-append "DefaultRuntimeBinary = \"" (string-append "DefaultRuntimeBinary = \""
(assoc-ref inputs "runc") (search-input-file inputs "/sbin/runc")
"/sbin/runc\"\n"))) "\"\n")))
(substitute* "daemon/runtime_unix.go" (substitute* "daemon/runtime_unix.go"
(("defaultRuntimeName = .*") (("defaultRuntimeName = .*")
(string-append "defaultRuntimeName = \"" (string-append "defaultRuntimeName = \""
(assoc-ref inputs "runc") (search-input-file inputs "/sbin/runc")
"/sbin/runc\"\n"))) "\"\n")))
(substitute* "daemon/config/config.go" (substitute* "daemon/config/config.go"
(("StockRuntimeName = .*") (("StockRuntimeName = .*")
(string-append "StockRuntimeName = \"" (string-append "StockRuntimeName = \""
(assoc-ref inputs "runc") (search-input-file inputs "/sbin/runc")
"/sbin/runc\"\n")) "\"\n"))
(("DefaultInitBinary = .*") (("DefaultInitBinary = .*")
(string-append "DefaultInitBinary = \"" (string-append "DefaultInitBinary = \""
(assoc-ref inputs "tini") (search-input-file inputs "/bin/tini-static")
"/bin/tini-static\"\n"))) "\"\n")))
(substitute* "daemon/config/config_common_unix_test.go" (substitute* "daemon/config/config_common_unix_test.go"
(("expectedInitPath: \"docker-init\"") (("expectedInitPath: \"docker-init\"")
(string-append "expectedInitPath: \"" (string-append "expectedInitPath: \""
(assoc-ref inputs "tini") (search-input-file inputs "/bin/tini-static")
"/bin/tini-static\""))) "\"")))
(substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go" (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
(("var defaultCommandCandidates = .*") (("var defaultCommandCandidates = .*")
(string-append "var defaultCommandCandidates = []string{\"" (string-append "var defaultCommandCandidates = []string{\""
(assoc-ref inputs "runc") "/sbin/runc\"}"))) (search-input-file inputs "/sbin/runc") "\"}")))
(substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go" (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go"
(("var userlandProxyCommandName = .*") (("var userlandProxyCommandName = .*")
(string-append "var userlandProxyCommandName = \"" (string-append "var userlandProxyCommandName = \""
(assoc-ref inputs "docker-proxy") (search-input-file inputs "/bin/proxy")
"/bin/proxy\"\n"))) "\"\n")))
(substitute* "pkg/archive/archive.go" (substitute* "pkg/archive/archive.go"
(("string\\{\"xz") (("string\\{\"xz")
(string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz"))) (string-append "string{\"" (search-input-file inputs "/bin/xz"))))
(let ((source-files (filter (lambda (name) (let ((source-files (filter (lambda (name)
(not (string-contains name "test"))) (not (string-contains name "test")))
(find-files "." "\\.go$")))) (find-files "." "\\.go$"))))
(let-syntax ((substitute-LookPath* (let-syntax ((substitute-LookPath*
(syntax-rules () (syntax-rules ()
((_ (source-text package relative-path) ...) ((_ (source-text path) ...)
(substitute* source-files (substitute* source-files
(((string-append "\\<exec\\.LookPath\\(\"" (((string-append "\\<exec\\.LookPath\\(\""
source-text source-text
"\")")) "\")"))
(string-append "\"" (string-append "\""
(assoc-ref inputs package) (search-input-file inputs path)
"/" relative-path
"\", error(nil)")) ...)))) "\", error(nil)")) ...))))
(substitute-Command* (substitute-Command*
(syntax-rules () (syntax-rules ()
((_ (source-text package relative-path) ...) ((_ (source-text path) ...)
(substitute* source-files (substitute* source-files
(((string-append "\\<(re)?exec\\.Command\\(\"" (((string-append "\\<(re)?exec\\.Command\\(\""
source-text source-text
"\"") _ re?) "\"") _ re?)
(string-append (if re? re? "") (string-append (if re? re? "")
"exec.Command(\"" "exec.Command(\""
(assoc-ref inputs package) (search-input-file inputs path)
"/" relative-path
"\"")) ...))))) "\"")) ...)))))
(substitute-LookPath* (substitute-LookPath*
("containerd" "containerd" "bin/containerd") ("containerd" "/bin/containerd")
("ps" "procps" "bin/ps") ("ps" "/bin/ps")
("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs") ("mkfs.xfs" "/sbin/mkfs.xfs")
("lvmdiskscan" "lvm2" "sbin/lvmdiskscan") ("lvmdiskscan" "/sbin/lvmdiskscan")
("pvdisplay" "lvm2" "sbin/pvdisplay") ("pvdisplay" "/sbin/pvdisplay")
("blkid" "util-linux" "sbin/blkid") ("blkid" "/sbin/blkid")
("unpigz" "pigz" "bin/unpigz") ("unpigz" "/bin/unpigz")
("iptables" "iptables" "sbin/iptables") ("iptables" "/sbin/iptables")
("ip6tables" "iptables" "sbin/ip6tables") ("ip6tables" "/sbin/ip6tables")
("iptables-legacy" "iptables" "sbin/iptables") ("iptables-legacy" "/sbin/iptables")
("ip" "iproute2" "sbin/ip")) ("ip" "/sbin/ip"))
(substitute-Command* (substitute-Command*
("modprobe" "kmod" "bin/modprobe") ("modprobe" "/bin/modprobe")
("pvcreate" "lvm2" "sbin/pvcreate") ("pvcreate" "/sbin/pvcreate")
("vgcreate" "lvm2" "sbin/vgcreate") ("vgcreate" "/sbin/vgcreate")
("lvcreate" "lvm2" "sbin/lvcreate") ("lvcreate" "/sbin/lvcreate")
("lvconvert" "lvm2" "sbin/lvconvert") ("lvconvert" "/sbin/lvconvert")
("lvchange" "lvm2" "sbin/lvchange") ("lvchange" "/sbin/lvchange")
("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs") ("mkfs.xfs" "/sbin/mkfs.xfs")
("xfs_growfs" "xfsprogs" "sbin/xfs_growfs") ("xfs_growfs" "/sbin/xfs_growfs")
("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4") ("mkfs.ext4" "/sbin/mkfs.ext4")
("tune2fs" "e2fsprogs" "sbin/tune2fs") ("tune2fs" "/sbin/tune2fs")
("blkid" "util-linux" "sbin/blkid") ("blkid" "/sbin/blkid")
("resize2fs" "e2fsprogs" "sbin/resize2fs") ("resize2fs" "/sbin/resize2fs")
("ps" "procps" "bin/ps") ("ps" "/bin/ps")
("losetup" "util-linux" "sbin/losetup") ("losetup" "/sbin/losetup")
("uname" "coreutils" "bin/uname") ("uname" "/bin/uname")
("dbus-launch" "dbus" "bin/dbus-launch") ("dbus-launch" "/bin/dbus-launch")
("git" "git" "bin/git"))) ("git" "/bin/git")))
;; docker-mountfrom ?? ;; docker-mountfrom ??
;; docker ;; docker
;; docker-untar ?? ;; docker-untar ??
@ -516,8 +515,8 @@ built-in registry server of Docker.")
(replace 'configure (replace 'configure
(lambda _ (lambda _
(setenv "DOCKER_BUILDTAGS" "seccomp") (setenv "DOCKER_BUILDTAGS" "seccomp")
(setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version)) (setenv "DOCKER_GITCOMMIT" (string-append "v" #$%docker-version))
(setenv "VERSION" (string-append ,%docker-version "-ce")) (setenv "VERSION" (string-append #$%docker-version "-ce"))
;; Automatically use bundled dependencies. ;; Automatically use bundled dependencies.
;; TODO: Unbundle - see file "vendor.conf". ;; TODO: Unbundle - see file "vendor.conf".
(setenv "AUTO_GOPATH" "1") (setenv "AUTO_GOPATH" "1")
@ -559,25 +558,25 @@ built-in registry server of Docker.")
(add-after 'install 'remove-go-references (add-after 'install 'remove-go-references
(assoc-ref go:%standard-phases 'remove-go-references))))) (assoc-ref go:%standard-phases 'remove-go-references)))))
(inputs (inputs
`(("btrfs-progs" ,btrfs-progs) (list btrfs-progs
("containerd" ,containerd) ; for containerd-shim containerd ; for containerd-shim
("coreutils" ,coreutils) coreutils
("dbus" ,dbus) dbus
("docker-proxy" ,docker-libnetwork-cmd-proxy) docker-libnetwork-cmd-proxy
("e2fsprogs" ,e2fsprogs) e2fsprogs
("git" ,git) git
("iproute2" ,iproute) iproute
("iptables" ,iptables) iptables
("kmod" ,kmod) kmod
("libseccomp" ,libseccomp) libseccomp
("pigz" ,pigz) pigz
("procps" ,procps) procps
("runc" ,runc) runc
("util-linux" ,util-linux) util-linux
("lvm2" ,lvm2) lvm2
("tini" ,tini) tini
("xfsprogs" ,xfsprogs) xfsprogs
("xz" ,xz))) xz))
(native-inputs (native-inputs
(list eudev ; TODO: Should be propagated by lvm2 (.pc -> .pc) (list eudev ; TODO: Should be propagated by lvm2 (.pc -> .pc)
go gotestsum pkg-config)) go gotestsum pkg-config))