unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Tomas Volf <~@wolfsden.cz>
To: 70112@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [bug#70112] [PATCH 11/11] gnu: buildah: Switch to gnu-build-system.
Date: Sun, 31 Mar 2024 20:35:08 +0200	[thread overview]
Message-ID: <31a1cbe8a908ae2892ea88606ee877be0915aeae.1711909824.git.~@wolfsden.cz> (raw)
In-Reply-To: <cover.1711909824.git.~@wolfsden.cz>

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





  parent reply	other threads:[~2024-03-31 18:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-31 18:32 [bug#70112] [PATCH 00/11] Update container tooling (podman, buildah) Tomas Volf
2024-03-31 18:34 ` [bug#70112] [PATCH 01/11] gnu: crun: Update to 1.14.4 Tomas Volf
2024-03-31 18:34 ` [bug#70112] [PATCH 02/11] gnu: podman: Drop obsolete comment Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 03/11] gnu: podman: Update to 5.0.0 Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 04/11] gnu: conmon: Update to 2.1.10 Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 05/11] gnu: passt: Update to 2024_03_20.71dd405 Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 06/11] gnu: Add catatonit Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 07/11] gnu: Add podman-compose Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 08/11] gnu: gvisor-tap-vsock: Remove references to go Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 09/11] gnu: podman: Revamp the package Tomas Volf
2024-03-31 18:35 ` [bug#70112] [PATCH 10/11] gnu: buildah: Update to 1.35.3 Tomas Volf
2024-03-31 18:35 ` Tomas Volf [this message]
2024-05-09 22:23 ` [bug#70112] [PATCH v2 01/11] gnu: crun: Update to 1.15 Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 02/11] gnu: podman: Drop obsolete comment Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 03/11] gnu: podman: Update to 5.0.2 Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 04/11] gnu: conmon: Update to 2.1.11 Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 05/11] gnu: passt: Update to 2024_03_20.71dd405 Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 06/11] gnu: Add catatonit Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 07/11] gnu: Add podman-compose Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 08/11] gnu: gvisor-tap-vsock: Remove references to go Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 09/11] gnu: podman: Revamp the package Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 10/11] gnu: buildah: Update to 1.35.3 Tomas Volf
2024-05-09 22:23   ` [bug#70112] [PATCH v2 11/11] gnu: buildah: Switch to gnu-build-system Tomas Volf
2024-05-21 22:00 ` bug#70112: [PATCH 00/11] Update container tooling (podman, buildah) Sharlatan Hellseher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='31a1cbe8a908ae2892ea88606ee877be0915aeae.1711909824.git.~@wolfsden.cz' \
    --to=~@wolfsden.cz \
    --cc=70112@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).