refactoring and updating podman

This commit is contained in:
Jean-François GUILLAUME 2023-11-30 15:31:51 +00:00
parent da5ff9fa0c
commit 058cd6defd

View file

@ -1,4 +1,5 @@
(define-module (glicid packages containers)
#:use-module (guix)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
@ -19,119 +20,21 @@
(define-public podman
(package
(inherit gnu:podman)
(name "podman")
(version "4.7.2")
(version "4.8.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/containers/podman")
(commit (string-append "v" version))))
(sha256 (base32 "1z9ipwc89cpd3vqn6addbvrw6irwkzpgmqdb6r23jvalw45574d3"))
(sha256 (base32 "1nrqcg289d6d8flli8ybgh79nh2h8wvhqsyzi88jsqcn6w5c4bim"))
(modules '((guix build utils)))
(snippet '(begin
; (substitute* "Makefile" ((".*hack/btrfs.*") ""))
; we build without doc
(substitute* "Makefile" (("all: binaries docs") "all: binaries"))
(substitute* "Makefile" (("install: install.bin install.remote install.man install.systemd") "install: install.bin install.remote install.systemd"))))))
(build-system gnu-build-system)
(arguments
(list
#:make-flags
#~(list #$(string-append "CC=" (cc-for-target))
(string-append "PREFIX=" #$output))
#:tests? #f
#:test-target "test"
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'set-env
(lambda* (#:key inputs #:allow-other-keys)
(setenv "HOME" "/tmp")))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "make" "localsystem")
(invoke "make" "remotesystem"))))
(add-after 'unpack 'fix-hardcoded-paths
(lambda _
(substitute* (find-files "libpod" "\\.go")
(("exec.LookPath[(][\"]slirp4netns[\"][)]") (string-append "exec.LookPath(\"" (which "slirp4netns") "\")")))
(substitute* "hack/install_catatonit.sh"
(("CATATONIT_PATH=\"[^\"]+\"") (string-append "CATATONIT_PATH=" (which "true"))))
(substitute* "vendor/github.com/containers/common/pkg/config/config_linux.go"
(("/usr/local/libexec/podman") (string-append #$output "/bin")))
(substitute* "vendor/github.com/containers/common/pkg/config/default.go"
(("/usr/libexec/podman/conmon") (which "conmon"))
(("/usr/local/libexec/cni") (string-append #$(this-package-input "cni-plugins") "/bin"))
(("/usr/bin/crun") (which "crun")))))
(add-after 'install 'install-completions
(lambda _
(invoke "make" "install.completions"
(string-append "PREFIX=" #$output)))))))
(inputs (list btrfs-progs gnu:cni-plugins gnu:conmon gnu:crun gpgme go-github-com-go-md2man libassuan libseccomp libselinux gnu:slirp4netns fuse-overlayfs)) ;; iptables moved to propagated-inputs
(inputs `(("fuse-overlayfs" ,fuse-overlayfs) ,@(package-inputs gnu:podman)))
(native-inputs (list bats git go-1.20 pkg-config python))
(propagated-inputs (list fuse-overlayfs iptables))
(home-page "https://podman.io")
(synopsis "Manage containers, images, pods, and their volumes")
(description "Podman (the POD MANager) is a tool for managing containers and images, volumes mounted into those containers, and pods made from groups of containers.")
(license license:asl2.0)))
(define-public podman-with-overlayfs
(package
(name "podman-with-overlayfs")
(version "4.7.2")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/containers/podman")
(commit (string-append "v" version))))
(sha256 (base32 "1z9ipwc89cpd3vqn6addbvrw6irwkzpgmqdb6r23jvalw45574d3"))
(modules '((guix build utils)))
(snippet '(begin
(substitute* "Makefile" ((".*hack/btrfs.*") ""))
; we build without doc
(substitute* "Makefile" (("all: binaries docs") "all: binaries"))
(substitute* "Makefile" (("install: install.bin install.remote install.man install.systemd") "install: install.bin install.remote install.systemd"))))))
(build-system gnu-build-system)
(arguments
(list
#:make-flags
#~(list #$(string-append "CC=" (cc-for-target))
(string-append "PREFIX=" #$output))
#:tests? #f
#:test-target "test"
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'set-env
(lambda* (#:key inputs #:allow-other-keys)
(setenv "HOME" "/tmp")))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "make" "localsystem")
(invoke "make" "remotesystem"))))
(add-after 'unpack 'fix-hardcoded-paths
(lambda _
(substitute* (find-files "libpod" "\\.go")
(("exec.LookPath[(][\"]slirp4netns[\"][)]") (string-append "exec.LookPath(\"" (which "slirp4netns") "\")")))
(substitute* "hack/install_catatonit.sh"
(("CATATONIT_PATH=\"[^\"]+\"") (string-append "CATATONIT_PATH=" (which "true"))))
(substitute* "vendor/github.com/containers/common/pkg/config/config_linux.go"
(("/usr/local/libexec/podman") (string-append #$output "/bin")))
(substitute* "vendor/github.com/containers/common/pkg/config/default.go"
(("/usr/libexec/podman/conmon") (which "conmon"))
(("/usr/local/libexec/cni") (string-append #$(this-package-input "cni-plugins") "/bin"))
(("/usr/bin/crun") (which "crun")))))
(add-after 'install 'install-completions
(lambda _
(invoke "make" "install.completions"
(string-append "PREFIX=" #$output)))))))
(inputs (list btrfs-progs gnu:cni-plugins gnu:conmon gnu:crun gpgme go-github-com-go-md2man iptables libassuan libseccomp libselinux gnu:slirp4netns))
(native-inputs (list bats git go-1.20 pkg-config python))
(home-page "https://podman.io")
(synopsis "Manage containers, images, pods, and their volumes")
(description "Podman (the POD MANager) is a tool for managing containers and images, volumes mounted into those containers, and pods made from groups of containers.")
(license license:asl2.0)))
(propagated-inputs (list fuse-overlayfs gnu:slirp4netns iptables))
))