diff options
author | Marius Bakke <marius@gnu.org> | 2020-05-26 22:30:51 +0200 |
---|---|---|
committer | Marius Bakke <marius@gnu.org> | 2020-05-26 22:30:51 +0200 |
commit | 9edb3f66fd807b096b48283debdcddccfea34bad (patch) | |
tree | cfd86f44ad51df4341a0d48cf4978117e11d7f59 /guix/derivations.scm | |
parent | e5f95fd897ad32c93bb48ceae30021976a917979 (diff) | |
parent | b6d18fbdf6ab4a8821a58aa16587676e835001f2 (diff) |
Merge branch 'master' into staging
Diffstat (limited to 'guix/derivations.scm')
-rw-r--r-- | guix/derivations.scm | 59 |
1 files changed, 12 insertions, 47 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index f6d6f7db25..7db61d272f 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -1105,39 +1105,13 @@ recursively." (string-tokenize (dirname file-name) not-slash)))))) (define* (imported-files store files ;deprecated - #:key (name "file-import") - (system (%current-system)) - (guile (%guile-for-build))) - "Return a derivation that imports FILES into STORE. FILES must be a list + #:key (name "file-import")) + "Return a store item that contains FILES. FILES must be a list of (FINAL-PATH . FILE-NAME) pairs; each FILE-NAME is read from the file system, imported, and appears under FINAL-PATH in the resulting store path." - (let* ((files (map (match-lambda - ((final-path . file-name) - (list final-path - (add-to-store store (basename final-path) #f - "sha256" file-name)))) - files)) - (builder - `(begin - (mkdir %output) (chdir %output) - ,@(append-map (match-lambda - ((final-path store-path) - (append (match (parent-directories final-path) - (() '()) - ((head ... tail) - (append (map (lambda (d) - `(false-if-exception - (mkdir ,d))) - head) - `((or (file-exists? ,tail) - (mkdir ,tail)))))) - `((symlink ,store-path ,final-path))))) - files)))) - (build-expression->derivation store name builder - #:system system - #:inputs files - #:guile-for-build guile - #:local-build? #t))) + (add-file-tree-to-store store + `(,name directory + ,@(file-mapping->tree files)))) ;; The "file not found" error condition. (define-condition-type &file-search-error &error @@ -1164,10 +1138,8 @@ of symbols.)" (define* (%imported-modules store modules ;deprecated #:key (name "module-import") - (system (%current-system)) - (guile (%guile-for-build)) (module-path %load-path)) - "Return a derivation that contains the source files of MODULES, a list of + "Return a store item that contains the source files of MODULES, a list of module names such as `(ice-9 q)'. All of MODULES must be in the MODULE-PATH search path." ;; TODO: Determine the closure of MODULES, build the `.go' files, @@ -1176,8 +1148,7 @@ search path." (let ((f (module->source-file-name m))) (cons f (search-path* module-path f)))) modules))) - (imported-files store files #:name name #:system system - #:guile guile))) + (imported-files store files #:name name))) (define* (%compiled-modules store modules ;deprecated #:key (name "module-import-compiled") @@ -1187,11 +1158,8 @@ search path." "Return a derivation that builds a tree containing the `.go' files corresponding to MODULES. All the MODULES are built in a context where they can refer to each other." - (let* ((module-drv (%imported-modules store modules - #:system system - #:guile guile + (let* ((module-dir (%imported-modules store modules #:module-path module-path)) - (module-dir (derivation->output-path module-drv)) (files (map (lambda (m) (let ((f (string-join (map symbol->string m) "/"))) @@ -1222,7 +1190,7 @@ they can refer to each other." files))) (build-expression->derivation store name builder - #:inputs `(("modules" ,module-drv)) + #:inputs `(("modules" ,module-dir)) #:system system #:guile-for-build guile #:local-build? #t))) @@ -1240,8 +1208,7 @@ MODULES are compiled." (list modules (derivation-file-name guile) system)) (or (hash-ref %module-cache key) - (let ((result (cons (%imported-modules store modules - #:system system #:guile guile) + (let ((result (cons (%imported-modules store modules) (%compiled-modules store modules #:system system #:guile guile)))) (hash-set! %module-cache key result) @@ -1375,10 +1342,8 @@ and PROPERTIES." #:guile guile-drv #:system system) '(#f . #f))) - (mod-drv (car mod+go-drv)) + (mod-dir (car mod+go-drv)) (go-drv (cdr mod+go-drv)) - (mod-dir (and mod-drv - (derivation->output-path mod-drv))) (go-dir (and go-drv (derivation->output-path go-drv)))) (derivation store name guile @@ -1395,7 +1360,7 @@ and PROPERTIES." #:inputs `((,(or guile-for-build (%guile-for-build))) (,builder) ,@(map cdr inputs) - ,@(if mod-drv `((,mod-drv) (,go-drv)) '())) + ,@(if mod-dir `((,mod-dir) (,go-drv)) '())) ;; When MODULES is non-empty, shamelessly clobber ;; $GUILE_LOAD_COMPILED_PATH. |