aboutsummaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-06 23:58:18 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-14 11:16:59 +0200
commitc45477d2a1a651485feede20fe0f3d15aec48b39 (patch)
treeeecfc27c056996a9ead73527262e56574a814689 /gnu/build
parentbe43c08b172ecb17acf7ccfa033aab93d586fa19 (diff)
downloadpatches-c45477d2a1a651485feede20fe0f3d15aec48b39.tar
patches-c45477d2a1a651485feede20fe0f3d15aec48b39.tar.gz
install: Use (guix store database) instead of 'guix-register'.
* gnu/build/install.scm (register-closure): Add #:reset-timestamps? and and #:schema; honor them. Rewrite in terms of 'register-path'. (populate-single-profile-directory): Add #:schema and honor it. Make /var/guix/profiles and /var/guix/gcroots. * gnu/build/vm.scm (root-partition-initializer): Pass #:reset-timestamps? to 'register-closure'. * gnu/system/vm.scm (not-config?): New procedure. (guile-sqlite3&co): New variable. (expression->derivation-in-linux-vm)[config]: New variable. [builder]: Use 'with-extensions'. (iso9660-image)[schema, config]: New variables. Wrap build expression in 'with-extensions'; add 'sql-schema' call. Remove GUIX from INPUTS. (qemu-image)[schema, config]: New variables. Wrap body in 'with-extensions'. (system-docker-image)[not-config?]: Remove. [config]: Use 'make-config.scm'. [schema]: New variable. [build]: Use 'with-extensions'. Add call to 'sql-schema'. Remove GUIX from INPUTS. * gnu/system/file-systems.scm (%store-prefix): Check whether '%store-prefix' is defined. * guix/scripts/pack.scm (self-contained-tarball)[not-config?] [libgcrypt, schema]: New variables. [build]: Wrap in 'with-extensions'. Adjust imported module list to use 'make-config.scm' for (guix config).
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/install.scm45
-rw-r--r--gnu/build/vm.scm1
2 files changed, 28 insertions, 18 deletions
diff --git a/gnu/build/install.scm b/gnu/build/install.scm
index 9e30c0d23e..6cc678b44b 100644
--- a/gnu/build/install.scm
+++ b/gnu/build/install.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
;;;
;;; This file is part of GNU Guix.
@@ -18,6 +18,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu build install)
+ #:use-module (guix store database)
#:use-module (guix build utils)
#:use-module (guix build store-copy)
#:use-module (srfi srfi-26)
@@ -158,23 +159,31 @@ as created and modified at the Epoch."
(utime file 0 0 0 0))))
(find-files directory #:directories? #t)))
-(define* (register-closure store closure
- #:key (deduplicate? #t))
- "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
-by 'guix-register'. As a side effect, this resets timestamps on store files
-and, if DEDUPLICATE? is true, deduplicates files common to CLOSURE and the
-rest of STORE."
- (let ((status (apply system* "guix-register" "--prefix" store
- (append (if deduplicate? '() '("--no-deduplication"))
- (list closure)))))
- (unless (zero? status)
- (error "failed to register store items" closure))))
+(define* (register-closure prefix closure
+ #:key
+ (deduplicate? #t) (reset-timestamps? #t)
+ (schema (sql-schema)))
+ "Register CLOSURE in PREFIX, where PREFIX is the directory name of the
+target store and CLOSURE is the name of a file containing a reference graph as
+produced by #:references-graphs.. As a side effect, if RESET-TIMESTAMPS? is
+true, reset timestamps on store files and, if DEDUPLICATE? is true,
+deduplicates files common to CLOSURE and the rest of PREFIX."
+ (let ((items (call-with-input-file closure read-reference-graph)))
+ ;; TODO: Add a procedure to register all of ITEMS at once.
+ (for-each (lambda (item)
+ (register-path (store-info-item item)
+ #:references (store-info-references item)
+ #:deriver (store-info-deriver item)
+ #:prefix prefix
+ #:deduplicate? deduplicate?
+ #:reset-timestamps? reset-timestamps?
+ #:schema schema))
+ items)))
(define* (populate-single-profile-directory directory
#:key profile closure
deduplicate?
- register?)
+ register? schema)
"Populate DIRECTORY with a store containing PROFILE, whose closure is given
in the file called CLOSURE (as generated by #:references-graphs.) DIRECTORY
is initialized to contain a single profile under /root pointing to PROFILE.
@@ -200,11 +209,11 @@ This is used to create the self-contained tarballs with 'guix pack'."
(when register?
(register-closure (canonicalize-path directory) closure
- #:deduplicate? deduplicate?)
+ #:deduplicate? deduplicate?
+ #:schema schema)
- ;; XXX: 'guix-register' registers profiles as GC roots but the symlink
- ;; target uses $TMPDIR. Fix that.
- (delete-file (scope "/var/guix/gcroots/profiles"))
+ (mkdir-p* "/var/guix/profiles")
+ (mkdir-p* "/var/guix/gcroots")
(symlink* "/var/guix/profiles"
"/var/guix/gcroots/profiles"))
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index fa3ce7790d..37639f723a 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -354,6 +354,7 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
(for-each (lambda (closure)
(register-closure target
(string-append "/xchg/" closure)
+ #:reset-timestamps? copy-closures?
#:deduplicate? deduplicate?))
closures)
(unless copy-closures?