me
/
guix
Archived
1
0
Fork 0

gnu: buildah: Switch to gnu-build-system.

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
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
master
Tomas Volf 2024-05-10 00:23:14 +02:00 committed by Sharlatan Hellseher
parent b55997d9df
commit 413ef75f89
No known key found for this signature in database
GPG Key ID: 76D727BFF62CD2B5
1 changed files with 62 additions and 37 deletions

View File

@ -619,50 +619,75 @@ being rootless and not requiring any daemon to be running.")
(sha256 (sha256
(base32 "07hr2cfp4kblnmva02ap97id5nzhbqigdfvx7c8nyrkfzw0340n0")) (base32 "07hr2cfp4kblnmva02ap97id5nzhbqigdfvx7c8nyrkfzw0340n0"))
(file-name (git-file-name name version)))) (file-name (git-file-name name version))))
(build-system go-build-system) (build-system gnu-build-system)
(arguments (arguments
(list #:import-path "github.com/containers/buildah/cmd/buildah" (list
#:unpack-path "github.com/containers/buildah" #:make-flags
#~(list (string-append "CC=" #$(cc-for-target))
;; Some dependencies require go-1.18 to build. (string-append "PREFIX=" #$output)
#:go go-1.18 (string-append "GOMD2MAN="
#$go-github-com-go-md2man "/bin/go-md2man"))
#:tests? #f #:tests? #f ; /sys/fs/cgroup not set up in guix sandbox
#:install-source? #f #:test-target "test-unit"
#:imported-modules
(source-module-closure `(,@%gnu-build-system-modules
(guix build go-build-system)))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'prepare-install-docs (delete 'configure)
(lambda* (#:key unpack-path #:allow-other-keys) (add-after 'unpack 'set-env
(substitute* (string-append "src/" (lambda _
unpack-path ;; When running go, things fail because HOME=/homeless-shelter.
"/docs/Makefile") (setenv "HOME" "/tmp")
(("../tests/tools/build/go-md2man") ;; Required for detecting btrfs in hack/btrfs* due to bug in GNU
(which "go-md2man"))) ;; Make <4.4 causing CC not to be propagated into $(shell ...)
(substitute* (string-append "src/" ;; calls. Can be removed once we update to >4.3.
unpack-path (setenv "CC" #$(cc-for-target))))
"/docs/Makefile") (replace 'check
(("/usr/local") (string-append #$output))))) (lambda* (#:key tests? #:allow-other-keys)
(add-after 'build 'build-docs (when tests?
(lambda* (#:key unpack-path #:allow-other-keys) (invoke "make" "test-unit")
(let ((doc (string-append "src/" unpack-path "/docs"))) (invoke "make" "test-conformance")
(invoke "make" "-C" doc)))) (invoke "make" "test-integration"))))
(add-after 'install 'install-docs (add-after 'install 'symlink-helpers
(lambda* (#:key unpack-path #:allow-other-keys) (lambda _
(let ((doc (string-append "src/" unpack-path "/docs"))) (mkdir-p (string-append #$output "/_guix"))
(invoke "make" "-C" doc "install"))))))) (for-each
(inputs (list btrfs-progs (lambda (what)
cni-plugins (symlink (string-append (car what) "/bin/" (cdr what))
conmon (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 eudev
glib glib
gpgme gpgme
libassuan libassuan
libseccomp libseccomp
lvm2 lvm2))
runc))
(native-inputs (native-inputs
(list go-github-com-go-md2man (list bats
gnu-make go-1.21
go-github-com-go-md2man
pkg-config)) pkg-config))
(synopsis "Build @acronym{OCI, Open Container Initiative} images") (synopsis "Build @acronym{OCI, Open Container Initiative} images")
(description (description