From a9ebd9efd0d97159acbec848ad5fe06f022c8235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 30 Jan 2013 16:30:49 +0100 Subject: [PATCH] store: Remove the `fixed?' parameter from `add-to-store'. * guix/store.scm (add-to-store): Remove the `fixed?' parameter from the public interface. * gnu/packages/bootstrap.scm, guix-download.in, guix/derivations.scm, guix/packages.scm, tests/derivations.scm: Update all callers accordingly. --- gnu/packages/bootstrap.scm | 2 +- guix-download.in | 4 ++-- guix/derivations.scm | 4 ++-- guix/packages.scm | 3 +-- guix/store.scm | 11 +++++++---- tests/derivations.scm | 8 ++++---- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index b0ab70abbc..22ee98879a 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -154,7 +154,7 @@ check whether everything is alright." (description "Raw build system with direct store access") (build (lambda* (store name source inputs #:key outputs system) (define (->store file) - (add-to-store store file #t #t "sha256" + (add-to-store store file #t "sha256" (or (search-bootstrap-binary file system) (error "bootstrap binary not found" diff --git a/guix-download.in b/guix-download.in index 4b814699ca..ea62b09a7b 100644 --- a/guix-download.in +++ b/guix-download.in @@ -68,7 +68,7 @@ store path." (fetch temp)))) (close port) (and result - (add-to-store store name #t #f "sha256" temp)))))) + (add-to-store store name #f "sha256" temp)))))) ;;; ;;; Command-line options. @@ -148,7 +148,7 @@ and the hash of its contents.\n")) (path (case (uri-scheme uri) ((file) (add-to-store store (basename (uri-path uri)) - #t #f "sha256" (uri-path uri))) + #f "sha256" (uri-path uri))) (else (fetch-and-store store (cut url-fetch arg <> diff --git a/guix/derivations.scm b/guix/derivations.scm index a36a6559b4..6f73534c3c 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -458,7 +458,7 @@ known in advance, such as a file download." ((input . _) (let ((path (add-to-store store (basename input) - #t #t "sha256" input))) + #t "sha256" input))) (make-derivation-input path '())))) (delete-duplicates inputs))) (env-vars (env-vars-with-empty-outputs)) @@ -519,7 +519,7 @@ 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) #t #f + (add-to-store store (basename final-path) #f "sha256" file-name)))) files)) (builder diff --git a/guix/packages.scm b/guix/packages.scm index f1cd83c7e4..4d3b499bf4 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -248,8 +248,7 @@ PACKAGE for SYSTEM." (define (intern file) ;; Add FILE to the store. Set the `recursive?' bit to #t, so that ;; file permissions are preserved. - (add-to-store store (basename file) - #t #t "sha256" file)) + (add-to-store store (basename file) #t "sha256" file)) (define expand-input ;; Expand the given input tuple such that it contains only diff --git a/guix/store.scm b/guix/store.scm index a9126cb0b6..7b1da34678 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -496,14 +496,17 @@ path." (file file-name)) #f store-path))) - (lambda (server basename fixed? recursive? hash-algo file-name) - "Add the contents of FILE-NAME under BASENAME to the store. Note that -FIXED? is for backward compatibility with old Nix versions and must be #t." + (lambda (server basename recursive? hash-algo file-name) + "Add the contents of FILE-NAME under BASENAME to the store. When +RECURSIVE? is true and FILE-NAME designates a directory, the contents of +FILE-NAME are added recursively; if FILE-NAME designates a flat file and +RECURSIVE? is true, its contents are added, and its permission bits are +kept. HASH-ALGO must be a string such as \"sha256\"." (let* ((st (stat file-name #f)) (args `(,basename ,recursive? ,hash-algo ,st)) (cache (nix-server-add-to-store-cache server))) (or (and st (hash-ref cache args)) - (let ((path (add-to-store server basename fixed? recursive? + (let ((path (add-to-store server basename #t recursive? hash-algo file-name))) (hash-set! cache args path) path)))))) diff --git a/tests/derivations.scm b/tests/derivations.scm index 83c8d444d7..314942a352 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -51,7 +51,7 @@ (define %bash (let ((bash (search-bootstrap-binary "bash" (%current-system)))) (and %store - (add-to-store %store "bash" #t #t "sha256" bash)))) + (add-to-store %store "bash" #t "sha256" bash)))) (define (directory-contents dir) "Return an alist representing the contents of DIR." @@ -86,7 +86,7 @@ (test-assert "add-to-store, flat" (let* ((file (search-path %load-path "language/tree-il/spec.scm")) - (drv (add-to-store %store "flat-test" #t #f "sha256" file))) + (drv (add-to-store %store "flat-test" #f "sha256" file))) (and (eq? 'regular (stat:type (stat drv))) (valid-path? %store drv) (equal? (call-with-input-file file get-bytevector-all) @@ -94,7 +94,7 @@ (test-assert "add-to-store, recursive" (let* ((dir (dirname (search-path %load-path "language/tree-il/spec.scm"))) - (drv (add-to-store %store "dir-tree-test" #t #t "sha256" dir))) + (drv (add-to-store %store "dir-tree-test" #t "sha256" dir))) (and (eq? 'directory (stat:type (stat drv))) (valid-path? %store drv) (equal? (directory-contents dir) @@ -145,7 +145,7 @@ ;; name to the builder. . ,(add-to-store %store (basename input) - #t #t "sha256" + #t "sha256" input))) `((,builder) (,input))))) ; ← local file name