From 57aff6476e3d4c9a2df5ea98f2caaed1472972de Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 12:28:58 +0200 Subject: utils: Add 'every*'. * guix/build/gnu-build-system.scm (every*): Move to... * guix/build/utils.scm (every*): ... here. New procedure. --- guix/build/gnu-build-system.scm | 12 ------------ guix/build/utils.scm | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'guix') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 0a774e1e84..75439c8330 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -409,18 +409,6 @@ makefiles." strip-directories))) outputs)))) -(define (every* pred lst) - "This is like 'every', but process all the elements of LST instead of -stopping as soon as PRED returns false. This is useful when PRED has side -effects, such as displaying warnings or error messages." - (let loop ((lst lst) - (result #t)) - (match lst - (() - result) - ((head . tail) - (loop tail (and (pred head) result)))))) - (define* (validate-runpath #:key (validate-runpath? #t) (elf-directories '("lib" "lib64" "libexec" diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 971929621a..e3f9edc5b5 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -59,10 +59,12 @@ list->search-path-as-string which + every* alist-cons-before alist-cons-after alist-replace modify-phases + with-atomic-file-replacement substitute substitute* @@ -454,6 +456,18 @@ PROGRAM could not be found." ;;; phases. ;;; +(define (every* pred lst) + "This is like 'every', but process all the elements of LST instead of +stopping as soon as PRED returns false. This is useful when PRED has side +effects, such as displaying warnings or error messages." + (let loop ((lst lst) + (result #t)) + (match lst + (() + result) + ((head . tail) + (loop tail (and (pred head) result)))))) + (define* (alist-cons-before reference key value alist #:optional (key=? equal?)) "Insert the KEY/VALUE pair before the first occurrence of a pair whose key -- cgit v1.2.3 From f2d7bbb537dd3e3fa3b0215549640d2d9c0aeaec Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 18:02:30 +0200 Subject: gnu: glibc: Look for locale data in versioned sub-directories. * gnu/packages/base.scm (glibc)[native-search-paths]: Add 'lib/locale/VERSION' for 'GUIX_LOCPATH'. (glibc-locales, glibc-utf8-locales): Write to a VERSION sub-directory. * guix/profiles.scm (ca-certificate-bundle): Adjust LOCPATH value accordingly. --- gnu/packages/base.scm | 11 +++++++---- guix/profiles.scm | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'guix') diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 5fa8beb26a..80b0332de7 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -620,7 +620,8 @@ store.") ;; distros. (list (search-path-specification (variable "GUIX_LOCPATH") - (files '("lib/locale"))))) + (files (list (string-append "lib/locale/" version) + "lib/locale"))))) (synopsis "The GNU C Library") (description @@ -663,7 +664,8 @@ the 'share/locale' sub-directory of this package.") ;; Use $(libdir)/locale as is the case by default. (list (string-append "libc_cv_localedir=" (assoc-ref %outputs "out") - "/lib/locale"))))))))) + "/lib/locale/" + ,(package-version glibc)))))))))) (define-public glibc-utf8-locales (package @@ -672,7 +674,7 @@ the 'share/locale' sub-directory of this package.") (source #f) (build-system trivial-build-system) (arguments - '(#:modules ((guix build utils)) + `(#:modules ((guix build utils)) #:builder (begin (use-modules (srfi srfi-1) (guix build utils)) @@ -680,7 +682,8 @@ the 'share/locale' sub-directory of this package.") (let* ((libc (assoc-ref %build-inputs "glibc")) (gzip (assoc-ref %build-inputs "gzip")) (out (assoc-ref %outputs "out")) - (localedir (string-append out "/lib/locale"))) + (localedir (string-append out "/lib/locale/" + ,version))) ;; 'localedef' needs 'gzip'. (setenv "PATH" (string-append libc "/bin:" gzip "/bin")) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0b417a64de..c56ebb145b 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -573,7 +573,9 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx." ;; Some file names in the NSS certificates are UTF-8 encoded so ;; install a UTF-8 locale. - (setenv "LOCPATH" (string-append #+glibc-utf8-locales "/lib/locale")) + (setenv "LOCPATH" + (string-append #+glibc-utf8-locales "/lib/locale/" + #+(package-version glibc-utf8-locales))) (setlocale LC_ALL "en_US.UTF-8") (match (append-map ca-files '#$(manifest-inputs manifest)) -- cgit v1.2.3 From afd3d9316ce3c48cd7f7dbae64be0f8bcb756ba6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 20:12:59 +0200 Subject: Use "normalized codesets" everywhere. In other words, change "xx_YY.UTF-8" to "xx_YY.utf8". * guix/profiles.scm (ca-certificate-bundle): Use "en_US.utf8" instead of "en_US.UTF-8". * guix/packages.scm (patch-and-repack): Likewise. * guix/build/gnu-build-system.scm (install-locale): Likewise. * guix/build-system/gnu.scm (gnu-build, gnu-cross-build): Likewise. * gnu/packages/python.scm (python-ipython): Likewise. * gnu/packages/gawk.scm (gawk): Likewise. * build-aux/hydra/demo-os.scm: Likewise. * gnu/packages/guile.scm (guile-ncurses)[arguments]: Remove 'change-locale' phase. --- build-aux/hydra/demo-os.scm | 4 ++-- gnu/packages/gawk.scm | 2 +- gnu/packages/guile.scm | 30 +++++++++++------------------- gnu/packages/python.scm | 2 +- guix/build-system/gnu.scm | 4 ++-- guix/build/gnu-build-system.scm | 2 +- guix/packages.scm | 2 +- guix/profiles.scm | 2 +- 8 files changed, 20 insertions(+), 28 deletions(-) (limited to 'guix') diff --git a/build-aux/hydra/demo-os.scm b/build-aux/hydra/demo-os.scm index 95950cacb1..ce46caa580 100644 --- a/build-aux/hydra/demo-os.scm +++ b/build-aux/hydra/demo-os.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014 Ludovic Courtès +;;; Copyright © 2014, 2015 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,7 +29,7 @@ (operating-system (host-name "gnu") (timezone "Europe/Paris") - (locale "en_US.UTF-8") + (locale "en_US.utf8") (bootloader (grub-configuration (device "/dev/sda"))) diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index fa07f5bd4b..425974f61e 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -66,7 +66,7 @@ (setenv "GUIX_LOCPATH" (getcwd)) (zero? (system* "localedef" "--no-archive" "--prefix" (getcwd) "-i" "en_US" - "-f" "UTF-8" "./en_US.UTF-8"))) + "-f" "UTF-8" "./en_US.utf8"))) %standard-phases)))) (inputs `(("libsigsegv" ,libsigsegv) diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index d5a95a0444..f77c9dfece 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -295,25 +295,17 @@ many readers as needed).") (string-append "--with-guilesitedir=" (assoc-ref %outputs "out") "/share/guile/site/2.0")) - #:phases (alist-cons-before - 'check 'change-locale - (lambda _ - ;; Use the locale that's actually available in the build - ;; environment. - (substitute* "test/f009_form_wide.test" - (("en_US\\.utf8") - "en_US.UTF-8"))) - (alist-cons-after - 'install 'post-install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (dir (string-append out "/share/guile/site/")) - (files (find-files dir ".scm"))) - (substitute* files - (("\"libguile-ncurses\"") - (format #f "\"~a/lib/libguile-ncurses\"" - out))))) - %standard-phases)))) + #:phases (alist-cons-after + 'install 'post-install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (dir (string-append out "/share/guile/site/")) + (files (find-files dir ".scm"))) + (substitute* files + (("\"libguile-ncurses\"") + (format #f "\"~a/lib/libguile-ncurses\"" + out))))) + %standard-phases))) (home-page "http://www.gnu.org/software/guile-ncurses/") (synopsis "Guile bindings to ncurses") (description diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 708ba29d24..fd1a2d3601 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -3665,7 +3665,7 @@ cluster without needing to write any wrapper code yourself.") (man1 (string-append data "/man/man1")) (info (string-append data "/info")) (examples (string-append doc "/examples"))) - (setenv "LANG" "en_US.UTF-8") + (setenv "LANG" "en_US.utf8") (with-directory-excursion "docs" ;; FIXME: html and pdf fail to build ;; (system* "make" "html") diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 1f302447c2..3be83468eb 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -287,7 +287,7 @@ standard packages used as implicit inputs of the GNU build system." "bin" "sbin")) (validate-runpath? #t) (phases '%standard-phases) - (locale "en_US.UTF-8") + (locale "en_US.utf8") (system (%current-system)) (build (nix-system->gnu-triplet system)) (imported-modules %gnu-build-system-modules) @@ -422,7 +422,7 @@ is one of `host' or `target'." "bin" "sbin")) (validate-runpath? #t) (phases '%standard-phases) - (locale "en_US.UTF-8") + (locale "en_US.utf8") (system (%current-system)) (build (nix-system->gnu-triplet system)) (imported-modules %gnu-build-system-modules) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 75439c8330..ff7646b22c 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -99,7 +99,7 @@ #t) (define* (install-locale #:key - (locale "en_US.UTF-8") + (locale "en_US.utf8") (locale-category LC_ALL) #:allow-other-keys) "Try to install LOCALE; emit a warning if that fails. The main goal is to diff --git a/guix/packages.scm b/guix/packages.scm index 72822b8c97..622cb0ac0c 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -478,7 +478,7 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." ;; First of all, install a UTF-8 locale so that UTF-8 file names ;; are correctly interpreted. During bootstrap, LOCALES is #f. (setenv "LOCPATH" (string-append #+locales "/lib/locale")) - (setlocale LC_ALL "en_US.UTF-8")) + (setlocale LC_ALL "en_US.utf8")) (setenv "PATH" (string-append #+xz "/bin" ":" #+decomp "/bin")) diff --git a/guix/profiles.scm b/guix/profiles.scm index c56ebb145b..fac322bbab 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -576,7 +576,7 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx." (setenv "LOCPATH" (string-append #+glibc-utf8-locales "/lib/locale/" #+(package-version glibc-utf8-locales))) - (setlocale LC_ALL "en_US.UTF-8") + (setlocale LC_ALL "en_US.utf8") (match (append-map ca-files '#$(manifest-inputs manifest)) (() -- cgit v1.2.3 From 85b81cf8c1fa79cc3929c5fadfabc1b9a47b77c3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 4 Oct 2015 10:19:42 +0200 Subject: packages: Use locales from the /X.Y sub-directory of the locale package. This is a followup to commit f2d7bbb. * guix/packages.scm (patch-and-repack)[build]: Append "/X.Y" to LOCPATH. --- guix/packages.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/packages.scm b/guix/packages.scm index 622cb0ac0c..68fb0916d8 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -477,7 +477,10 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." (when #+locales ;; First of all, install a UTF-8 locale so that UTF-8 file names ;; are correctly interpreted. During bootstrap, LOCALES is #f. - (setenv "LOCPATH" (string-append #+locales "/lib/locale")) + (setenv "LOCPATH" + (string-append #+locales "/lib/locale/" + #+(and locales + (package-version locales)))) (setlocale LC_ALL "en_US.utf8")) (setenv "PATH" (string-append #+xz "/bin" ":" -- cgit v1.2.3