gnu: containerd: Don't 'chdir' in build phases.

This fixes breaks the 'install-license-files' phase added in
6b793fa662 and is generally not good
practice.

* gnu/packages/docker.scm (containerd): [arguments]: Use
'with-directory-excursion' instead of 'chdir' in build phases.
This commit is contained in:
Oleg Pykhalov 2020-10-16 20:02:51 +03:00
parent 1e39c86592
commit 719246a51d
No known key found for this signature in database
GPG key ID: 167F8EA5001AFA9C

View file

@ -193,41 +193,40 @@ (define-public containerd
`(#:import-path "github.com/containerd/containerd" `(#:import-path "github.com/containerd/containerd"
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'build 'chdir
(lambda _
(chdir "src/github.com/containerd/containerd")
#t))
(add-after 'chdir 'patch-paths (add-after 'chdir 'patch-paths
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs import-path outputs #:allow-other-keys)
;; TODO: Patch "socat", "unpigz". ;; TODO: Patch "socat", "unpigz".
(substitute* "./runtime/v1/linux/runtime.go" (with-directory-excursion (string-append "src/" import-path)
(("defaultRuntime[ \t]*=.*") (substitute* "./runtime/v1/linux/runtime.go"
(string-append "defaultRuntime = \"" (("defaultRuntime[ \t]*=.*")
(assoc-ref inputs "runc") (string-append "defaultRuntime = \""
"/sbin/runc\"\n")) (assoc-ref inputs "runc")
(("defaultShim[ \t]*=.*") "/sbin/runc\"\n"))
(string-append "defaultShim = \"" (("defaultShim[ \t]*=.*")
(assoc-ref outputs "out") (string-append "defaultShim = \""
"/bin/containerd-shim\"\n"))) (assoc-ref outputs "out")
(substitute* "./vendor/github.com/containerd/go-runc/runc.go" "/bin/containerd-shim\"\n")))
(("DefaultCommand[ \t]*=.*") (substitute* "./vendor/github.com/containerd/go-runc/runc.go"
(string-append "DefaultCommand = \"" (("DefaultCommand[ \t]*=.*")
(assoc-ref inputs "runc") (string-append "DefaultCommand = \""
"/sbin/runc\"\n"))) (assoc-ref inputs "runc")
(substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go" "/sbin/runc\"\n")))
(("exec\\.Command\\(\"losetup\"") ; ) (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go"
(string-append "exec.Command(\"" (("exec\\.Command\\(\"losetup\"") ; )
(assoc-ref inputs "util-linux") (string-append "exec.Command(\""
"/sbin/losetup\""))) ;) (assoc-ref inputs "util-linux")
#t)) "/sbin/losetup\""))) ;)
#t)))
(replace 'build (replace 'build
(lambda* (#:key (make-flags '()) #:allow-other-keys) (lambda* (#:key import-path (make-flags '()) #:allow-other-keys)
(apply invoke "make" make-flags))) (with-directory-excursion (string-append "src/" import-path)
(apply invoke "make" make-flags))))
(replace 'install (replace 'install
(lambda* (#:key outputs (make-flags '()) #:allow-other-keys) (lambda* (#:key import-path outputs (make-flags '()) #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))) (with-directory-excursion (string-append "src/" import-path)
(apply invoke "make" (string-append "DESTDIR=" out) "install" (let* ((out (assoc-ref outputs "out")))
make-flags))))))) (apply invoke "make" (string-append "DESTDIR=" out) "install"
make-flags))))))))
(inputs (inputs
`(("btrfs-progs" ,btrfs-progs) `(("btrfs-progs" ,btrfs-progs)
("libseccomp" ,libseccomp) ("libseccomp" ,libseccomp)