install: Turn off deduplication for the binary tarball.

* gnu/build/install.scm (register-closure): Add #:deduplicate? parameter and
  honor it.
  (populate-single-profile-directory): Likewise.
* gnu/system/install.scm (self-contained-tarball): Pass #:deduplicate? #f.
  Invoke tar with --check-links.
This commit is contained in:
Ludovic Courtès 2015-06-17 09:49:22 +02:00
parent 2f6d3e417f
commit 08fa76131e
2 changed files with 19 additions and 7 deletions

View File

@ -161,20 +161,27 @@ as created and modified at the Epoch."
(utime file 0 0 0 0)))) (utime file 0 0 0 0))))
(find-files directory ""))) (find-files directory "")))
(define (register-closure store closure) (define* (register-closure store closure
#:key (deduplicate? #t))
"Register CLOSURE in STORE, where STORE is the directory name of the target "Register CLOSURE in STORE, where STORE is the directory name of the target
store and CLOSURE is the name of a file containing a reference graph as used store and CLOSURE is the name of a file containing a reference graph as used
by 'guix-register'. As a side effect, this resets timestamps on store files." by 'guix-register'. As a side effect, this resets timestamps on store files
(let ((status (system* "guix-register" "--prefix" store and, if DEDUPLICATE? is true, deduplicates files common to CLOSURE and the
closure))) rest of STORE."
(let ((status (apply system* "guix-register" "--prefix" store
(append (if deduplicate? '() '("--no-deduplication"))
(list closure)))))
(unless (zero? status) (unless (zero? status)
(error "failed to register store items" closure)))) (error "failed to register store items" closure))))
(define* (populate-single-profile-directory directory (define* (populate-single-profile-directory directory
#:key profile closure) #:key profile closure
deduplicate?)
"Populate DIRECTORY with a store containing PROFILE, whose closure is given "Populate DIRECTORY with a store containing PROFILE, whose closure is given
in the file called CLOSURE (as generated by #:references-graphs.) DIRECTORY in the file called CLOSURE (as generated by #:references-graphs.) DIRECTORY
is initialized to contain a single profile under /root pointing to PROFILE. is initialized to contain a single profile under /root pointing to PROFILE.
DEDUPLICATE? determines whether to deduplicate files in the store.
This is used to create the self-contained Guix tarball." This is used to create the self-contained Guix tarball."
(define (scope file) (define (scope file)
(string-append directory "/" file)) (string-append directory "/" file))
@ -190,7 +197,8 @@ This is used to create the self-contained Guix tarball."
;; Populate the store. ;; Populate the store.
(populate-store (list closure) directory) (populate-store (list closure) directory)
(register-closure (canonicalize-path directory) closure) (register-closure (canonicalize-path directory) closure
#:deduplicate? deduplicate?)
;; XXX: 'guix-register' registers profiles as GC roots but the symlink ;; XXX: 'guix-register' registers profiles as GC roots but the symlink
;; target uses $TMPDIR. Fix that. ;; target uses $TMPDIR. Fix that.

View File

@ -63,15 +63,19 @@ under /root/.guix-profile where GUIX is installed."
(setenv "PATH" (setenv "PATH"
(string-append #$guix "/sbin:" #$tar "/bin:" #$xz "/bin")) (string-append #$guix "/sbin:" #$tar "/bin:" #$xz "/bin"))
;; Note: there is not much to gain here with deduplication and there
;; is the overhead of the '.links' directory, so turn it off.
(populate-single-profile-directory %root (populate-single-profile-directory %root
#:profile #$profile #:profile #$profile
#:closure "profile") #:closure "profile"
#:deduplicate? #f)
;; Create the tarball. Use GNU format so there's no file name ;; Create the tarball. Use GNU format so there's no file name
;; length limitation. ;; length limitation.
(with-directory-excursion %root (with-directory-excursion %root
(zero? (system* "tar" "--xz" "--format=gnu" (zero? (system* "tar" "--xz" "--format=gnu"
"--owner=root:0" "--group=root:0" "--owner=root:0" "--group=root:0"
"--check-links"
"-cvf" #$output "-cvf" #$output
;; Avoid adding / and /var to the tarball, ;; Avoid adding / and /var to the tarball,
;; so that the ownership and permissions of those ;; so that the ownership and permissions of those