summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorOleg Pykhalov <go.wigust@gmail.com>2020-10-16 20:02:51 +0300
committerOleg Pykhalov <go.wigust@gmail.com>2020-10-16 20:02:51 +0300
commit719246a51d47263c3b424a782d9703f59ce9fdc3 (patch)
tree587d29ac41fd2f7253f231e85215b643fed623a9 /gnu
parent1e39c865928fdf4166d152a49e789b26d99fca71 (diff)
downloadguix-719246a51d47263c3b424a782d9703f59ce9fdc3.tar.gz
gnu: containerd: Don't 'chdir' in build phases.
This fixes breaks the 'install-license-files' phase added in
6b793fa66218337a1f638466753cd5326a6a6c18 and is generally not good
practice.

* gnu/packages/docker.scm (containerd): [arguments]: Use
'with-directory-excursion' instead of 'chdir' in build phases.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/docker.scm61
1 files changed, 30 insertions, 31 deletions
diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm
index 8e68403ca4..b130298a04 100644
--- a/gnu/packages/docker.scm
+++ b/gnu/packages/docker.scm
@@ -193,41 +193,40 @@ Python without keeping their credentials in a Docker configuration file.")
      `(#:import-path "github.com/containerd/containerd"
        #:phases
        (modify-phases %standard-phases
-         (add-before 'build 'chdir
-           (lambda _
-             (chdir "src/github.com/containerd/containerd")
-             #t))
          (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".
-             (substitute* "./runtime/v1/linux/runtime.go"
-              (("defaultRuntime[ \t]*=.*")
-               (string-append "defaultRuntime = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n"))
-              (("defaultShim[ \t]*=.*")
-               (string-append "defaultShim = \""
-                              (assoc-ref outputs "out")
-                              "/bin/containerd-shim\"\n")))
-            (substitute* "./vendor/github.com/containerd/go-runc/runc.go"
-              (("DefaultCommand[ \t]*=.*")
-               (string-append "DefaultCommand = \""
-                              (assoc-ref inputs "runc")
-                              "/sbin/runc\"\n")))
-            (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go"
-             (("exec\\.Command\\(\"losetup\"") ; )
-              (string-append "exec.Command(\""
-                             (assoc-ref inputs "util-linux")
-                             "/sbin/losetup\""))) ;)
-             #t))
+             (with-directory-excursion (string-append "src/" import-path)
+               (substitute* "./runtime/v1/linux/runtime.go"
+                 (("defaultRuntime[ \t]*=.*")
+                  (string-append "defaultRuntime = \""
+                                 (assoc-ref inputs "runc")
+                                 "/sbin/runc\"\n"))
+                 (("defaultShim[ \t]*=.*")
+                  (string-append "defaultShim = \""
+                                 (assoc-ref outputs "out")
+                                 "/bin/containerd-shim\"\n")))
+               (substitute* "./vendor/github.com/containerd/go-runc/runc.go"
+                 (("DefaultCommand[ \t]*=.*")
+                  (string-append "DefaultCommand = \""
+                                 (assoc-ref inputs "runc")
+                                 "/sbin/runc\"\n")))
+               (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go"
+                 (("exec\\.Command\\(\"losetup\"") ; )
+                  (string-append "exec.Command(\""
+                                 (assoc-ref inputs "util-linux")
+                                 "/sbin/losetup\""))) ;)
+               #t)))
          (replace 'build
-           (lambda* (#:key (make-flags '()) #:allow-other-keys)
-             (apply invoke "make" make-flags)))
+           (lambda* (#:key import-path (make-flags '()) #:allow-other-keys)
+             (with-directory-excursion (string-append "src/" import-path)
+               (apply invoke "make" make-flags))))
          (replace 'install
-           (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out")))
-               (apply invoke "make" (string-append "DESTDIR=" out) "install"
-                      make-flags)))))))
+           (lambda* (#:key import-path outputs (make-flags '()) #:allow-other-keys)
+             (with-directory-excursion (string-append "src/" import-path)
+               (let* ((out (assoc-ref outputs "out")))
+                 (apply invoke "make" (string-append "DESTDIR=" out) "install"
+                        make-flags))))))))
     (inputs
      `(("btrfs-progs" ,btrfs-progs)
        ("libseccomp" ,libseccomp)