gnu: podman: Use G-expressions.

* gnu/packages/containers.scm (podman)[arguments]: Use G-expressions.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Zhu Zihao 2022-09-04 13:23:29 +08:00 committed by Ludovic Courtès
parent 9f74add674
commit 14a450ae21
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Timmy Douglas <mail@timmydouglas.com> ;;; Copyright © 2021 Timmy Douglas <mail@timmydouglas.com>
;;; Copyright © 2022 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -284,41 +285,44 @@ (define-public podman
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:make-flags (list ,(string-append "CC=" (cc-for-target)) (list
(string-append "PREFIX=" %output)) #:make-flags
#:tests? #f ; /sys/fs/cgroup not set up in guix sandbox #~(list #$(string-append "CC=" (cc-for-target))
#:test-target "test" (string-append "PREFIX=" #$output))
#:phases (modify-phases %standard-phases #:tests? #f ; /sys/fs/cgroup not set up in guix sandbox
(delete 'configure) #:test-target "test"
(add-after 'unpack 'set-env #:phases
(lambda* (#:key inputs #:allow-other-keys) #~(modify-phases %standard-phases
;; when running go, things fail because (delete 'configure)
;; HOME=/homeless-shelter. (add-after 'unpack 'set-env
(setenv "HOME" "/tmp"))) (lambda* (#:key inputs #:allow-other-keys)
(replace 'check ;; when running go, things fail because
(lambda* (#:key tests? #:allow-other-keys) ;; HOME=/homeless-shelter.
(when tests? (setenv "HOME" "/tmp")))
;; (invoke "strace" "-f" "bin/podman" "version") (replace 'check
(invoke "make" "localsystem") (lambda* (#:key tests? #:allow-other-keys)
(invoke "make" "remotesystem")))) (when tests?
(add-after 'unpack 'fix-hardcoded-paths ;; (invoke "strace" "-f" "bin/podman" "version")
(lambda _ (invoke "make" "localsystem")
(substitute* (find-files "libpod" "\\.go") (invoke "make" "remotesystem"))))
(("exec.LookPath[(][\"]slirp4netns[\"][)]") (add-after 'unpack 'fix-hardcoded-paths
(string-append "exec.LookPath(\"" (lambda _
(which "slirp4netns") "\")"))) (substitute* (find-files "libpod" "\\.go")
(substitute* "hack/install_catatonit.sh" (("exec.LookPath[(][\"]slirp4netns[\"][)]")
(("CATATONIT_PATH=\"[^\"]+\"") (string-append "exec.LookPath(\""
(string-append "CATATONIT_PATH=" (which "true")))) (which "slirp4netns") "\")")))
(substitute* "vendor/github.com/containers/common/pkg/config/config_linux.go" (substitute* "hack/install_catatonit.sh"
(("/usr/local/libexec/podman") (("CATATONIT_PATH=\"[^\"]+\"")
(string-append (assoc-ref %outputs "out") "/bin"))) (string-append "CATATONIT_PATH=" (which "true"))))
(substitute* "vendor/github.com/containers/common/pkg/config/default.go" (substitute* "vendor/github.com/containers/common/pkg/config/config_linux.go"
(("/usr/libexec/podman/conmon") (which "conmon")) (("/usr/local/libexec/podman")
(("/usr/local/libexec/cni") (string-append #$output "/bin")))
(string-append (assoc-ref %build-inputs "cni-plugins") (substitute* "vendor/github.com/containers/common/pkg/config/default.go"
"/bin")) (("/usr/libexec/podman/conmon") (which "conmon"))
(("/usr/bin/crun") (which "crun")))))))) (("/usr/local/libexec/cni")
(string-append #$(this-package-input "cni-plugins")
"/bin"))
(("/usr/bin/crun") (which "crun"))))))))
(inputs (inputs
(list btrfs-progs (list btrfs-progs
cni-plugins cni-plugins