From 46bd6edd5af4b4fe1f1d066028a6a84ed17ce96b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 30 Sep 2015 17:06:40 +0200 Subject: gnu: libc: Look for locale data under /run/current-system/locale/X.Y. * gnu/packages/base.scm (glibc)[arguments]: Append VERSION to 'libc_cv_localedir'. * gnu/system/locale.scm (localedef-command): Write to the sub-directory called (package-version libc) in #$output. (locale-directory): Create said directory. * doc/guix.texi (Locales): Mention the per-version sub-directory. --- doc/guix.texi | 7 ++++--- gnu/packages/base.scm | 10 +++++++--- gnu/system/locale.scm | 9 ++++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6a3765f56a..68ee451efc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5591,9 +5591,10 @@ list only the locales that are actually used, as in: @vindex LOCPATH The compiled locale definitions are available at -@file{/run/current-system/locale}, which is the default location where -the GNU@tie{}libc looks for locale data. This can be overridden using -the @code{LOCPATH} environment variable (@pxref{locales-and-locpath, +@file{/run/current-system/locale/X.Y}, where @code{X.Y} is the libc +version, which is the default location where the GNU@tie{}libc provided +by Guix looks for locale data. This can be overridden using the +@code{LOCPATH} environment variable (@pxref{locales-and-locpath, @code{LOCPATH} and locale packages}). The @code{locale-definition} form is provided by the @code{(gnu system diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index a3e3e36608..a7d9459913 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -509,12 +509,16 @@ store.") ;; Set the default locale path. In practice, $LOCPATH may be ;; defined to point whatever locales users want. However, setuid ;; binaries don't honor $LOCPATH, so they'll instead look into - ;; $libc_cv_localedir; we choose /run/current-system/locale, with - ;; the idea that it is going to be populated by the sysadmin. + ;; $libc_cv_localedir; we choose /run/current-system/locale/X.Y, + ;; with the idea that it is going to be populated by the sysadmin. + ;; The "X.Y" sub-directory is because locale data formats are + ;; incompatible across libc versions; see + ;; . ;; ;; `--localedir' is not honored, so work around it. ;; See . - (string-append "libc_cv_localedir=/run/current-system/locale") + (string-append "libc_cv_localedir=/run/current-system/locale/" + ,version) (string-append "--with-headers=" (assoc-ref %build-inputs "linux-headers") diff --git a/gnu/system/locale.scm b/gnu/system/locale.scm index 393dd42354..010fb45272 100644 --- a/gnu/system/locale.scm +++ b/gnu/system/locale.scm @@ -19,6 +19,7 @@ (define-module (gnu system locale) #:use-module (guix gexp) #:use-module (guix records) + #:use-module (guix packages) #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (srfi srfi-26) @@ -57,14 +58,20 @@ "-i" #$(locale-definition-source locale) "-f" #$(locale-definition-charset locale) (string-append #$output "/" + #$(package-version libc) "/" #$(locale-definition-name locale)))))) (define* (locale-directory locales #:key (libc (canonical-package glibc))) - "Return a directory containing all of LOCALES compiled." + "Return a directory containing all of LOCALES for LIBC compiled. + +Because locale data formats are incompatible when switching from one libc to +another, locale data is put in a sub-directory named after the 'version' field +of LIBC." (define build #~(begin (mkdir #$output) + (mkdir (string-append #$output "/" #$(package-version libc))) ;; 'localedef' executes 'gzip' to access compressed locale sources. (setenv "PATH" (string-append #$gzip "/bin")) -- cgit v1.2.3 From 997f86e96b003462751e4bde4397aec34090dc48 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 30 Sep 2015 17:19:27 +0200 Subject: gnu: pixman: Update to 0.32.8. * gnu/packages/xdisorg.scm (pixman): Update to 0.32.8. * gnu/packages/patches/pixman-pointer-arithmetic.patch: Remove. * gnu-system.am (dist_patch_DATA): Adjust accordingly. --- gnu-system.am | 1 - .../patches/pixman-pointer-arithmetic.patch | 15 ------------ gnu/packages/xdisorg.scm | 27 ++++++++++------------ 3 files changed, 12 insertions(+), 31 deletions(-) delete mode 100644 gnu/packages/patches/pixman-pointer-arithmetic.patch diff --git a/gnu-system.am b/gnu-system.am index 98634a0c2b..f2f7e1752c 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -589,7 +589,6 @@ dist_patch_DATA = \ gnu/packages/patches/perl-tk-x11-discover.patch \ gnu/packages/patches/pidgin-add-search-path.patch \ gnu/packages/patches/pingus-sdl-libs-config.patch \ - gnu/packages/patches/pixman-pointer-arithmetic.patch \ gnu/packages/patches/plotutils-libpng-jmpbuf.patch \ gnu/packages/patches/polkit-drop-test.patch \ gnu/packages/patches/portaudio-audacity-compat.patch \ diff --git a/gnu/packages/patches/pixman-pointer-arithmetic.patch b/gnu/packages/patches/pixman-pointer-arithmetic.patch deleted file mode 100644 index d34e6632a0..0000000000 --- a/gnu/packages/patches/pixman-pointer-arithmetic.patch +++ /dev/null @@ -1,15 +0,0 @@ -Fix whereby -an arithemitic overflow could occur while doing pointer arithmetic, -leading pixman to use an invalid address as the destination buffer. - ---- pixman-0.32.6/pixman/pixman-general.c 2015-09-21 15:14:34.695981325 +0200 -+++ pixman-0.32.6/pixman/pixman-general.c 2015-09-21 15:19:48.898355548 +0200 -@@ -144,8 +144,7 @@ general_composite_rect (pixman_implemen - mask_buffer = ALIGN (src_buffer + width * Bpp); - dest_buffer = ALIGN (mask_buffer + width * Bpp); - -- if (ALIGN (dest_buffer + width * Bpp) > -- scanline_buffer + sizeof (stack_scanline_buffer)) -+ if ((width + 1) * Bpp * 3 > sizeof (stack_scanline_buffer)) - { - scanline_buffer = pixman_malloc_ab_plus_c (width, Bpp * 3, 32 * 3); diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm index 96e7c3ae71..fbe8af33d0 100644 --- a/gnu/packages/xdisorg.scm +++ b/gnu/packages/xdisorg.scm @@ -171,24 +171,21 @@ following the mouse.") (define-public pixman (package (name "pixman") - (version "0.32.6") - (source - (origin - (method url-fetch) - (uri (string-append - "http://cairographics.org/releases/pixman-" - version - ".tar.gz")) - (sha256 - (base32 - "0129g4zdrw5hif5783li7rzcr4vpbc2cfia91azxmsk0h0xx3zix")) - (patches (list (search-patch "pixman-pointer-arithmetic.patch"))))) + (version "0.32.8") + (source (origin + (method url-fetch) + (uri (string-append + "http://cairographics.org/releases/pixman-" + version ".tar.gz")) + (sha256 + (base32 + "0pfn0247sjsi95kwjih0wwqpp28wadihqk1bn28x6iqbqhbxwnjp")))) (build-system gnu-build-system) (inputs - `(("libpng" ,libpng) - ("zlib" ,zlib))) + `(("libpng" ,libpng) + ("zlib" ,zlib))) (native-inputs - `(("pkg-config" ,pkg-config))) + `(("pkg-config" ,pkg-config))) (home-page "http://www.pixman.org/") (synopsis "Low-level pixel manipulation library") (description "Pixman is a low-level software library for pixel -- cgit v1.2.3 From 2ae71b746bd7265735cb50b2dd93a09ef45f9f38 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 12:19:23 +0200 Subject: gnu: glibc: Do not abort when incompatible locale data is found. * gnu/packages/patches/glibc-locale-incompatibility.patch: New file. * gnu/packages/base.scm (glibc)[source]: Use it. * gnu-system.am (dist_patch_DATA): Add it. --- gnu-system.am | 1 + gnu/packages/base.scm | 1 + .../patches/glibc-locale-incompatibility.patch | 23 ++++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 gnu/packages/patches/glibc-locale-incompatibility.patch diff --git a/gnu-system.am b/gnu-system.am index f2f7e1752c..fbfe72845b 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -471,6 +471,7 @@ dist_patch_DATA = \ gnu/packages/patches/glibc-bootstrap-system.patch \ gnu/packages/patches/glibc-ldd-x86_64.patch \ gnu/packages/patches/glibc-locales.patch \ + gnu/packages/patches/glibc-locale-incompatibility.patch \ gnu/packages/patches/glibc-o-largefile.patch \ gnu/packages/patches/gmp-arm-asm-nothumb.patch \ gnu/packages/patches/gnucash-price-quotes-perl.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index a7d9459913..99f60d1400 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -476,6 +476,7 @@ store.") (modules '((guix build utils))) (patches (map search-patch '("glibc-ldd-x86_64.patch" + "glibc-locale-incompatibility.patch" "glibc-o-largefile.patch"))))) (build-system gnu-build-system) diff --git a/gnu/packages/patches/glibc-locale-incompatibility.patch b/gnu/packages/patches/glibc-locale-incompatibility.patch new file mode 100644 index 0000000000..baf30a79a7 --- /dev/null +++ b/gnu/packages/patches/glibc-locale-incompatibility.patch @@ -0,0 +1,23 @@ +This patch avoids an assertion failure when incompatible locale data +is encountered: + + https://sourceware.org/ml/libc-alpha/2015-09/msg00575.html + +--- glibc-2.22/locale/loadlocale.c 2015-09-22 17:16:02.321981548 +0200 ++++ glibc-2.22/locale/loadlocale.c 2015-09-22 17:17:34.814659064 +0200 +@@ -120,10 +120,11 @@ + _nl_value_type_LC_XYZ array. There are all pointers. */ + switch (category) + { +-#define CATTEST(cat) \ +- case LC_##cat: \ +- assert (cnt < (sizeof (_nl_value_type_LC_##cat) \ +- / sizeof (_nl_value_type_LC_##cat[0]))); \ ++#define CATTEST(cat) \ ++ case LC_##cat: \ ++ if (cnt >= (sizeof (_nl_value_type_LC_##cat) \ ++ / sizeof (_nl_value_type_LC_##cat[0]))) \ ++ goto puntdata; \ + break + CATTEST (NUMERIC); + CATTEST (TIME); -- cgit v1.2.3 From e393586161dd0b8814bbb88e9212deffa171687f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 12:23:33 +0200 Subject: gnu: coreutils: Use upstream's fix for 'tail'. * gnu/packages/patches/coreutils-racy-tail-test.patch: Remove. * gnu-system.am (dist_patch_DATA): Adjust accordingly. * gnu/packages/base.scm (coreutils)[source]: Replace this patch with upstream's fix for 'tail'. --- gnu-system.am | 1 - gnu/packages/base.scm | 9 ++++++++- gnu/packages/patches/coreutils-racy-tail-test.patch | 13 ------------- 3 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 gnu/packages/patches/coreutils-racy-tail-test.patch diff --git a/gnu-system.am b/gnu-system.am index fbfe72845b..faf42b757e 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -418,7 +418,6 @@ dist_patch_DATA = \ gnu/packages/patches/clang-libc-search-path.patch \ gnu/packages/patches/clucene-pkgconfig.patch \ gnu/packages/patches/cmake-fix-tests.patch \ - gnu/packages/patches/coreutils-racy-tail-test.patch \ gnu/packages/patches/cpio-gets-undeclared.patch \ gnu/packages/patches/cpufrequtils-fix-aclocal.patch \ gnu/packages/patches/crda-optional-gcrypt.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 99f60d1400..1b4233420f 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -251,7 +251,14 @@ used to apply commands with arbitrarily long arguments.") (base32 "0w11jw3fb5sslf0f72kxy7llxgk1ia3a6bcw0c9kmvxrlj355mx2")) (patches - (list (search-patch "coreutils-racy-tail-test.patch"))))) + (list (origin + (method url-fetch) + (uri "http://git.savannah.gnu.org/cgit/coreutils.git/\ +patch/?id=3ba68f9e64fa2eb8af22d510437a0c6441feb5e0") + (sha256 + (base32 + "1dnlszhc8lihhg801i9sz896mlrgfsjfcz62636prb27k5hmixqz")) + (file-name "coreutils-tail-inotify-race.patch")))))) (build-system gnu-build-system) (inputs `(("acl" ,acl) ; TODO: add SELinux ("gmp" ,gmp) ;bignums in 'expr', yay! diff --git a/gnu/packages/patches/coreutils-racy-tail-test.patch b/gnu/packages/patches/coreutils-racy-tail-test.patch deleted file mode 100644 index 91640513e4..0000000000 --- a/gnu/packages/patches/coreutils-racy-tail-test.patch +++ /dev/null @@ -1,13 +0,0 @@ -Skip this test, which uncovers a race condition in how 'tail' handles -file deletion. See . - ---- a/tests/tail-2/assert.sh -+++ b/tests/tail-2/assert.sh -@@ -16,6 +16,7 @@ - # You should have received a copy of the GNU General Public License - # along with this program. If not, see . - -+exit 77 # see - - # This test fails with tail from textutils-2.0. - # It would get something like this: -- cgit v1.2.3 From 29aca449c73be15ab11d332d975d5499bb49c7ca Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 12:25:22 +0200 Subject: gnu: gettext: Upgrade to 0.19.6. * gnu/packages/gettext.scm (gnu-gettext): Update to 0.19.6. --- gnu/packages/gettext.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/gettext.scm b/gnu/packages/gettext.scm index f1b0221629..14dedc51b5 100644 --- a/gnu/packages/gettext.scm +++ b/gnu/packages/gettext.scm @@ -40,14 +40,14 @@ (define-public gnu-gettext (package (name "gettext") - (version "0.19.5") + (version "0.19.6") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gettext/gettext-" version ".tar.gz")) (sha256 (base32 - "0fppvj4l9maa9q1swvhnv96hsqxx90vcjbdyjhqpir3ll55q2n0j")))) + "0pb9vp4ifymvdmc31ks3xxcnfqgzj8shll39czmk8c1splclqjzd")))) (build-system gnu-build-system) (inputs `(("expat" ,expat))) -- cgit v1.2.3 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(-) 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 1668dfcd37174af13636a85c80df2f833e867387 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 12:31:21 +0200 Subject: gnu: texinfo: Claim 'INFOPATH'. Reported by Konrad Hinsen . * gnu/packages/texinfo.scm (texinfo)[native-search-paths]: New field. --- gnu/packages/texinfo.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gnu/packages/texinfo.scm b/gnu/packages/texinfo.scm index 92bd9471dd..591fb1f298 100644 --- a/gnu/packages/texinfo.scm +++ b/gnu/packages/texinfo.scm @@ -45,6 +45,13 @@ (inputs `(("ncurses" ,ncurses) ("xz" ,xz) ("perl" ,perl))) + + (native-search-paths + ;; This is the variable used by the standalone Info reader. + (list (search-path-specification + (variable "INFOPATH") + (files '("share/info"))))) + (home-page "http://www.gnu.org/software/texinfo/") (synopsis "The GNU documentation format") (description -- cgit v1.2.3 From fbb909ac7e947ebc8aea2c2efca7df3a78dfc3c4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 1 Oct 2015 21:32:50 +0200 Subject: gnu: glibc: Honor 'GUIX_LOCPATH'. * gnu/packages/patches/glibc-guix-locpath.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. * gnu/packages/base.scm (glibc)[source]: Use it. [native-search-paths]: Use 'GUIX_LOCPATH' instead of 'LOCPATH'. * doc/guix.texi (Application Setup): Introduce the term "foreign distro". Document 'GUIX_LOCPATH'. --- doc/guix.texi | 26 ++++++++++++++------ gnu-system.am | 1 + gnu/packages/base.scm | 7 ++++-- gnu/packages/patches/glibc-guix-locpath.patch | 34 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 gnu/packages/patches/glibc-guix-locpath.patch diff --git a/doc/guix.texi b/doc/guix.texi index 68ee451efc..a1746d44d1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -933,24 +933,24 @@ daemons on the same machine. @node Application Setup @section Application Setup -When using Guix on top of GNU/Linux distribution other than GuixSD, a -few additional steps are needed to get everything in place. Here are -some of them. +When using Guix on top of GNU/Linux distribution other than GuixSD---a +so-called @dfn{foreign distro}---a few additional steps are needed to +get everything in place. Here are some of them. @subsection Locales @anchor{locales-and-locpath} @cindex locales, when not on GuixSD @vindex LOCPATH +@vindex GUIX_LOCPATH Packages installed @i{via} Guix will not use the host system's locale data. Instead, you must first install one of the locale packages -available with Guix and then define the @code{LOCPATH} environment -variable (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C Library -Reference Manual}): +available with Guix and then define the @code{GUIX_LOCPATH} environment +variable: @example $ guix package -i glibc-locales -$ export LOCPATH=$HOME/.guix-profile/lib/locale +$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale @end example Note that the @code{glibc-locales} package contains data for all the @@ -958,6 +958,18 @@ locales supported by the GNU@tie{}libc and weighs in at around 110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but limited to a few UTF-8 locales. +The @code{GUIX_LOCPATH} variable plays the exact same role as +@code{LOCPATH} (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C +Library Reference Manual}). However, since it is honored only by Guix's +libc, and not by the libc provided by foreign distros, using +@code{GUIX_LOCPATH} allows you to make sure the the foreign distro's +programs will not end up loading incompatible locale data. This is +important because the locale data format used by different libc versions +may be incompatible. + +When both @code{GUIX_LOCPATH} and @code{LOCPATH} are defined, the latter +takes precedence. + @subsection X11 Fonts The majority of graphical applications use Fontconfig to locate and diff --git a/gnu-system.am b/gnu-system.am index faf42b757e..e17bea6bdb 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -468,6 +468,7 @@ dist_patch_DATA = \ gnu/packages/patches/glib-tests-timer.patch \ gnu/packages/patches/glib-tests-gapplication.patch \ gnu/packages/patches/glibc-bootstrap-system.patch \ + gnu/packages/patches/glibc-guix-locpath.patch \ gnu/packages/patches/glibc-ldd-x86_64.patch \ gnu/packages/patches/glibc-locales.patch \ gnu/packages/patches/glibc-locale-incompatibility.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 1b4233420f..5fa8beb26a 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -484,6 +484,7 @@ store.") (patches (map search-patch '("glibc-ldd-x86_64.patch" "glibc-locale-incompatibility.patch" + "glibc-guix-locpath.patch" "glibc-o-largefile.patch"))))) (build-system gnu-build-system) @@ -614,9 +615,11 @@ store.") (native-search-paths ;; Search path for packages that provide locale data. This is useful - ;; primarily in build environments. + ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than + ;; 'LOCPATH' to avoid interference with the host system's libc on foreign + ;; distros. (list (search-path-specification - (variable "LOCPATH") + (variable "GUIX_LOCPATH") (files '("lib/locale"))))) (synopsis "The GNU C Library") diff --git a/gnu/packages/patches/glibc-guix-locpath.patch b/gnu/packages/patches/glibc-guix-locpath.patch new file mode 100644 index 0000000000..69bb2e50de --- /dev/null +++ b/gnu/packages/patches/glibc-guix-locpath.patch @@ -0,0 +1,34 @@ +Honor a special 'GUIX_LOCPATH' environment variable. + +This is most useful when using Guix on top of another distro, which uses an +different libc version with incompatible locale data. In this case, setting +'GUIX_LOCPATH' rather than 'LOCPATH' allows users to tell Guix's libc where to +look for its locale data without breaking programs that use the other libc. + +See for +some background information. + +--- a/locale/newlocale.c ++++ b/locale/newlocale.c +@@ -103,6 +103,8 @@ __newlocale (int category_mask, const char *locale, __locale_t base) + locale_path_len = 0; + + locpath_var = getenv ("LOCPATH"); ++ if (locpath_var == NULL || locpath_var[0] == '\0') ++ locpath_var = getenv ("GUIX_LOCPATH"); + if (locpath_var != NULL && locpath_var[0] != '\0') + { + if (__argz_create_sep (locpath_var, ':', +diff --git a/locale/setlocale.c b/locale/setlocale.c +index ead030d..0e66c7b 100644 +--- a/locale/setlocale.c ++++ b/locale/setlocale.c +@@ -252,6 +252,8 @@ setlocale (int category, const char *locale) + locale_path_len = 0; + + locpath_var = getenv ("LOCPATH"); ++ if (locpath_var == NULL || locpath_var[0] == '\0') ++ locpath_var = getenv ("GUIX_LOCPATH"); + if (locpath_var != NULL && locpath_var[0] != '\0') + { + if (__argz_create_sep (locpath_var, ':', -- 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(-) 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 b6ac54517cc878034f57f983cfe561ebf8e2eb7f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 12:13:53 +0200 Subject: gnu: commencement: Remove the tricky locale compatibility handling. This is made unnecessary by the use of 'GUIX_LOCPATH'. * gnu/packages/commencement.scm (locale-proof-package): Remove. (%boot5-inputs): Add on GLIBC-UTF8-LOCALES-FINAL. This reverts parts of commit 28cbc58. * gnu/packages/gawk.scm (gawk): Set 'GUIX_LOCPATH' instead of 'LOCPATH'. --- gnu/packages/commencement.scm | 77 +++---------------------------------------- gnu/packages/gawk.scm | 2 +- 2 files changed, 5 insertions(+), 74 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 56c4cefaf9..73b0ce4364 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -660,46 +660,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (current-source-location) #:guile %bootstrap-guile)))))) -(define (locale-proof-package p) - "Return a new package based on P that ignores 'LOCPATH'. The result is a -\"locale-proof\" package in the sense that it cannot end up loading locale -data that is not in the format its libc expects. This is useful because the -locale binary format may change incompatibly between libc versions." - (package - (inherit p) - (name (string-append (package-name p) "-lp")) - (build-system trivial-build-system) - (inputs `(("original" ,p) - ("bash" ,bash-final))) - (outputs '("out")) - (arguments - '(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) - - (let* ((out (assoc-ref %outputs "out")) - (bin (string-append out "/bin")) - (bash (assoc-ref %build-inputs "bash")) - (binaries (assoc-ref %build-inputs "original")) - (programs (find-files (string-append binaries "/bin")))) - (define (wrap-program program) - (let ((base (basename program))) - (call-with-output-file base - (lambda (port) - (format port "#!~a/bin/sh -# Unset 'LOCPATH' so that the program does not end up loading incompatible -# locale data. -unset LOCPATH -exec \"~a\" \"$@\"\n" - bash program))) - (chmod base #o755))) - - (mkdir-p bin) - (with-directory-excursion bin - (for-each wrap-program programs) - #t))))))) - (define-public ld-wrapper ;; The final 'ld' wrapper, which uses the final Guile and Binutils. (package (inherit ld-wrapper-boot3) @@ -710,40 +670,11 @@ exec \"~a\" \"$@\"\n" '("guile" "bash")))))) (define %boot5-inputs - ;; Now with UTF-8 locales. Since the locale binary format differs between - ;; libc versions, we have to rebuild some of the packages so that they use - ;; the new libc, which allows them to load locale data from - ;; GLIBC-UTF8-LOCALES-FINAL (remember that the bootstrap binaries were built - ;; with an older libc, which cannot load the new locale format.) See + ;; Now with UTF-8 locales. Remember that the bootstrap binaries were built + ;; with an older libc, which cannot load the new locale format. See ;; . - (let ((new-libc-package (compose package-with-bootstrap-guile - (cut package-with-explicit-inputs <> - %boot4-inputs - (current-source-location) - #:guile %bootstrap-guile)))) - `(("locales" ,glibc-utf8-locales-final) - ("ld-wrapper" ,ld-wrapper) - ("binutils" ,binutils-final) - ("bash" ,bash-final) - ("make" ,(new-libc-package gnu-make)) - - ;; Some test suites (grep, Gnulib) use 'diff' to compare files in locale - ;; encoding, so we need support this. - ("diffutils" ,(new-libc-package diffutils)) - ("findutils" ,(new-libc-package findutils)) - - ;; Grep's test suite uses 'timeout' from Coreutils to execute command, - ;; and yet these commands need to see the valid 'LOCPATH'. - ("coreutils" ,(new-libc-package coreutils-minimal)) - - ;; We just wrap the remaining binaries (tar, gzip, xz, etc.) so that - ;; they ignore 'LOCPATH' (if they did not, they would be hit by an - ;; assertion failure in loadlocale.c.) - ("coreutils&co" ,(locale-proof-package %bootstrap-coreutils&co)) - - ,@(fold alist-delete %boot4-inputs - '("coreutils&co" "findutils" "diffutils" "make" - "bash" "binutils-cross" "ld-wrapper"))))) + `(("locales" ,glibc-utf8-locales-final) + ,@%boot4-inputs)) (define gnu-make-final ;; The final GNU Make, which uses the final Guile. diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index d2639a32a3..fa07f5bd4b 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -63,7 +63,7 @@ ;; A bunch of tests require the availability of a UTF-8 ;; locale and otherwise fail. Since UTF-8 locales are not ;; available during bootstrap, create one here. - (setenv "LOCPATH" (getcwd)) + (setenv "GUIX_LOCPATH" (getcwd)) (zero? (system* "localedef" "--no-archive" "--prefix" (getcwd) "-i" "en_US" "-f" "UTF-8" "./en_US.UTF-8"))) -- cgit v1.2.3 From 8a55e217ad3a6af96f9e05eb676616224fde509f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 3 Oct 2015 20:06:24 +0200 Subject: gnu: glibc-utf8-locales: Use the normalized codeset. * gnu/packages/base.scm (glibc-utf8-locales)[argument]: Use the normalized codeset by default. --- gnu/packages/base.scm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 80b0332de7..c6abf56ebf 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -689,12 +689,22 @@ the 'share/locale' sub-directory of this package.") (mkdir-p localedir) (every (lambda (locale) - (zero? (system* "localedef" "--no-archive" - "--prefix" localedir "-i" locale - "-f" "UTF-8" + (define file + ;; Use the "normalized codeset" by + ;; default--e.g., "en_US.utf8". + (string-append localedir "/" locale ".utf8")) + + (and (zero? (system* "localedef" "--no-archive" + "--prefix" localedir + "-i" locale + "-f" "UTF-8" file)) + (begin + ;; For backward compatibility with Guix + ;; <= 0.8.3, add "xx_YY.UTF-8". + (symlink (string-append locale ".utf8") (string-append localedir "/" - locale - ".UTF-8")))) + locale ".UTF-8")) + #t))) ;; These are the locales commonly used for ;; tests---e.g., in Guile's i18n tests. -- 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(-) 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(-) 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 From 2ebe938c2f943232955df889a72a6280c412a649 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 4 Oct 2015 10:20:59 +0200 Subject: doc: Mention that /X.Y must be used for GUIX_LOCPATH. This is a followup to commit f2d7bbb. * doc/guix.texi (Application Setup): Mention the /X.Y sub-directory. --- doc/guix.texi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index a1746d44d1..4cd1cc561d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -950,9 +950,13 @@ variable: @example $ guix package -i glibc-locales -$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale +$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale/2.22 @end example +The @file{/2.22} sub-directory is if you install locales from +@code{glibc-locales-2.22}---i.e., locales for libc version 2.22. Adjust +in accordance with the libc version being used. + Note that the @code{glibc-locales} package contains data for all the locales supported by the GNU@tie{}libc and weighs in at around 110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but -- cgit v1.2.3 From f211b2af676751b66d1443e5371b92c9a98c8a0c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 5 Oct 2015 22:27:23 +0200 Subject: Revert "gnu: glibc: Honor 'GUIX_LOCPATH'." This reverts commits fbb909ac7e947ebc8aea2c2efca7df3a78dfc3c4 and 2ebe938c2f943232955df889a72a6280c412a649. --- doc/guix.texi | 30 ++++++----------------- gnu-system.am | 1 - gnu/packages/base.scm | 8 ++----- gnu/packages/patches/glibc-guix-locpath.patch | 34 --------------------------- 4 files changed, 9 insertions(+), 64 deletions(-) delete mode 100644 gnu/packages/patches/glibc-guix-locpath.patch diff --git a/doc/guix.texi b/doc/guix.texi index 4cd1cc561d..68ee451efc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -933,47 +933,31 @@ daemons on the same machine. @node Application Setup @section Application Setup -When using Guix on top of GNU/Linux distribution other than GuixSD---a -so-called @dfn{foreign distro}---a few additional steps are needed to -get everything in place. Here are some of them. +When using Guix on top of GNU/Linux distribution other than GuixSD, a +few additional steps are needed to get everything in place. Here are +some of them. @subsection Locales @anchor{locales-and-locpath} @cindex locales, when not on GuixSD @vindex LOCPATH -@vindex GUIX_LOCPATH Packages installed @i{via} Guix will not use the host system's locale data. Instead, you must first install one of the locale packages -available with Guix and then define the @code{GUIX_LOCPATH} environment -variable: +available with Guix and then define the @code{LOCPATH} environment +variable (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C Library +Reference Manual}): @example $ guix package -i glibc-locales -$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale/2.22 +$ export LOCPATH=$HOME/.guix-profile/lib/locale @end example -The @file{/2.22} sub-directory is if you install locales from -@code{glibc-locales-2.22}---i.e., locales for libc version 2.22. Adjust -in accordance with the libc version being used. - Note that the @code{glibc-locales} package contains data for all the locales supported by the GNU@tie{}libc and weighs in at around 110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but limited to a few UTF-8 locales. -The @code{GUIX_LOCPATH} variable plays the exact same role as -@code{LOCPATH} (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C -Library Reference Manual}). However, since it is honored only by Guix's -libc, and not by the libc provided by foreign distros, using -@code{GUIX_LOCPATH} allows you to make sure the the foreign distro's -programs will not end up loading incompatible locale data. This is -important because the locale data format used by different libc versions -may be incompatible. - -When both @code{GUIX_LOCPATH} and @code{LOCPATH} are defined, the latter -takes precedence. - @subsection X11 Fonts The majority of graphical applications use Fontconfig to locate and diff --git a/gnu-system.am b/gnu-system.am index e17bea6bdb..faf42b757e 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -468,7 +468,6 @@ dist_patch_DATA = \ gnu/packages/patches/glib-tests-timer.patch \ gnu/packages/patches/glib-tests-gapplication.patch \ gnu/packages/patches/glibc-bootstrap-system.patch \ - gnu/packages/patches/glibc-guix-locpath.patch \ gnu/packages/patches/glibc-ldd-x86_64.patch \ gnu/packages/patches/glibc-locales.patch \ gnu/packages/patches/glibc-locale-incompatibility.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index c6abf56ebf..1250f51108 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -484,7 +484,6 @@ store.") (patches (map search-patch '("glibc-ldd-x86_64.patch" "glibc-locale-incompatibility.patch" - "glibc-guix-locpath.patch" "glibc-o-largefile.patch"))))) (build-system gnu-build-system) @@ -615,13 +614,10 @@ store.") (native-search-paths ;; Search path for packages that provide locale data. This is useful - ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than - ;; 'LOCPATH' to avoid interference with the host system's libc on foreign - ;; distros. + ;; primarily in build environments. (list (search-path-specification (variable "GUIX_LOCPATH") - (files (list (string-append "lib/locale/" version) - "lib/locale"))))) + (files '("lib/locale"))))) (synopsis "The GNU C Library") (description diff --git a/gnu/packages/patches/glibc-guix-locpath.patch b/gnu/packages/patches/glibc-guix-locpath.patch deleted file mode 100644 index 69bb2e50de..0000000000 --- a/gnu/packages/patches/glibc-guix-locpath.patch +++ /dev/null @@ -1,34 +0,0 @@ -Honor a special 'GUIX_LOCPATH' environment variable. - -This is most useful when using Guix on top of another distro, which uses an -different libc version with incompatible locale data. In this case, setting -'GUIX_LOCPATH' rather than 'LOCPATH' allows users to tell Guix's libc where to -look for its locale data without breaking programs that use the other libc. - -See for -some background information. - ---- a/locale/newlocale.c -+++ b/locale/newlocale.c -@@ -103,6 +103,8 @@ __newlocale (int category_mask, const char *locale, __locale_t base) - locale_path_len = 0; - - locpath_var = getenv ("LOCPATH"); -+ if (locpath_var == NULL || locpath_var[0] == '\0') -+ locpath_var = getenv ("GUIX_LOCPATH"); - if (locpath_var != NULL && locpath_var[0] != '\0') - { - if (__argz_create_sep (locpath_var, ':', -diff --git a/locale/setlocale.c b/locale/setlocale.c -index ead030d..0e66c7b 100644 ---- a/locale/setlocale.c -+++ b/locale/setlocale.c -@@ -252,6 +252,8 @@ setlocale (int category, const char *locale) - locale_path_len = 0; - - locpath_var = getenv ("LOCPATH"); -+ if (locpath_var == NULL || locpath_var[0] == '\0') -+ locpath_var = getenv ("GUIX_LOCPATH"); - if (locpath_var != NULL && locpath_var[0] != '\0') - { - if (__argz_create_sep (locpath_var, ':', -- cgit v1.2.3 From 85e5721421b7e8ee1cf6b76d34e892034e3c4f51 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 1 Oct 2015 21:32:50 +0200 Subject: gnu: glibc: Look for locale data in versioned sub-directories. Suggested by Mark H Weaver . * gnu/packages/patches/glibc-versioned-locpath.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. * gnu/packages/base.scm (glibc)[source]: Use it. [arguments]: Add explicit version sub-directory to libc_cv_localedir. [native-search-paths]: Use 'GUIX_LOCPATH' instead of 'LOCPATH'. (glibc-locales, glibc-utf8-locales): Write to a VERSION sub-directory. --- doc/guix.texi | 36 +++- gnu-system.am | 1 + gnu/packages/base.scm | 7 +- gnu/packages/patches/glibc-versioned-locpath.patch | 240 +++++++++++++++++++++ 4 files changed, 275 insertions(+), 9 deletions(-) create mode 100644 gnu/packages/patches/glibc-versioned-locpath.patch diff --git a/doc/guix.texi b/doc/guix.texi index 68ee451efc..4ee4fe1ffe 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -933,24 +933,24 @@ daemons on the same machine. @node Application Setup @section Application Setup -When using Guix on top of GNU/Linux distribution other than GuixSD, a -few additional steps are needed to get everything in place. Here are -some of them. +When using Guix on top of GNU/Linux distribution other than GuixSD---a +so-called @dfn{foreign distro}---a few additional steps are needed to +get everything in place. Here are some of them. @subsection Locales @anchor{locales-and-locpath} @cindex locales, when not on GuixSD @vindex LOCPATH +@vindex GUIX_LOCPATH Packages installed @i{via} Guix will not use the host system's locale data. Instead, you must first install one of the locale packages -available with Guix and then define the @code{LOCPATH} environment -variable (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C Library -Reference Manual}): +available with Guix and then define the @code{GUIX_LOCPATH} environment +variable: @example $ guix package -i glibc-locales -$ export LOCPATH=$HOME/.guix-profile/lib/locale +$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale @end example Note that the @code{glibc-locales} package contains data for all the @@ -958,6 +958,28 @@ locales supported by the GNU@tie{}libc and weighs in at around 110@tie{}MiB. Alternately, the @code{glibc-utf8-locales} is smaller but limited to a few UTF-8 locales. +The @code{GUIX_LOCPATH} variable plays a role similar to @code{LOCPATH} +(@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C Library Reference +Manual}). There are two important differences though: + +@enumerate +@item +@code{GUIX_LOCPATH} is honored only by Guix's libc, and not by the libc +provided by foreign distros. Thus, using @code{GUIX_LOCPATH} allows you +to make sure the the foreign distro's programs will not end up loading +incompatible locale data. + +@item +libc suffixes each entry of @code{GUIX_LOCPATH} with @code{/X.Y}, where +@code{X.Y} is the libc version---e.g., @code{2.22}. This means that, +should your Guix profile contain a mixture of programs linked against +different libc version, each libc version will only try to load locale +data in the right format. +@end enumerate + +This is important because the locale data format used by different libc +versions may be incompatible. + @subsection X11 Fonts The majority of graphical applications use Fontconfig to locate and diff --git a/gnu-system.am b/gnu-system.am index faf42b757e..4db5db58ec 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -472,6 +472,7 @@ dist_patch_DATA = \ gnu/packages/patches/glibc-locales.patch \ gnu/packages/patches/glibc-locale-incompatibility.patch \ gnu/packages/patches/glibc-o-largefile.patch \ + gnu/packages/patches/glibc-versioned-locpath.patch \ gnu/packages/patches/gmp-arm-asm-nothumb.patch \ gnu/packages/patches/gnucash-price-quotes-perl.patch \ gnu/packages/patches/gnutls-doc-fix.patch \ diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 1250f51108..f951e28b3b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -484,6 +484,7 @@ store.") (patches (map search-patch '("glibc-ldd-x86_64.patch" "glibc-locale-incompatibility.patch" + "glibc-versioned-locpath.patch" "glibc-o-largefile.patch"))))) (build-system gnu-build-system) @@ -614,7 +615,9 @@ store.") (native-search-paths ;; Search path for packages that provide locale data. This is useful - ;; primarily in build environments. + ;; primarily in build environments. Use 'GUIX_LOCPATH' rather than + ;; 'LOCPATH' to avoid interference with the host system's libc on foreign + ;; distros. (list (search-path-specification (variable "GUIX_LOCPATH") (files '("lib/locale"))))) @@ -657,7 +660,7 @@ the 'share/locale' sub-directory of this package.") (alist-delete 'install ,phases))) ((#:configure-flags flags) `(append ,flags - ;; Use $(libdir)/locale as is the case by default. + ;; Use $(libdir)/locale/X.Y as is the case by default. (list (string-append "libc_cv_localedir=" (assoc-ref %outputs "out") "/lib/locale/" diff --git a/gnu/packages/patches/glibc-versioned-locpath.patch b/gnu/packages/patches/glibc-versioned-locpath.patch new file mode 100644 index 0000000000..bc7652127f --- /dev/null +++ b/gnu/packages/patches/glibc-versioned-locpath.patch @@ -0,0 +1,240 @@ +The format of locale data can be incompatible between libc versions, and +loading incompatible data can lead to 'setlocale' returning EINVAL at best +or triggering an assertion failure at worst. See +https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00717.html +for background information. + +To address that, this patch changes libc to honor a new 'GUIX_LOCPATH' +variable, and to look for locale data in version-specific sub-directories of +that variable. So, if GUIX_LOCPATH=/foo:/bar, locale data is searched for in +/foo/X.Y and /bar/X.Y, where X.Y is the libc version number. + +That way, a single 'GUIX_LOCPATH' setting can work even if different libc +versions coexist on the system. + +--- a/locale/newlocale.c ++++ b/locale/newlocale.c +@@ -30,6 +30,7 @@ + /* Lock for protecting global data. */ + __libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden) + ++extern error_t compute_locale_search_path (char **, size_t *); + + /* Use this when we come along an error. */ + #define ERROR_RETURN \ +@@ -48,7 +49,6 @@ __newlocale (int category_mask, const char *locale, __locale_t base) + __locale_t result_ptr; + char *locale_path; + size_t locale_path_len; +- const char *locpath_var; + int cnt; + size_t names_len; + +@@ -102,17 +102,8 @@ __newlocale (int category_mask, const char *locale, __locale_t base) + locale_path = NULL; + locale_path_len = 0; + +- locpath_var = getenv ("LOCPATH"); +- if (locpath_var != NULL && locpath_var[0] != '\0') +- { +- if (__argz_create_sep (locpath_var, ':', +- &locale_path, &locale_path_len) != 0) +- return NULL; +- +- if (__argz_add_sep (&locale_path, &locale_path_len, +- _nl_default_locale_path, ':') != 0) +- return NULL; +- } ++ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0) ++ return NULL; + + /* Get the names for the locales we are interested in. We either + allow a composite name or a single name. */ +diff --git a/locale/setlocale.c b/locale/setlocale.c +index ead030d..0c0e314 100644 +--- a/locale/setlocale.c ++++ b/locale/setlocale.c +@@ -215,12 +215,65 @@ setdata (int category, struct __locale_data *data) + } + } + ++/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as ++ a colon-separated list. Return ENOMEN on error, zero otherwise. */ ++error_t ++compute_locale_search_path (char **locale_path, size_t *locale_path_len) ++{ ++ char* guix_locpath_var = getenv ("GUIX_LOCPATH"); ++ char *locpath_var = getenv ("LOCPATH"); ++ ++ if (guix_locpath_var != NULL && guix_locpath_var[0] != '\0') ++ { ++ /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These ++ entries are systematically prefixed with "/X.Y" where "X.Y" is the ++ libc version. */ ++ if (__argz_create_sep (guix_locpath_var, ':', ++ locale_path, locale_path_len) != 0 ++ || __argz_suffix_entries (locale_path, locale_path_len, ++ "/" VERSION) != 0) ++ goto bail_out; ++ } ++ ++ if (locpath_var != NULL && locpath_var[0] != '\0') ++ { ++ char *reg_locale_path = NULL; ++ size_t reg_locale_path_len = 0; ++ ++ if (__argz_create_sep (locpath_var, ':', ++ ®_locale_path, ®_locale_path_len) != 0) ++ goto bail_out; ++ ++ if (__argz_append (locale_path, locale_path_len, ++ reg_locale_path, reg_locale_path_len) != 0) ++ goto bail_out; ++ ++ free (reg_locale_path); ++ } ++ ++ if (*locale_path != NULL) ++ { ++ /* Append the system default locale directory. */ ++ if (__argz_add_sep (locale_path, locale_path_len, ++ _nl_default_locale_path, ':') != 0) ++ goto bail_out; ++ } ++ ++ return 0; ++ ++ bail_out: ++ free (*locale_path); ++ *locale_path = NULL; ++ *locale_path_len = 0; ++ ++ return ENOMEM; ++} ++ + char * + setlocale (int category, const char *locale) + { + char *locale_path; + size_t locale_path_len; +- const char *locpath_var; + char *composite; + + /* Sanity check for CATEGORY argument. */ +@@ -251,17 +304,10 @@ setlocale (int category, const char *locale) + locale_path = NULL; + locale_path_len = 0; + +- locpath_var = getenv ("LOCPATH"); +- if (locpath_var != NULL && locpath_var[0] != '\0') ++ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0) + { +- if (__argz_create_sep (locpath_var, ':', +- &locale_path, &locale_path_len) != 0 +- || __argz_add_sep (&locale_path, &locale_path_len, +- _nl_default_locale_path, ':') != 0) +- { +- __libc_rwlock_unlock (__libc_setlocale_lock); +- return NULL; +- } ++ __libc_rwlock_unlock (__libc_setlocale_lock); ++ return NULL; + } + + if (category == LC_ALL) +diff --git a/string/Makefile b/string/Makefile +index 8424a61..f925503 100644 +--- a/string/Makefile ++++ b/string/Makefile +@@ -38,7 +38,7 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \ + swab strfry memfrob memmem rawmemchr strchrnul \ + $(addprefix argz-,append count create ctsep next \ + delete extract insert stringify \ +- addsep replace) \ ++ addsep replace suffix) \ + envz basename \ + strcoll_l strxfrm_l string-inlines memrchr \ + xpg-strerror strerror_l +diff --git a/string/argz-suffix.c b/string/argz-suffix.c +new file mode 100644 +index 0000000..505b0f2 +--- /dev/null ++++ b/string/argz-suffix.c +@@ -0,0 +1,56 @@ ++/* Copyright (C) 2015 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ Contributed by Ludovic Courtès . ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++ ++ ++error_t ++__argz_suffix_entries (char **argz, size_t *argz_len, const char *suffix) ++ ++{ ++ size_t suffix_len = strlen (suffix); ++ size_t count = __argz_count (*argz, *argz_len); ++ size_t new_argz_len = *argz_len + count * suffix_len; ++ char *new_argz = malloc (new_argz_len); ++ ++ if (new_argz) ++ { ++ char *p = new_argz, *entry; ++ ++ for (entry = *argz; ++ entry != NULL; ++ entry = argz_next (*argz, *argz_len, entry)) ++ { ++ p = stpcpy (p, entry); ++ p = stpcpy (p, suffix); ++ p++; ++ } ++ ++ free (*argz); ++ *argz = new_argz; ++ *argz_len = new_argz_len; ++ ++ return 0; ++ } ++ else ++ return ENOMEM; ++} ++weak_alias (__argz_suffix_entries, argz_suffix_entries) +diff --git a/string/argz.h b/string/argz.h +index bb62a31..d276a35 100644 +--- a/string/argz.h ++++ b/string/argz.h +@@ -134,6 +134,16 @@ extern error_t argz_replace (char **__restrict __argz, + const char *__restrict __str, + const char *__restrict __with, + unsigned int *__restrict __replace_count); ++ ++/* Suffix each entry of ARGZ & ARGZ_LEN with SUFFIX. Return 0 on success, ++ and ENOMEN if memory cannot be allocated. */ ++extern error_t __argz_suffix_entries (char **__restrict __argz, ++ size_t *__restrict __argz_len, ++ const char *__restrict __suffix); ++extern error_t argz_suffix_entries (char **__restrict __argz, ++ size_t *__restrict __argz_len, ++ const char *__restrict __suffix); ++ + + /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there + are no more. If entry is NULL, then the first entry is returned. This -- cgit v1.2.3 From 18bf40a087bbb9d671f9fcb9ff6e26b94ba02ffa Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 6 Oct 2015 15:02:27 +0200 Subject: gnu: gawk: Remove unneeded 'install-locale' phase. * gnu/packages/gawk.scm (gawk)[arguments]: Remove now unneeded 'install-locale' phase. --- gnu/packages/gawk.scm | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm index 425974f61e..6bfea34667 100644 --- a/gnu/packages/gawk.scm +++ b/gnu/packages/gawk.scm @@ -57,17 +57,7 @@ (string-append "### " match)))) '()))) - (alist-cons-before - 'check 'install-locales - (lambda _ - ;; A bunch of tests require the availability of a UTF-8 - ;; locale and otherwise fail. Since UTF-8 locales are not - ;; available during bootstrap, create one here. - (setenv "GUIX_LOCPATH" (getcwd)) - (zero? (system* "localedef" "--no-archive" - "--prefix" (getcwd) "-i" "en_US" - "-f" "UTF-8" "./en_US.utf8"))) - %standard-phases)))) + %standard-phases))) (inputs `(("libsigsegv" ,libsigsegv) ,@(if (%current-target-system) -- cgit v1.2.3 From 42e735dfc78ff89aff8a6e6e6dc60142f4ee2bf3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 6 Oct 2015 15:18:44 +0200 Subject: gnu: gmp: Skip unreliable test. * gnu/packages/patches/gmp-faulty-test.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. * gnu/packages/multiprecision.scm (gmp)[source]: Use it. --- gnu-system.am | 1 + gnu/packages/multiprecision.scm | 6 ++++-- gnu/packages/patches/gmp-faulty-test.patch | 11 +++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/gmp-faulty-test.patch diff --git a/gnu-system.am b/gnu-system.am index 4db5db58ec..cdae0ed1b9 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -474,6 +474,7 @@ dist_patch_DATA = \ gnu/packages/patches/glibc-o-largefile.patch \ gnu/packages/patches/glibc-versioned-locpath.patch \ gnu/packages/patches/gmp-arm-asm-nothumb.patch \ + gnu/packages/patches/gmp-faulty-test.patch \ gnu/packages/patches/gnucash-price-quotes-perl.patch \ gnu/packages/patches/gnutls-doc-fix.patch \ gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch \ diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm index 903d160b24..ee74c03700 100644 --- a/gnu/packages/multiprecision.scm +++ b/gnu/packages/multiprecision.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès +;;; Copyright © 2012, 2013, 2015 Ludovic Courtès ;;; Copyright © 2014 Mark H Weaver ;;; Copyright © 2015 Andreas Enge ;;; @@ -39,7 +39,9 @@ (sha256 (base32 "0r5pp27cy7ch3dg5v0rsny8bib1zfvrza6027g2mp5f6v8pd6mli")) - (patches (list (search-patch "gmp-arm-asm-nothumb.patch"))))) + (patches (map search-patch + '("gmp-arm-asm-nothumb.patch" + "gmp-faulty-test.patch"))))) (build-system gnu-build-system) (native-inputs `(("m4" ,m4))) (outputs '("out" "debug")) diff --git a/gnu/packages/patches/gmp-faulty-test.patch b/gnu/packages/patches/gmp-faulty-test.patch new file mode 100644 index 0000000000..3fd8a1f8d6 --- /dev/null +++ b/gnu/packages/patches/gmp-faulty-test.patch @@ -0,0 +1,11 @@ +Skip a test that randomly fails on ARMv7: . + +--- a/tests/mpz/reuse.c ++++ b/tests/mpz/reuse.c +@@ -213,6 +213,7 @@ main (int argc, char **argv) + mpz_t bs; + unsigned long bsi, size_range; + ++ exit (77); /* skip */ + tests_start (); + TESTS_REPS (reps, argv, argc); -- cgit v1.2.3 From 14f8dae6b1e42cfd37678d64c137932b91656a41 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Oct 2015 11:30:41 +0200 Subject: gnu: python: Do not retain references to build tools. * gnu/packages/python.scm (python-2)[arguments]: Add 'do-not-record-configure-flags' and 'do-not-record-configure-flags-in-makefile' phases. --- gnu/packages/python.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index fd1a2d3601..05c1f504ef 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -174,6 +174,24 @@ "Lib/test/test_subprocess.py")) (("/bin/sh") (which "sh"))) #t)) + (add-before + 'install 'do-not-record-configure-flags + (lambda _ + ;; Remove configure flags from '_sysconfigdata.py' so we don't + ;; end up keeping references to the build tools. + (substitute* (find-files "." "sysconfigdata\\.py$") + (("'CONFIG_ARGS':.*") + "'CONFIG_ARGS': \"\",\n")) + #t)) + (add-after + 'install 'do-not-record-configure-flags-in-makefile + (lambda* (#:key outputs #:allow-other-keys) + ;; Likewise. + (let ((out (assoc-ref outputs "out"))) + (substitute* (find-files out "^Makefile$") + (("^CONFIG_ARGS[[:blank:]]*=.*$") + "CONFIG_ARGS =\n")) + #t))) (add-before 'check 'pre-check (lambda _ -- cgit v1.2.3 From 0d56e3e1bc7269c403c72ba265cec44d4757d1a1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Oct 2015 11:51:14 +0200 Subject: gnu: python-wrapper: Improve synopsis and description. * gnu/packages/python.scm (python-wrapper): Add 'synopsis' field; provide literal 'description' value. --- gnu/packages/python.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 05c1f504ef..08f5bca2c7 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -280,9 +280,12 @@ data types.") (string-append bin "/" new))) `("python3", "pydoc3", "idle3") `("python", "pydoc", "idle")))))) - (description (string-append (package-description python) - "\n\nThis wrapper package provides symbolic links to the python binaries - without version suffix.")))) + (synopsis "Wrapper for the Python 3 commands") + (description + "This package provides wrappers for the commands of Python@tie{}3.x such +that they can be invoked under their usual name---e.g., @command{python} +instead of @command{python3}."))) + (define-public python-psutil (package -- cgit v1.2.3 From 95288fcc6cfa184b500caa95062bf3194d255880 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Oct 2015 21:27:36 +0200 Subject: gnu: python: Add "minimal" variants. * gnu/packages/python.scm (python2-minimal, python-minimal): New variables. (wrap-python3): New procedure. (python-wrapper): Use it. (python-minimal-wrapper): New variable. * gnu/packages/xml.scm (libxslt)[native-inputs]: Use PYTHON-MINIMAL-WRAPPER instead of PYTHON-WRAPPER. * gnu/packages/xorg.scm (xcb-proto, libxcb, xorg-server): Likewise. --- gnu/packages/python.scm | 43 +++++++++++++++++++++++++++++++++++++++++-- gnu/packages/xml.scm | 2 +- gnu/packages/xorg.scm | 6 +++--- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 08f5bca2c7..bb4b385026 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -260,9 +260,46 @@ data types.") (version-major+minor version) "/site-packages")))))))) -(define-public python-wrapper +;; Minimal variants of Python, mostly used to break the cycle between Tk and +;; Python (Tk -> libxcb -> Python.) + +(define-public python2-minimal + (package (inherit python-2) + (name "python-minimal") + (arguments + (substitute-keyword-arguments (package-arguments python-2) + ((#:configure-flags _) + `(list "--enable-shared" + (string-append "LDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") "/lib"))))) + (inputs '()))) ;none of the optional dependencies + +(define-public python-minimal + (package (inherit python) + (name "python-minimal") + (arguments + (substitute-keyword-arguments (package-arguments python) + ((#:configure-flags _) + `(let ((openssl (assoc-ref %build-inputs "openssl")) + (zlib (assoc-ref %build-inputs "zlib")) + (out (assoc-ref %outputs "out"))) + (list "--enable-shared" + (string-append "CPPFLAGS=" + "-I" openssl "/include " + "-I" zlib "/include ") + (string-append "LDFLAGS=" + "-L" openssl "/lib " + "-L" zlib "/lib " + "-Wl,-rpath=" out "/lib")))))) + + ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib; + ;; zlib is required by 'zipimport', used by pip. + (inputs `(("openssl" ,openssl) + ("zlib" ,zlib))))) + +(define* (wrap-python3 python #:optional (name "python-wrapper")) (package (inherit python) - (name "python-wrapper") + (name name) (source #f) (build-system trivial-build-system) (propagated-inputs `(("python" ,python))) @@ -286,6 +323,8 @@ data types.") that they can be invoked under their usual name---e.g., @command{python} instead of @command{python3}."))) +(define-public python-wrapper (wrap-python3 python)) +(define-public python-minimal-wrapper (wrap-python3 python-minimal)) (define-public python-psutil (package diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm index 5d65648bfb..d9c92d6d93 100644 --- a/gnu/packages/xml.scm +++ b/gnu/packages/xml.scm @@ -135,7 +135,7 @@ project (but it is usable outside of the Gnome platform).") (synopsis "C library for applying XSLT stylesheets to XML documents") (inputs `(("libgcrypt" ,libgcrypt) ("libxml2" ,libxml2) - ("python" ,python-wrapper) + ("python" ,python-minimal-wrapper) ("zlib" ,zlib))) (description "Libxslt is an XSLT C library developed for the GNOME project. It is diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm index d4ed4b82d0..47dc0e2601 100644 --- a/gnu/packages/xorg.scm +++ b/gnu/packages/xorg.scm @@ -2050,7 +2050,7 @@ legacy X clients.") "0bp3f53l9fy5x3mn1rkj1g81aiyzl90wacwvqdgy831aa3kfxb5l")))) (build-system gnu-build-system) (native-inputs - `(("pkg-config" ,pkg-config) ("python" ,python-wrapper))) + `(("pkg-config" ,pkg-config) ("python" ,python-minimal-wrapper))) (home-page "http://www.x.org/wiki/") (synopsis "XML-XCB protocol descriptions") (description @@ -4804,7 +4804,7 @@ protocol.") ("libxslt" ,libxslt))) (native-inputs `(("pkg-config" ,pkg-config) - ("python" ,python-wrapper))) + ("python" ,python-minimal-wrapper))) (arguments `(#:configure-flags '("--enable-xkb"))) (home-page "http://www.x.org/wiki/") @@ -4889,7 +4889,7 @@ over Xlib, including: ("xtrans" ,xtrans) ("zlib" ,zlib))) (native-inputs - `(("python" ,python-wrapper) + `(("python" ,python-minimal-wrapper) ("pkg-config" ,pkg-config))) (arguments `(#:parallel-tests? #f -- cgit v1.2.3 From afa181fff435b4e549092c2639e8165069082755 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Oct 2015 21:31:45 +0200 Subject: gnu: python: Build the tkinter module. Fixes . Reported by Federico Beffa . * gnu/packages/python.scm (python-2)[arguments]: Pass --with-tcltk-includes and --with-tcltk-libs. [inputs]: Add TCL and TK. --- gnu/packages/python.scm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index bb4b385026..b512e77bbf 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -65,6 +65,7 @@ #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (gnu packages zip) + #:use-module (gnu packages tcl) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) @@ -138,9 +139,20 @@ (openssl (assoc-ref %build-inputs "openssl")) (readline (assoc-ref %build-inputs "readline")) (zlib (assoc-ref %build-inputs "zlib")) + (tk (assoc-ref %build-inputs "tk")) + (tcl (assoc-ref %build-inputs "tcl")) (out (assoc-ref %outputs "out"))) (list "--enable-shared" ; allow embedding "--with-system-ffi" ; build ctypes + + ;; configure/setup.py doesn't use pkg-config to find Tcl/Tk. + (string-append "--with-tcltk-includes=-I" tk "/include -I" + tcl "/include") + (string-append "--with-tcltk-libs=-L" tk "/lib -ltk" "" + ,(version-prefix (package-version tk) 2) + " -L" tcl "/lib -ltcl" + ,(version-prefix (package-version tcl) 2)) + (string-append "CPPFLAGS=" "-I" bz2 "/include " "-I" gdbm "/include " @@ -217,7 +229,9 @@ ("sqlite" ,sqlite) ; for sqlite extension ("openssl" ,openssl) ("readline" ,readline) - ("zlib" ,zlib))) + ("zlib" ,zlib) + ("tcl" ,tcl) + ("tk" ,tk))) ; for tkinter (native-inputs `(("pkg-config" ,pkg-config))) (native-search-paths @@ -225,8 +239,7 @@ (variable "PYTHONPATH") (files '("lib/python2.7/site-packages"))))) (home-page "http://python.org") - (synopsis - "High-level, dynamically-typed programming language") + (synopsis "High-level, dynamically-typed programming language") (description "Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains. Some of its key -- cgit v1.2.3 From 6a20289d5a38520fd79e80c256a0315c96a46347 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 8 Oct 2015 00:05:34 +0200 Subject: gnu: python: Simplify list of configure flags. * gnu/packages/patches/python-2.7-search-paths.patch, gnu/packages/patches/python-3-search-paths.patch: New files. * gnu-system.am (dist_patch_DATA): Add them. * gnu/packages/python.scm (python-2)[source]: Use first patch. [arguments]: Remove now unneeded CPPFLAGS and LDFLAGS. (python)[source]: Use second patch. (python-minimal)[arguments]: Remove CPPFLAGS and LDFLAGS. --- gnu-system.am | 2 + gnu/packages/patches/python-2.7-search-paths.patch | 16 ++++++ gnu/packages/patches/python-3-search-paths.patch | 19 +++++++ gnu/packages/python.scm | 66 +++++----------------- 4 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 gnu/packages/patches/python-2.7-search-paths.patch create mode 100644 gnu/packages/patches/python-3-search-paths.patch diff --git a/gnu-system.am b/gnu-system.am index cdae0ed1b9..b219d73cb7 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -604,6 +604,8 @@ dist_patch_DATA = \ gnu/packages/patches/pybugz-encode-error.patch \ gnu/packages/patches/pybugz-stty.patch \ gnu/packages/patches/pyqt-configure.patch \ + gnu/packages/patches/python-2.7-search-paths.patch \ + gnu/packages/patches/python-3-search-paths.patch \ gnu/packages/patches/python-disable-ssl-test.patch \ gnu/packages/patches/python-fix-tests.patch \ gnu/packages/patches/python2-rdflib-drop-sparqlwrapper.patch \ diff --git a/gnu/packages/patches/python-2.7-search-paths.patch b/gnu/packages/patches/python-2.7-search-paths.patch new file mode 100644 index 0000000000..6e5339f3a6 --- /dev/null +++ b/gnu/packages/patches/python-2.7-search-paths.patch @@ -0,0 +1,16 @@ +Make sure the build system honors CPATH and LIBRARY_PATH when looking for +headers and libraries. + +--- Python-2.7.10/setup.py 2015-10-07 18:33:18.125153186 +0200 ++++ Python-2.7.10/setup.py 2015-10-07 18:33:47.497347552 +0200 +@@ -526,6 +526,10 @@ class PyBuildExt(build_ext): + inc_dirs += ['/system/include', '/atheos/autolnk/include'] + inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) + ++ # Always honor these variables. ++ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) ++ inc_dirs += os.getenv('CPATH', '').split(os.pathsep) ++ + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if host_platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] diff --git a/gnu/packages/patches/python-3-search-paths.patch b/gnu/packages/patches/python-3-search-paths.patch new file mode 100644 index 0000000000..547feae1b9 --- /dev/null +++ b/gnu/packages/patches/python-3-search-paths.patch @@ -0,0 +1,19 @@ +Make sure the build system honors CPATH and LIBRARY_PATH when looking for +headers and libraries. + +--- setup.py 2015-10-07 23:32:58.891329173 +0200 ++++ setup.py 2015-10-07 23:46:29.653349924 +0200 +@@ -507,11 +507,8 @@ class PyBuildExt(build_ext): + # if a file is found in one of those directories, it can + # be assumed that no additional -I,-L directives are needed. + if not cross_compiling: +- lib_dirs = self.compiler.library_dirs + [ +- '/lib64', '/usr/lib64', +- '/lib', '/usr/lib', +- ] +- inc_dirs = self.compiler.include_dirs + ['/usr/include'] ++ lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep) ++ inc_dirs = os.getenv('CPATH', '').split(os.pathsep) + else: + lib_dirs = self.compiler.library_dirs[:] + inc_dirs = self.compiler.include_dirs[:] diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index b512e77bbf..5dea76f0bc 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -86,7 +86,8 @@ version "/Python-" version ".tar.xz")) (sha256 (base32 - "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw")))) + "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw")) + (patches (list (search-patch "python-2.7-search-paths.patch"))))) (build-system gnu-build-system) (arguments `(#:tests? #f @@ -132,43 +133,10 @@ ;; such file or directory #:test-target "test" #:configure-flags - (let ((bz2 (assoc-ref %build-inputs "bzip2")) - (gdbm (assoc-ref %build-inputs "gdbm")) - (libffi (assoc-ref %build-inputs "libffi")) - (sqlite (assoc-ref %build-inputs "sqlite")) - (openssl (assoc-ref %build-inputs "openssl")) - (readline (assoc-ref %build-inputs "readline")) - (zlib (assoc-ref %build-inputs "zlib")) - (tk (assoc-ref %build-inputs "tk")) - (tcl (assoc-ref %build-inputs "tcl")) - (out (assoc-ref %outputs "out"))) - (list "--enable-shared" ; allow embedding - "--with-system-ffi" ; build ctypes - - ;; configure/setup.py doesn't use pkg-config to find Tcl/Tk. - (string-append "--with-tcltk-includes=-I" tk "/include -I" - tcl "/include") - (string-append "--with-tcltk-libs=-L" tk "/lib -ltk" "" - ,(version-prefix (package-version tk) 2) - " -L" tcl "/lib -ltcl" - ,(version-prefix (package-version tcl) 2)) - - (string-append "CPPFLAGS=" - "-I" bz2 "/include " - "-I" gdbm "/include " - "-I" sqlite "/include " - "-I" openssl "/include " - "-I" readline "/include " - "-I" zlib "/include") - (string-append "LDFLAGS=" - "-L" bz2 "/lib " - "-L" gdbm "/lib " - "-L" libffi "/lib " - "-L" sqlite "/lib " - "-L" openssl "/lib " - "-L" readline "/lib " - "-L" zlib "/lib " - "-Wl,-rpath=" out "/lib"))) + (list "--enable-shared" ;allow embedding + "--with-system-ffi" ;build ctypes + (string-append "LDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") "/lib")) #:modules ((ice-9 ftw) ,@%gnu-build-system-modules) @@ -257,9 +225,11 @@ data types.") (method url-fetch) (uri (string-append "https://www.python.org/ftp/python/" version "/Python-" version ".tar.xz")) - (patches (list (search-patch "python-fix-tests.patch") - ;; XXX Try removing this patch for python > 3.4.3 - (search-patch "python-disable-ssl-test.patch"))) + (patches (map search-patch + '("python-fix-tests.patch" + ;; XXX Try removing this patch for python > 3.4.3 + "python-disable-ssl-test.patch" + "python-3-search-paths.patch"))) (patch-flags '("-p0")) (sha256 (base32 @@ -293,17 +263,9 @@ data types.") (arguments (substitute-keyword-arguments (package-arguments python) ((#:configure-flags _) - `(let ((openssl (assoc-ref %build-inputs "openssl")) - (zlib (assoc-ref %build-inputs "zlib")) - (out (assoc-ref %outputs "out"))) - (list "--enable-shared" - (string-append "CPPFLAGS=" - "-I" openssl "/include " - "-I" zlib "/include ") - (string-append "LDFLAGS=" - "-L" openssl "/lib " - "-L" zlib "/lib " - "-Wl,-rpath=" out "/lib")))))) + `(list "--enable-shared" + (string-append "LDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") "/lib"))))) ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib; ;; zlib is required by 'zipimport', used by pip. -- cgit v1.2.3 From 9511de1ef8c59788f2c93ae6b0cb1e87e30824ab Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Wed, 7 Oct 2015 21:49:03 -0400 Subject: gnu: gdk-pixbuf: Update to 2.32.1. * gnu/packages/gtk.scm (gdk-pixbuf): Update to 2.32.1. --- gnu/packages/gtk.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm index a44c2dd3fe..a01e6d0dd3 100644 --- a/gnu/packages/gtk.scm +++ b/gnu/packages/gtk.scm @@ -332,7 +332,7 @@ printing and other features typical of a source code editor.") (define-public gdk-pixbuf (package (name "gdk-pixbuf") - (version "2.31.6") + (version "2.32.1") (source (origin (method url-fetch) (uri (string-append "mirror://gnome/sources/" name "/" @@ -340,7 +340,7 @@ printing and other features typical of a source code editor.") name "-" version ".tar.xz")) (sha256 (base32 - "062x2gqd7p6yxhxlib1ha4l3gk9ihcj080hrwwv9vmlmybb064hi")))) + "1g7kjxv67jcdasi14n7jan4icrnnppd1m99wrdmpv32k4m7vfcj4")))) (build-system gnu-build-system) (arguments '(#:configure-flags '("--with-x11") -- cgit v1.2.3 From 9765b3aeac88ae9c9ffc38ed6d1f8dcbd9abca7b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 8 Oct 2015 17:58:06 +0200 Subject: Revert "gnu: python: Do not retain references to build tools." This reverts commit 14f8dae6b1e42cfd37678d64c137932b91656a41, which was unintentionally pushed (it does not work with Python 3.) --- gnu/packages/python.scm | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 166e8d4944..ee9173b570 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -155,24 +155,6 @@ "Lib/test/test_subprocess.py")) (("/bin/sh") (which "sh"))) #t)) - (add-before - 'install 'do-not-record-configure-flags - (lambda _ - ;; Remove configure flags from '_sysconfigdata.py' so we don't - ;; end up keeping references to the build tools. - (substitute* (find-files "." "sysconfigdata\\.py$") - (("'CONFIG_ARGS':.*") - "'CONFIG_ARGS': \"\",\n")) - #t)) - (add-after - 'install 'do-not-record-configure-flags-in-makefile - (lambda* (#:key outputs #:allow-other-keys) - ;; Likewise. - (let ((out (assoc-ref outputs "out"))) - (substitute* (find-files out "^Makefile$") - (("^CONFIG_ARGS[[:blank:]]*=.*$") - "CONFIG_ARGS =\n")) - #t))) (add-before 'check 'pre-check (lambda _ -- cgit v1.2.3