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:
		
							parent
							
								
									fd060fd30d
								
							
						
					
					
						commit
						a9ebd9efd0
					
				
					 6 changed files with 17 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 <>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))))))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue