summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-04-23 13:33:09 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-04-23 13:33:09 +0200
commit030f6f489fe9544f35ebaf95135acd1dd67ce63f (patch)
treef1d5d1f1b68de81daec6f05d032a0410a475d960 /guix
parent95c14929a7fbd3c55c5e8756953c2f257625e2b7 (diff)
parent938df0de739aa13c2fb483f440ec1db281a52aaa (diff)
downloadpatches-030f6f489fe9544f35ebaf95135acd1dd67ce63f.tar
patches-030f6f489fe9544f35ebaf95135acd1dd67ce63f.tar.gz
Merge branch 'master' into core-updates
Conflicts: etc/news.scm gnu/local.mk gnu/packages/bootloaders.scm gnu/packages/linphone.scm gnu/packages/linux.scm gnu/packages/tls.scm gnu/system.scm
Diffstat (limited to 'guix')
-rw-r--r--guix/build/syscalls.scm3
-rw-r--r--guix/gexp.scm12
-rw-r--r--guix/git-download.scm10
-rw-r--r--guix/packages.scm6
-rw-r--r--guix/profiles.scm3
-rw-r--r--guix/self.scm110
6 files changed, 92 insertions, 52 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 7ef03417c1..73b439fb7d 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -943,7 +944,7 @@ system to PUT-OLD."
(define readdir*
;; Decide at run time which one must be used.
- (if (string-suffix? "linux-gnu" %host-type)
+ (if (string-contains %host-type "linux-gnu")
(readdir-procedure (c-struct-field-offset %struct-dirent-header/linux
name)
sizeof-dirent-header/linux
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 2dea793685..2a4b36519c 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -472,24 +472,26 @@ This is the declarative counterpart of 'gexp->script'."
#:target target))))
(define-record-type <scheme-file>
- (%scheme-file name gexp splice?)
+ (%scheme-file name gexp splice? load-path?)
scheme-file?
(name scheme-file-name) ;string
(gexp scheme-file-gexp) ;gexp
- (splice? scheme-file-splice?)) ;Boolean
+ (splice? scheme-file-splice?) ;Boolean
+ (load-path? scheme-file-set-load-path?)) ;Boolean
-(define* (scheme-file name gexp #:key splice?)
+(define* (scheme-file name gexp #:key splice? (set-load-path? #t))
"Return an object representing the Scheme file NAME that contains GEXP.
This is the declarative counterpart of 'gexp->file'."
- (%scheme-file name gexp splice?))
+ (%scheme-file name gexp splice? set-load-path?))
(define-gexp-compiler (scheme-file-compiler (file <scheme-file>)
system target)
;; Compile FILE by returning a derivation that builds the file.
(match file
- (($ <scheme-file> name gexp splice?)
+ (($ <scheme-file> name gexp splice? set-load-path?)
(gexp->file name gexp
+ #:set-load-path? set-load-path?
#:splice? splice?
#:system system
#:target target))))
diff --git a/guix/git-download.scm b/guix/git-download.scm
index 1eae035fc4..ef0bb2e281 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -30,6 +31,8 @@
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-34)
+ #:use-module (srfi srfi-35)
#:export (git-reference
git-reference?
git-reference-url
@@ -170,6 +173,13 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
(define (git-version version revision commit)
"Return the version string for packages using git-download."
+ ;; git-version is almost exclusively executed while modules are being loaded.
+ ;; This makes any errors hide their backtrace. Avoid the mysterious error
+ ;; "Value out of range 0 to N: 7" when the commit ID is too short, which
+ ;; can happen, for example, when the user swapped the revision and commit
+ ;; arguments by mistake.
+ (when (< (string-length commit) 7)
+ (error "git-version: commit ID unexpectedly short"))
(string-append version "-" revision "." (string-take commit 7)))
(define (git-file-name name version)
diff --git a/guix/packages.scm b/guix/packages.scm
index 58078c75c0..9fdc679f9a 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1342,7 +1342,11 @@ code of derivations to GUILE, a package object."
"Return as a monadic value the absolute file name of FILE within the
OUTPUT directory of PACKAGE. When FILE is omitted, return the name of the
OUTPUT directory of PACKAGE. When TARGET is true, use it as a
-cross-compilation target triplet."
+cross-compilation target triplet.
+
+Note that this procedure does _not_ build PACKAGE. Thus, the result might or
+might not designate an existing file. We recommend not using this procedure
+unless you know what you are doing."
(lambda (store)
(define compute-derivation
(if target
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 7bcf4e3172..fbadf41284 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1549,6 +1549,7 @@ MANIFEST."
(define* (profile-derivation manifest
#:key
+ (name "profile")
(hooks %default-profile-hooks)
(locales? #t)
(allow-collisions? #f)
@@ -1638,7 +1639,7 @@ are cross-built for TARGET."
#:manifest '#$(manifest->gexp manifest)
#:search-paths search-paths))))
- (gexp->derivation "profile" builder
+ (gexp->derivation name builder
#:system system
#:target target
diff --git a/guix/self.scm b/guix/self.scm
index 905f931aeb..a9568049b2 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -339,43 +339,61 @@ TRANSLATIONS, an alist of msgid and msgstr."
#f regexp1 content 'pre "ref{" msgstr "," 'post)
'pre "ref{" msgstr "}" 'post))))))
content translations))
-
- (define (translate-texi po lang)
- "Translate the manual for one language LANG using the PO file."
+
+ (define* (translate-texi prefix po lang
+ #:key (extras '()))
+ "Translate the manual for one language LANG using the PO file.
+PREFIX must be the prefix of the manual, 'guix' or 'guix-cookbook'. EXTRAS is
+a list of extra files, such as '(\"contributing\")."
(let ((translations (call-with-input-file po read-po-file)))
- (translate-tmp-texi po "guix.texi"
- (string-append "guix." lang ".texi.tmp"))
- (translate-tmp-texi po "contributing.texi"
- (string-append "contributing." lang ".texi.tmp"))
- (let* ((texi-name (string-append "guix." lang ".texi"))
- (tmp-name (string-append texi-name ".tmp")))
- (with-output-to-file texi-name
- (lambda _
- (format #t "~a"
- (translate-cross-references
- (call-with-input-file tmp-name get-string-all)
- translations)))))
- (let* ((texi-name (string-append "contributing." lang ".texi"))
- (tmp-name (string-append texi-name ".tmp")))
- (with-output-to-file texi-name
- (lambda _
- (format #t "~a"
- (translate-cross-references
- (call-with-input-file tmp-name get-string-all)
- translations)))))))
-
- (for-each (lambda (po)
- (match (reverse (string-split po #\.))
- ((_ lang _ ...)
- (translate-texi po lang))))
- (find-files "." "^guix-manual\\.[a-z]{2}(_[A-Z]{2})?\\.po$"))
+ (for-each (lambda (file)
+ (translate-tmp-texi po (string-append file ".texi")
+ (string-append file "." lang
+ ".texi.tmp")))
+ (cons prefix extras))
+
+ (for-each (lambda (file)
+ (let* ((texi (string-append file "." lang ".texi"))
+ (tmp (string-append texi ".tmp")))
+ (with-output-to-file texi
+ (lambda ()
+ (display
+ (translate-cross-references
+ (call-with-input-file tmp get-string-all)
+ translations))))))
+ (cons prefix extras))))
+
+ (define (available-translations directory domain)
+ ;; Return the list of available translations under DIRECTORY for
+ ;; DOMAIN, a gettext domain such as "guix-manual". The result is
+ ;; a list of language/PO file pairs.
+ (filter-map (lambda (po)
+ (let ((base (basename po)))
+ (and (string-prefix? (string-append domain ".")
+ base)
+ (match (string-split base #\.)
+ ((_ ... lang "po")
+ (cons lang po))))))
+ (find-files directory
+ "\\.[a-z]{2}(_[A-Z]{2})?\\.po$")))
+
+ (for-each (match-lambda
+ ((language . po)
+ (translate-texi "guix" po language
+ #:extras '("contributing"))))
+ (available-translations "." "guix-manual"))
+
+ (for-each (match-lambda
+ ((language . po)
+ (translate-texi "guix-cookbook" po language)))
+ (available-translations "." "guix-cookbook"))
- (for-each
- (lambda (file)
- (copy-file file (string-append #$output "/" file)))
- (append
- (find-files "." "contributing\\..*\\.texi$")
- (find-files "." "guix\\..*\\.texi$"))))))
+ (for-each (lambda (file)
+ (install-file file #$output))
+ (append
+ (find-files "." "contributing\\..*\\.texi$")
+ (find-files "." "guix\\..*\\.texi$")
+ (find-files "." "guix-cookbook\\..*\\.texi$"))))))
(computed-file "guix-translated-texinfo" build))
@@ -402,7 +420,8 @@ TRANSLATIONS, an alist of msgid and msgstr."
(define build
(with-imported-modules '((guix build utils))
#~(begin
- (use-modules (guix build utils))
+ (use-modules (guix build utils)
+ (ice-9 match))
(mkdir #$output)
@@ -463,13 +482,13 @@ TRANSLATIONS, an alist of msgid and msgstr."
#+(file-append glibc-utf8-locales "/lib/locale"))
(for-each (lambda (texi)
- (unless (string=? "guix.texi" texi)
- ;; Create 'version-LL.texi'.
- (let* ((base (basename texi ".texi"))
- (dot (string-index base #\.))
- (tag (string-drop base (+ 1 dot))))
- (symlink "version.texi"
- (string-append "version-" tag ".texi"))))
+ (match (string-split (basename texi) #\.)
+ (("guix" language "texi")
+ ;; Create 'version-LL.texi'.
+ (symlink "version.texi"
+ (string-append "version-" language
+ ".texi")))
+ (_ #f))
(invoke #+(file-append texinfo "/bin/makeinfo")
texi "-I" #$documentation
@@ -478,7 +497,10 @@ TRANSLATIONS, an alist of msgid and msgstr."
(basename texi ".texi")
".info")))
(cons "guix.texi"
- (find-files "." "^guix\\.[a-z]{2}(_[A-Z]{2})?\\.texi$")))
+ (append (find-files "."
+ "^guix\\.[a-z]{2}(_[A-Z]{2})?\\.texi$")
+ (find-files "."
+ "^guix-cookbook.*\\.texi$"))))
;; Compress Info files.
(setenv "PATH"