From 6cf502d164a47fa38e2fa63972409e97c06c288c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 6 Nov 2018 09:35:06 +0100 Subject: 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. --- guix/self.scm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'guix/self.scm') diff --git a/guix/self.scm b/guix/self.scm index 4548e6c044..43223972c6 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -206,21 +206,22 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'." (local-file file #:recursive? #t))) (find-files (string-append directory "/" sub-directory) pred))) -(define* (sub-directory item sub-directory) - "Return SUB-DIRECTORY within ITEM, which may be a file name or a file-like -object." +(define* (file-append* item file #:key (recursive? #t)) + "Return FILE within ITEM, which may be a file name or a file-like object. +When ITEM is a plain file name (a string), simply return a 'local-file' +record with the new file name." (match item ((? string?) ;; This is the optimal case: we return a new "source". Thus, a ;; derivation that depends on this sub-directory does not depend on ITEM ;; itself. - (local-file (string-append item "/" sub-directory) - #:recursive? #t)) + (local-file (string-append item "/" file) + #:recursive? recursive?)) ;; TODO: Add 'local-file?' case. (_ ;; In this case, anything that refers to the result also depends on ITEM, ;; which isn't great. - (file-append item "/" sub-directory)))) + (file-append item "/" file)))) (define* (locale-data source domain #:optional (directory domain)) @@ -238,7 +239,7 @@ DOMAIN, a gettext domain." (ice-9 match) (ice-9 ftw)) (define po-directory - #+(sub-directory source (string-append "po/" directory))) + #+(file-append* source (string-append "po/" directory))) (define (compile language) (let ((gmo (string-append #$output "/" language "/LC_MESSAGES/" @@ -273,10 +274,10 @@ DOMAIN, a gettext domain." 'graphviz)) (define documentation - (sub-directory source "doc")) + (file-append* source "doc")) (define examples - (sub-directory source "gnu/system/examples")) + (file-append* source "gnu/system/examples")) (define build (with-imported-modules '((guix build utils)) @@ -674,8 +675,8 @@ assumed to be part of MODULES." 'guix-daemon) #:info (info-manual source) - #:substitute-keys (sub-directory source - "etc/substitutes") + #:substitute-keys (file-append* source + "etc/substitutes") #:guile-version guile-version))) ((= 0 pull-version) ;; Legacy 'guix pull': return the .scm and .go files as one -- cgit v1.2.3