gnu: containerd: Switch to gexp arguments.

* gnu/packages/docker.scm (containerd)[arguments]: Rewrite as gexps.
Pass all flags via make-flags variable.  Switch to using
search-input-file.

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

View file

@ -29,6 +29,7 @@
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix build-system cmake) #:use-module (guix build-system cmake)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
@ -186,53 +187,55 @@ Python without keeping their credentials in a Docker configuration file.")
(base32 "1vsl747i3wyy68j4lp4nprwxadbyga8qxlrk892afcd2990zp5mr")))) (base32 "1vsl747i3wyy68j4lp4nprwxadbyga8qxlrk892afcd2990zp5mr"))))
(build-system go-build-system) (build-system go-build-system)
(arguments (arguments
(let ((make-flags (list (string-append "VERSION=" version) (let ((make-flags #~(list (string-append "VERSION=" #$version)
"REVISION=0"))) (string-append "DESTDIR=" #$output)
`(#:import-path "github.com/containerd/containerd" "PREFIX="
#:phases "REVISION=0")))
(modify-phases %standard-phases (list
(add-after 'unpack 'patch-paths #:import-path "github.com/containerd/containerd"
(lambda* (#:key inputs import-path outputs #:allow-other-keys) #:phases
(with-directory-excursion (string-append "src/" import-path) #~(modify-phases %standard-phases
(substitute* "runtime/v1/linux/runtime.go" (add-after 'unpack 'patch-paths
(("defaultRuntime[ \t]*=.*") (lambda* (#:key inputs import-path outputs #:allow-other-keys)
(string-append "defaultRuntime = \"" (with-directory-excursion (string-append "src/" import-path)
(assoc-ref inputs "runc") (substitute* "runtime/v1/linux/runtime.go"
"/sbin/runc\"\n")) (("defaultRuntime[ \t]*=.*")
(("defaultShim[ \t]*=.*") (string-append "defaultRuntime = \""
(string-append "defaultShim = \"" (search-input-file inputs "/sbin/runc")
(assoc-ref outputs "out") "\"\n"))
"/bin/containerd-shim\"\n"))) (("defaultShim[ \t]*=.*")
(substitute* "pkg/cri/config/config_unix.go" (string-append "defaultShim = \""
(("DefaultRuntimeName: \"runc\"") (assoc-ref outputs "out")
(string-append "DefaultRuntimeName: \"" "/bin/containerd-shim\"\n")))
(assoc-ref inputs "runc") (substitute* "pkg/cri/config/config_unix.go"
"/sbin/runc\""))) (("DefaultRuntimeName: \"runc\"")
(substitute* "vendor/github.com/containerd/go-runc/runc.go" (string-append "DefaultRuntimeName: \""
(("DefaultCommand[ \t]*=.*") (search-input-file inputs "/sbin/runc")
(string-append "DefaultCommand = \"" "\"")))
(assoc-ref inputs "runc") (substitute* "vendor/github.com/containerd/go-runc/runc.go"
"/sbin/runc\"\n"))) (("DefaultCommand[ \t]*=.*")
(substitute* "vendor/github.com/containerd/continuity/testutil\ (string-append "DefaultCommand = \""
(search-input-file inputs "/sbin/runc")
"\"\n")))
(substitute* "vendor/github.com/containerd/continuity/testutil\
/loopback/loopback_linux.go" /loopback/loopback_linux.go"
(("exec\\.Command\\(\"losetup\"") (("exec\\.Command\\(\"losetup\"")
(string-append "exec.Command(\"" (string-append "exec.Command(\""
(assoc-ref inputs "util-linux") (search-input-file inputs "/sbin/losetup")
"/sbin/losetup\""))) "\"")))
(substitute* "archive/compression/compression.go" (substitute* "archive/compression/compression.go"
(("exec\\.LookPath\\(\"unpigz\"\\)") (("exec\\.LookPath\\(\"unpigz\"\\)")
(string-append "\"" (assoc-ref inputs "pigz") (string-append "\""
"/bin/unpigz\", error(nil)")))))) (search-input-file inputs "/bin/unpigz")
(replace 'build "\", error(nil)"))))))
(lambda* (#:key import-path #:allow-other-keys) (replace 'build
(with-directory-excursion (string-append "src/" import-path) (lambda* (#:key import-path #:allow-other-keys)
(apply invoke "make" ',make-flags)))) (with-directory-excursion (string-append "src/" import-path)
(replace 'install (apply invoke "make" #$make-flags))))
(lambda* (#:key import-path outputs #:allow-other-keys) (replace 'install
(with-directory-excursion (string-append "src/" import-path) (lambda* (#:key import-path #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))) (with-directory-excursion (string-append "src/" import-path)
(apply invoke "make" (string-append "DESTDIR=" out) (apply invoke "make" "install" #$make-flags))))))))
"PREFIX=" "install" ',make-flags)))))))))
(inputs (inputs
(list btrfs-progs libseccomp pigz runc util-linux)) (list btrfs-progs libseccomp pigz runc util-linux))
(native-inputs (native-inputs