all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 48224@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#48224] [PATCH 1/2] gnu: guix: Avoid Bash wrapper.
Date: Tue,  4 May 2021 15:39:57 +0200	[thread overview]
Message-ID: <20210504133958.11011-1-ludo@gnu.org> (raw)
In-Reply-To: <20210504132542.10540-1-ludo@gnu.org>

The Bash wrapper created by 'wrap-program' creates an extra
indirection and may annoyingly emit locale warnings:

  /gnu/store/…-bash-minimal-5.0.16/bin/bash: warning: setlocale: LC_ALL: cannot change locale (wtf)

This warning would typically show up when running Guix, as produced by
'guix pack guix', on a foreign distro, annihilating efforts made in
1d4ab335b22a93e01c2eb1eb3e93fc6534157040 and
8a973abc6f7eebfcd8a904bfbb99cb9f86f66ef0.

* gnu/packages/package-management.scm (guix)[arguments]: In
'wrap-program' phase, remove 'string-join' call for PATH and GOPATH.
Replace 'wrap-program' call with a 'substitute*' form.  Remove (when
target ...) form.
[inputs]: Remove "bash-minimal" added in commit
38b9af7c92344a17b6680ebd2aeea14171f84a1c and no longer needed.
---
 gnu/packages/package-management.scm | 56 ++++++++++++++++-------------
 1 file changed, 31 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 827166c938..1a637f9ec8 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -326,31 +326,38 @@ $(prefix)/etc/openrc\n")))
                                  (open-pipe* OPEN_READ
                                              (string-append guile "/bin/guile")
                                              "-c" "(display (effective-version))")))
-                               (path   (string-join
-                                        (map (cut string-append <>
-                                                  "/share/guile/site/"
-                                                  effective)
-                                             (delete #f deps*))
-                                        ":"))
-                               (gopath (string-join
-                                        (map (cut string-append <>
-                                                  "/lib/guile/" effective
-                                                  "/site-ccache")
-                                             (delete #f deps*))
-                                        ":"))
+                               (path   (map (cut string-append <>
+                                                 "/share/guile/site/"
+                                                 effective)
+                                            (delete #f deps*)))
+                               (gopath (map (cut string-append <>
+                                                 "/lib/guile/" effective
+                                                 "/site-ccache")
+                                            (delete #f deps*)))
                                (locpath (string-append locales "/lib/locale")))
 
-                          (wrap-program (string-append out "/bin/guix")
-                            `("GUILE_LOAD_PATH" ":" prefix (,path))
-                            `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath))
-                            `("GUIX_LOCPATH" ":" suffix (,locpath)))
-
-                          (when target
-                            ;; XXX Touching wrap-program rebuilds world
-                            (let ((bash (assoc-ref inputs "bash")))
-                              (substitute* (string-append out "/bin/guix")
-                                (("^#!.*/bash") (string-append "#! " bash "/bin/bash")))))
-                          #t)))
+                          ;; Modify 'guix' directly instead of using
+                          ;; 'wrap-command'.  This avoids the indirection
+                          ;; through Bash, which in turn avoids getting Bash's
+                          ;; own locale warnings.
+                          (substitute* (string-append out "/bin/guix")
+                            (("!#")
+                             (string-append
+                              "!#\n\n"
+                              (object->string
+                               `(set! %load-path (append ',path %load-path)))
+                              "\n"
+                              (object->string
+                               `(set! %load-compiled-path
+                                  (append ',gopath %load-compiled-path)))
+                              "\n"
+                              (object->string
+                               `(let ((path (getenv "GUIX_LOCPATH")))
+                                  (setenv "GUIX_LOCPATH"
+                                          (if path
+                                              (string-append path ":" ,locpath)
+                                              ,locpath))))
+                              "\n\n"))))))
 
                     ;; The 'guix' executable has 'OUT/libexec/guix/guile' as
                     ;; its shebang; that should remain unchanged, thus remove
@@ -405,8 +412,7 @@ $(prefix)/etc/openrc\n")))
                `(("boot-guile/i686" ,(bootstrap-guile-origin "i686-linux")))
                '())
          ,@(if (%current-target-system)
-               `(("bash" ,bash-minimal)
-                 ("xz" ,xz))
+               `(("xz" ,xz))
                '())
 
          ;; Tests also rely on these bootstrap executables.
-- 
2.31.1





  reply	other threads:[~2021-05-04 13:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 13:25 [bug#48224] [PATCH 0/2] Avoid Bash wrapper in 'guix' package Ludovic Courtès
2021-05-04 13:39 ` Ludovic Courtès [this message]
2021-05-04 13:39   ` [bug#48224] [PATCH 2/2] gnu: guix: Phases refer to #:system and #:target Ludovic Courtès
2021-05-04 19:21     ` Maxime Devos
2021-05-04 23:05       ` [bug#48224] [PATCH 0/2] Avoid Bash wrapper in 'guix' package Ludovic Courtès
2021-05-04 23:26         ` Vagrant Cascadian
2021-05-09 21:56           ` Ludovic Courtès
2021-05-13  3:45             ` Vagrant Cascadian

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

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

  git send-email \
    --in-reply-to=20210504133958.11011-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=48224@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.