Subject: [bug#49327] [PATCH core-updates 005/128] gnu: guix-build-coordinator: Simplify usage of 'wrap-program'.

From: Maxime Devos <[email-masked]>
Date: Fri, 2 Jul 2021 12:06:11 +0200

* gnu/packages/package-management.scm
  (guix-build-coordinator)[arguments]<#:phases>{wrap-executable}:
  Set #:sh argument of 'wrap-program'. Don't substitute the interpreter
  with another interpreter. Drop the 'target' argument.
  (guix-build-coordinator)[inputs]{bash}: Make this input unconditional.
---
 gnu/packages/package-management.scm | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 7229723ab8..680fd18a7e 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2020 Jesse Gibbons <[email-masked]>
 ;;; Copyright © 2020 Martin Becze <[email-masked]>
 ;;; Copyright © 2020 Vincent Legoll <[email-masked]>
+;;; Copyright © 2021 Maxime Devos <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1056,10 +1057,11 @@ environments.")
                (setenv "GUILE_AUTO_COMPILE" "0")
                #t))
            (add-after 'install 'wrap-executable
-             (lambda* (#:key inputs outputs target #:allow-other-keys)
+             (lambda* (#:key inputs outputs #:allow-other-keys)
                (let* ((out (assoc-ref outputs "out"))
                       (bin (string-append out "/bin"))
                       (guile (assoc-ref inputs "guile"))
+                      (bash (assoc-ref inputs "bash"))
                       (version (target-guile-effective-version))
                       (scm (string-append out "/share/guile/site/" version))
                       (go  (string-append out "/lib/guile/" version "/site-ccache")))
@@ -1079,7 +1081,7 @@ environments.")
                                          ,@(if (hurd-target?)
                                                '()
                                                '("guile-fibers")))))
-                      (wrap-program file
+                      (wrap-program file #:sh (string-append bash "/bin/bash")
                         `("PATH" ":" prefix
                           (,bin
                            ;; Support building without sqitch as an input, as it
@@ -1104,14 +1106,7 @@ environments.")
                                          (assoc-ref inputs input)
                                          version))
                                       guile-inputs)
-                                 ":"))))
-                      (when target
-                        ;; XXX work around wrap-program picking bash for the
-                        ;; host rather than target
-                        (let ((bash (assoc-ref inputs "bash")))
-                          (substitute* file
-                            (("^#!.*/bash")
-                             (string-append "#! " bash "/bin/bash")))))))
+                                 ":"))))))
                   (find-files bin)))
                #t))
            (delete 'strip))))             ; As the .go files aren't compatible
@@ -1131,9 +1126,7 @@ environments.")
          ("guile" ,@(assoc-ref (package-native-inputs guix) "guile"))))
       (inputs
        `(("guile" ,@(assoc-ref (package-native-inputs guix) "guile"))
-         ,@(if (%current-target-system)
-               `(("bash" ,bash-minimal))
-               '())
+         ("bash" ,bash-minimal) ; for wrap-program
          ("sqlite" ,sqlite)
          ,@(if (hurd-target?)
                '()
-- 
2.32.0