summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-07-04 10:52:59 +0200
committerLudovic Courtès <ludo@gnu.org>2018-07-04 10:52:59 +0200
commit5b0c648a7c5ac3d827bb6fc61b3b2037a2d4b62c (patch)
tree4726b6b2676dff310054e520b57cb9b010abaf9a
parenta51cf16031c974ffa238e5dd9ced32f0d68c9227 (diff)
profiles: 'info-dir-file' hook now produces 'dir.LANG' files.
Previously, entries for 'guix.fr.info' would end up in 'dir', above the 'guix.info' entries; consequently, running 'info guix' would actually open 'guix.fr.info', which was confusing for non-French readers. * guix/profiles.scm (info-dir-file)[glibc-utf8-locales]: New variable. [build](info-file-language): New procedure. (install-info): Use it, to create 'dir.LANG' files. Set GUIX_LOCPATH.
-rw-r--r--guix/profiles.scm30
1 files changed, 26 insertions, 4 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index ebd7da2a242..e6b77e8d38b 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -703,6 +703,8 @@ MANIFEST."
703 (module-ref (resolve-interface '(gnu packages texinfo)) 'texinfo)) 703 (module-ref (resolve-interface '(gnu packages texinfo)) 'texinfo))
704 (define gzip ;lazy reference 704 (define gzip ;lazy reference
705 (module-ref (resolve-interface '(gnu packages compression)) 'gzip)) 705 (module-ref (resolve-interface '(gnu packages compression)) 'gzip))
706 (define glibc-utf8-locales ;lazy reference
707 (module-ref (resolve-interface '(gnu packages base)) 'glibc-utf8-locales))
706 708
707 (define build 709 (define build
708 (with-imported-modules '((guix build utils)) 710 (with-imported-modules '((guix build utils))
@@ -720,11 +722,31 @@ MANIFEST."
720 (map (cut string-append infodir "/" <>) 722 (map (cut string-append infodir "/" <>)
721 (or (scandir infodir info-file?) '())))) 723 (or (scandir infodir info-file?) '()))))
722 724
725 (define (info-file-language file)
726 (let* ((base (if (string-suffix? ".gz" file)
727 (basename file ".info.gz")
728 (basename file ".info")))
729 (dot (string-rindex base #\.)))
730 (if dot
731 (string-drop base (+ 1 dot))
732 "en")))
733
723 (define (install-info info) 734 (define (install-info info)
724 (setenv "PATH" (string-append #+gzip "/bin")) ;for info.gz files 735 (let ((language (info-file-language info)))
725 (zero? 736 ;; We need to choose a valid locale for $LANGUAGE to be honored.
726 (system* (string-append #+texinfo "/bin/install-info") "--silent" 737 (setenv "LC_ALL" "en_US.utf8")
727 info (string-append #$output "/share/info/dir")))) 738 (setenv "LANGUAGE" language)
739 (zero?
740 (system* #+(file-append texinfo "/bin/install-info")
741 "--silent" info
742 (apply string-append #$output "/share/info/dir"
743 (if (string=? "en" language)
744 '("")
745 `("." ,language)))))))
746
747 (setenv "PATH" (string-append #+gzip "/bin")) ;for info.gz files
748 (setenv "GUIX_LOCPATH"
749 #+(file-append glibc-utf8-locales "/lib/locale"))
728 750
729 (mkdir-p (string-append #$output "/share/info")) 751 (mkdir-p (string-append #$output "/share/info"))
730 (exit (every install-info 752 (exit (every install-info