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.
This commit is contained in:
Ludovic Courtès 2013-01-30 16:30:49 +01:00
parent fd060fd30d
commit a9ebd9efd0
6 changed files with 17 additions and 15 deletions

View File

@ -154,7 +154,7 @@ check whether everything is alright."
(description "Raw build system with direct store access") (description "Raw build system with direct store access")
(build (lambda* (store name source inputs #:key outputs system) (build (lambda* (store name source inputs #:key outputs system)
(define (->store file) (define (->store file)
(add-to-store store file #t #t "sha256" (add-to-store store file #t "sha256"
(or (search-bootstrap-binary file (or (search-bootstrap-binary file
system) system)
(error "bootstrap binary not found" (error "bootstrap binary not found"

View File

@ -68,7 +68,7 @@ store path."
(fetch temp)))) (fetch temp))))
(close port) (close port)
(and result (and result
(add-to-store store name #t #f "sha256" temp)))))) (add-to-store store name #f "sha256" temp))))))
;;; ;;;
;;; Command-line options. ;;; Command-line options.
@ -148,7 +148,7 @@ and the hash of its contents.\n"))
(path (case (uri-scheme uri) (path (case (uri-scheme uri)
((file) ((file)
(add-to-store store (basename (uri-path uri)) (add-to-store store (basename (uri-path uri))
#t #f "sha256" (uri-path uri))) #f "sha256" (uri-path uri)))
(else (else
(fetch-and-store store (fetch-and-store store
(cut url-fetch arg <> (cut url-fetch arg <>

View File

@ -458,7 +458,7 @@ known in advance, such as a file download."
((input . _) ((input . _)
(let ((path (add-to-store store (let ((path (add-to-store store
(basename input) (basename input)
#t #t "sha256" input))) #t "sha256" input)))
(make-derivation-input path '())))) (make-derivation-input path '()))))
(delete-duplicates inputs))) (delete-duplicates inputs)))
(env-vars (env-vars-with-empty-outputs)) (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 (let* ((files (map (match-lambda
((final-path . file-name) ((final-path . file-name)
(list final-path (list final-path
(add-to-store store (basename final-path) #t #f (add-to-store store (basename final-path) #f
"sha256" file-name)))) "sha256" file-name))))
files)) files))
(builder (builder

View File

@ -248,8 +248,7 @@ PACKAGE for SYSTEM."
(define (intern file) (define (intern file)
;; Add FILE to the store. Set the `recursive?' bit to #t, so that ;; Add FILE to the store. Set the `recursive?' bit to #t, so that
;; file permissions are preserved. ;; file permissions are preserved.
(add-to-store store (basename file) (add-to-store store (basename file) #t "sha256" file))
#t #t "sha256" file))
(define expand-input (define expand-input
;; Expand the given input tuple such that it contains only ;; Expand the given input tuple such that it contains only

View File

@ -496,14 +496,17 @@ path."
(file file-name)) (file file-name))
#f #f
store-path))) store-path)))
(lambda (server basename fixed? recursive? hash-algo file-name) (lambda (server basename recursive? hash-algo file-name)
"Add the contents of FILE-NAME under BASENAME to the store. Note that "Add the contents of FILE-NAME under BASENAME to the store. When
FIXED? is for backward compatibility with old Nix versions and must be #t." 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)) (let* ((st (stat file-name #f))
(args `(,basename ,recursive? ,hash-algo ,st)) (args `(,basename ,recursive? ,hash-algo ,st))
(cache (nix-server-add-to-store-cache server))) (cache (nix-server-add-to-store-cache server)))
(or (and st (hash-ref cache args)) (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-algo file-name)))
(hash-set! cache args path) (hash-set! cache args path)
path)))))) path))))))

View File

@ -51,7 +51,7 @@
(define %bash (define %bash
(let ((bash (search-bootstrap-binary "bash" (%current-system)))) (let ((bash (search-bootstrap-binary "bash" (%current-system))))
(and %store (and %store
(add-to-store %store "bash" #t #t "sha256" bash)))) (add-to-store %store "bash" #t "sha256" bash))))
(define (directory-contents dir) (define (directory-contents dir)
"Return an alist representing the contents of DIR." "Return an alist representing the contents of DIR."
@ -86,7 +86,7 @@
(test-assert "add-to-store, flat" (test-assert "add-to-store, flat"
(let* ((file (search-path %load-path "language/tree-il/spec.scm")) (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))) (and (eq? 'regular (stat:type (stat drv)))
(valid-path? %store drv) (valid-path? %store drv)
(equal? (call-with-input-file file get-bytevector-all) (equal? (call-with-input-file file get-bytevector-all)
@ -94,7 +94,7 @@
(test-assert "add-to-store, recursive" (test-assert "add-to-store, recursive"
(let* ((dir (dirname (search-path %load-path "language/tree-il/spec.scm"))) (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))) (and (eq? 'directory (stat:type (stat drv)))
(valid-path? %store drv) (valid-path? %store drv)
(equal? (directory-contents dir) (equal? (directory-contents dir)
@ -145,7 +145,7 @@
;; name to the builder. ;; name to the builder.
. ,(add-to-store %store . ,(add-to-store %store
(basename input) (basename input)
#t #t "sha256" #t "sha256"
input))) input)))
`((,builder) `((,builder)
(,input))))) ; ← local file name (,input))))) ; ← local file name