[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70112] [PATCH 11/11] gnu: buildah: Switch to gnu-build-system.
From: |
Tomas Volf |
Subject: |
[bug#70112] [PATCH 11/11] gnu: buildah: Switch to gnu-build-system. |
Date: |
Sun, 31 Mar 2024 20:35:08 +0200 |
Buildah is fundamentally similar to podman and provides its own Makefile.
This commit switches from go-build-system to gnu-build-system so that the
build can be done using `make' instead of reinvention some parts (like
documentation) in the guile. The package pretty much follows how podman
package looks like.
* gnu/packages/containers.scm (buildah)[source]: Reformat.
[build-system]: Use gnu-build-system.
[arguments]<#:import-path, #:unpack-path, #:go, #:install-source?>: Delete.
<#:make-flags>: Set make flags.
<#:test-target>: Set, even though the tests are disabled.
<#:imported-modules>: Also import (guix build go-build-system) for the
remove-go-references phase.
<#:phases>{'prepare-install-docs, 'build-docs, 'install-docs}: Delete.
{'configure}: Delete.
{'set-env, 'check, 'symlink-helpers, 'wrap-buildah, 'remove-go-references}
{'install-completions}: New phases.
[inputs]: Remove no longer used cni-plugins, conmon, runc. Add bash-minimal.
[native-inputs]: Remove gnu-make, add go-1.21 and bats.
Change-Id: I0ddd5febb0116a71a857e2a98a9951dbe8bd40d9
---
gnu/packages/containers.scm | 99 +++++++++++++++++++++++--------------
1 file changed, 62 insertions(+), 37 deletions(-)
diff --git a/gnu/packages/containers.scm b/gnu/packages/containers.scm
index 48b276e250..2e68d08c94 100644
--- a/gnu/packages/containers.scm
+++ b/gnu/packages/containers.scm
@@ -611,50 +611,75 @@ (define-public buildah
(base32
"07hr2cfp4kblnmva02ap97id5nzhbqigdfvx7c8nyrkfzw0340n0"))
(file-name (git-file-name name version))))
- (build-system go-build-system)
+ (build-system gnu-build-system)
(arguments
- (list #:import-path "github.com/containers/buildah/cmd/buildah"
- #:unpack-path "github.com/containers/buildah"
-
- ;; Some dependencies require go-1.18 to build.
- #:go go-1.18
-
- #:tests? #f
- #:install-source? #f
- #:phases
- #~(modify-phases %standard-phases
- (add-after 'unpack 'prepare-install-docs
- (lambda* (#:key unpack-path #:allow-other-keys)
- (substitute* (string-append "src/"
- unpack-path
- "/docs/Makefile")
- (("../tests/tools/build/go-md2man")
- (which "go-md2man")))
- (substitute* (string-append "src/"
- unpack-path
- "/docs/Makefile")
- (("/usr/local") (string-append #$output)))))
- (add-after 'build 'build-docs
- (lambda* (#:key unpack-path #:allow-other-keys)
- (let ((doc (string-append "src/" unpack-path "/docs")))
- (invoke "make" "-C" doc))))
- (add-after 'install 'install-docs
- (lambda* (#:key unpack-path #:allow-other-keys)
- (let ((doc (string-append "src/" unpack-path "/docs")))
- (invoke "make" "-C" doc "install")))))))
- (inputs (list btrfs-progs
- cni-plugins
- conmon
+ (list
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ (string-append "PREFIX=" #$output)
+ (string-append "GOMD2MAN="
+ #$go-github-com-go-md2man "/bin/go-md2man"))
+ #:tests? #f ; /sys/fs/cgroup not set up in guix sandbox
+ #:test-target "test-unit"
+ #:imported-modules
+ (source-module-closure `(,@%gnu-build-system-modules
+ (guix build go-build-system)))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'unpack 'set-env
+ (lambda _
+ ;; When running go, things fail because HOME=/homeless-shelter.
+ (setenv "HOME" "/tmp")
+ ;; Required for detecting btrfs in hack/btrfs* due to bug in GNU
+ ;; Make <4.4 causing CC not to be propagated into $(shell ...)
+ ;; calls. Can be removed once we update to >4.3.
+ (setenv "CC" #$(cc-for-target))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "make" "test-unit")
+ (invoke "make" "test-conformance")
+ (invoke "make" "test-integration"))))
+ (add-after 'install 'symlink-helpers
+ (lambda _
+ (mkdir-p (string-append #$output "/_guix"))
+ (for-each
+ (lambda (what)
+ (symlink (string-append (car what) "/bin/" (cdr what))
+ (string-append #$output "/_guix/" (cdr what))))
+ ;; Only tools that cannot be discovered via $PATH are
+ ;; symlinked. Rest is handled in the 'wrap-buildah phase.
+ `((#$aardvark-dns . "aardvark-dns")
+ (#$netavark . "netavark")))))
+ (add-after 'install 'wrap-buildah
+ (lambda _
+ (wrap-program (string-append #$output "/bin/buildah")
+ `("CONTAINERS_HELPER_BINARY_DIR" =
+ (,(string-append #$output "/_guix")))
+ `("PATH" suffix
+ (,(string-append #$crun "/bin")
+ ,(string-append #$gcc "/bin") ; cpp
+ ,(string-append #$passt "/bin")
+ "/run/setuid-programs")))))
+ (add-after 'install 'remove-go-references
+ (@@ (guix build go-build-system) remove-go-references))
+ (add-after 'install 'install-completions
+ (lambda _
+ (invoke "make" "install.completions"
+ (string-append "PREFIX=" #$output)))))))
+ (inputs (list bash-minimal
+ btrfs-progs
eudev
glib
gpgme
libassuan
libseccomp
- lvm2
- runc))
+ lvm2))
(native-inputs
- (list go-github-com-go-md2man
- gnu-make
+ (list bats
+ go-1.21
+ go-github-com-go-md2man
pkg-config))
(synopsis "Build @acronym{OCI, Open Container Initiative} images")
(description
--
2.41.0
- [bug#70112] [PATCH 00/11] Update container tooling (podman, buildah), Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 02/11] gnu: podman: Drop obsolete comment., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 03/11] gnu: podman: Update to 5.0.0., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 05/11] gnu: passt: Update to 2024_03_20.71dd405., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 01/11] gnu: crun: Update to 1.14.4., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 04/11] gnu: conmon: Update to 2.1.10., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 06/11] gnu: Add catatonit., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 07/11] gnu: Add podman-compose., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 10/11] gnu: buildah: Update to 1.35.3., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 08/11] gnu: gvisor-tap-vsock: Remove references to go., Tomas Volf, 2024/03/31
- [bug#70112] [PATCH 11/11] gnu: buildah: Switch to gnu-build-system.,
Tomas Volf <=
- [bug#70112] [PATCH 09/11] gnu: podman: Revamp the package., Tomas Volf, 2024/03/31