Subject: [PATCH 3/4] gnu: buildah: Fix build.

From: Jean-Pierre De Jesus DIAZ <[email-masked]>
Date: Wed, 3 Jul 2024 18:36:42 +0200

* gnu/packages/containers.scm (buildah)<arguments>: Remove
'remove-go-references phase, add 'patch-buildflags phase and remove
imported modules.

Change-Id: Id89ea5c90ba8064484eec460efdfa592c974adca
---
 gnu/packages/containers.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/containers.scm b/gnu/packages/containers.scm
index 38af5cb3fb..1b7032ca82 100644
--- a/gnu/packages/containers.scm
+++ b/gnu/packages/containers.scm
@@ -617,9 +617,6 @@ (define-public buildah
                              #$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)
@@ -631,6 +628,12 @@ (define-public buildah
               ;; 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))))
+          ;; Add -trimpath to build flags to avoid keeping references to go
+          ;; packages.
+          (add-after 'set-env 'patch-buildflags
+            (lambda _
+              (substitute* "Makefile"
+                (("BUILDFLAGS :=") "BUILDFLAGS := -trimpath "))))
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
@@ -658,8 +661,6 @@ (define-public buildah
                    ,(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"
-- 
2.45.2