gnu: guix: Avoid Bash wrapper.

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
1d4ab335b2 and
8a973abc6f.

* 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
38b9af7c92 and no longer needed.
This commit is contained in:
Ludovic Courtès 2021-05-04 14:35:31 +02:00
parent 72b7ea416b
commit c47f3fc135
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

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