profiles: Remove dependency on 'glibc-utf8-locales' for tests.

Commit 1af0860e8b added a mandatory
dependency on 'glibc-utf8-locales', which entails long rebuilds for
tests.

* guix/profiles.scm (profile-derivation): Add #:locales? parameter.
Add 'set-utf8-locale' variable.  Use it when LOCALES? is true.
(link-to-empty-profile): Pass #:locales? #f.
* guix/scripts/environment.scm (inputs->profile-derivation): Pass
  #:locales?.
* guix/scripts/package.scm (build-and-use-profile): Likewise.
* tests/packages.scm ("--search-paths with pattern"): Pass #:locales? #f.
* tests/profiles.scm ("profile-derivation")
("profile-derivation, inputs", "profile-manifest, search-paths")
("etc/profile", "etc/profile when etc/ already exists"):
("etc/profile when etc/ is a symlink"): Likewise.
This commit is contained in:
Ludovic Courtès 2016-12-17 12:43:10 +01:00
parent d44fb7dd60
commit a6562c7e20
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 35 additions and 17 deletions

View file

@ -919,10 +919,14 @@ files for the truetype fonts of the @var{manifest} entries."
(define* (profile-derivation manifest
#:key
(hooks %default-profile-hooks)
(locales? #t)
system)
"Return a derivation that builds a profile (aka. 'user environment') with
the given MANIFEST. The profile includes additional derivations returned by
the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc.
When LOCALES? is true, the build is performed under a UTF-8 locale; this adds
a dependency on the 'glibc-utf8-locales' package."
(mlet %store-monad ((system (if system
(return system)
(current-system)))
@ -943,6 +947,15 @@ the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
(module-ref (resolve-interface '(gnu packages base))
'glibc-utf8-locales))
(define set-utf8-locale
;; Some file names (e.g., in 'nss-certs') are UTF-8 encoded so
;; install a UTF-8 locale.
#~(begin
(setenv "LOCPATH"
#$(file-append glibc-utf8-locales "/lib/locale/"
(package-version glibc-utf8-locales)))
(setlocale LC_ALL "en_US.utf8")))
(define builder
(with-imported-modules '((guix build profiles)
(guix build union)
@ -957,12 +970,7 @@ the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
(setvbuf (current-output-port) _IOLBF)
(setvbuf (current-error-port) _IOLBF)
;; Some file names (e.g., in 'nss-certs') are UTF-8 encoded so
;; install a UTF-8 locale.
(setenv "LOCPATH"
(string-append #+glibc-utf8-locales "/lib/locale/"
#+(package-version glibc-utf8-locales)))
(setlocale LC_ALL "en_US.utf8")
#+(if locales? set-utf8-locale #t)
(define search-paths
;; Search paths of MANIFEST's packages, converted back to their
@ -1110,7 +1118,8 @@ case when generations have been deleted (there are \"holes\")."
"Link GENERATION, a string, to the empty profile. An error is raised if
that fails."
(let* ((drv (run-with-store store
(profile-derivation (manifest '()))))
(profile-derivation (manifest '())
#:locales? #f)))
(prof (derivation->output-path drv "out")))
(build-derivations store (list drv))
(switch-symlinks generation prof)))