Archived
1
0
Fork 0

self: Rename 'sub-directory' to 'file-append*'.

* guix/self.scm (sub-directory): Rename to...
(file-append*): ... this.  Add #:recursive? parameter and pass it to
'local-file'.
(locale-data, info-manual, compiled-guix): Adjust accordingly.
This commit is contained in:
Ludovic Courtès 2018-11-06 09:35:06 +01:00
parent 3527f600b5
commit 6cf502d164
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -206,21 +206,22 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'."
(local-file file #:recursive? #t))) (local-file file #:recursive? #t)))
(find-files (string-append directory "/" sub-directory) pred))) (find-files (string-append directory "/" sub-directory) pred)))
(define* (sub-directory item sub-directory) (define* (file-append* item file #:key (recursive? #t))
"Return SUB-DIRECTORY within ITEM, which may be a file name or a file-like "Return FILE within ITEM, which may be a file name or a file-like object.
object." When ITEM is a plain file name (a string), simply return a 'local-file'
record with the new file name."
(match item (match item
((? string?) ((? string?)
;; This is the optimal case: we return a new "source". Thus, a ;; This is the optimal case: we return a new "source". Thus, a
;; derivation that depends on this sub-directory does not depend on ITEM ;; derivation that depends on this sub-directory does not depend on ITEM
;; itself. ;; itself.
(local-file (string-append item "/" sub-directory) (local-file (string-append item "/" file)
#:recursive? #t)) #:recursive? recursive?))
;; TODO: Add 'local-file?' case. ;; TODO: Add 'local-file?' case.
(_ (_
;; In this case, anything that refers to the result also depends on ITEM, ;; In this case, anything that refers to the result also depends on ITEM,
;; which isn't great. ;; which isn't great.
(file-append item "/" sub-directory)))) (file-append item "/" file))))
(define* (locale-data source domain (define* (locale-data source domain
#:optional (directory domain)) #:optional (directory domain))
@ -238,7 +239,7 @@ DOMAIN, a gettext domain."
(ice-9 match) (ice-9 ftw)) (ice-9 match) (ice-9 ftw))
(define po-directory (define po-directory
#+(sub-directory source (string-append "po/" directory))) #+(file-append* source (string-append "po/" directory)))
(define (compile language) (define (compile language)
(let ((gmo (string-append #$output "/" language "/LC_MESSAGES/" (let ((gmo (string-append #$output "/" language "/LC_MESSAGES/"
@ -273,10 +274,10 @@ DOMAIN, a gettext domain."
'graphviz)) 'graphviz))
(define documentation (define documentation
(sub-directory source "doc")) (file-append* source "doc"))
(define examples (define examples
(sub-directory source "gnu/system/examples")) (file-append* source "gnu/system/examples"))
(define build (define build
(with-imported-modules '((guix build utils)) (with-imported-modules '((guix build utils))
@ -674,7 +675,7 @@ assumed to be part of MODULES."
'guix-daemon) 'guix-daemon)
#:info (info-manual source) #:info (info-manual source)
#:substitute-keys (sub-directory source #:substitute-keys (file-append* source
"etc/substitutes") "etc/substitutes")
#:guile-version guile-version))) #:guile-version guile-version)))
((= 0 pull-version) ((= 0 pull-version)