guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ludovic Courtès
Subject: 02/05: self: Rename 'sub-directory' to 'file-append*'.
Date: Tue, 6 Nov 2018 11:00:10 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 6cf502d164a47fa38e2fa63972409e97c06c288c
Author: Ludovic Courtès <address@hidden>
Date:   Tue Nov 6 09:35:06 2018 +0100

    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(-)

diff --git a/guix/self.scm b/guix/self.scm
index 4548e6c..4322397 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]