mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
pack: Docker backend now honors '--localstatedir'.
* guix/docker.scm (build-docker-image): Add #:database parameter. Create /var/guix/db, /var/guix/profiles, etc. when DATABASE is true. * guix/scripts/pack.scm (docker-image): Export. Remove #:deduplicate? parameter. Define 'database' and pass it to 'docker-image'. * tests/pack.scm (test-assertm): Recompile the derivation of %BOOTSTRAP-GUILE. ("docker-image + localstatedir"): New test.
This commit is contained in:
parent
c5ce2db569
commit
f5a2fb1bfb
3 changed files with 74 additions and 4 deletions
|
@ -26,6 +26,7 @@
|
|||
delete-file-recursively
|
||||
with-directory-excursion
|
||||
invoke))
|
||||
#:use-module (gnu build install)
|
||||
#:use-module (json) ;guile-json
|
||||
#:use-module (srfi srfi-19)
|
||||
#:use-module (srfi srfi-26)
|
||||
|
@ -108,11 +109,15 @@ return \"a\"."
|
|||
(symlinks '())
|
||||
(transformations '())
|
||||
(system (utsname:machine (uname)))
|
||||
database
|
||||
compressor
|
||||
(creation-time (current-time time-utc)))
|
||||
"Write to IMAGE a Docker image archive containing the given PATHS. PREFIX
|
||||
must be a store path that is a prefix of any store paths in PATHS.
|
||||
|
||||
When DATABASE is true, copy it to /var/guix/db in the image and create
|
||||
/var/guix/gcroots and friends.
|
||||
|
||||
SYMLINKS must be a list of (SOURCE -> TARGET) tuples describing symlinks to be
|
||||
created in the image, where each TARGET is relative to PREFIX.
|
||||
TRANSFORMATIONS must be a list of (OLD -> NEW) tuples describing how to
|
||||
|
@ -188,10 +193,15 @@ SRFI-19 time-utc object, as the creation time in metadata."
|
|||
source))))
|
||||
symlinks)
|
||||
|
||||
(when database
|
||||
;; Initialize /var/guix, assuming PREFIX points to a profile.
|
||||
(install-database-and-gc-roots "." database prefix))
|
||||
|
||||
(apply invoke "tar" "-cf" "layer.tar"
|
||||
`(,@transformation-options
|
||||
,@%tar-determinism-options
|
||||
,@paths
|
||||
,@(if database '("var") '())
|
||||
,@(map symlink-source symlinks)))
|
||||
;; It is possible for "/" to show up in the archive, especially when
|
||||
;; applying transformations. For example, the transformation
|
||||
|
@ -203,7 +213,11 @@ SRFI-19 time-utc object, as the creation time in metadata."
|
|||
(system* "tar" "--delete" "/" "-f" "layer.tar")
|
||||
(for-each delete-file-recursively
|
||||
(map (compose topmost-component symlink-source)
|
||||
symlinks)))
|
||||
symlinks))
|
||||
|
||||
;; Delete /var/guix.
|
||||
(when database
|
||||
(delete-file-recursively "var")))
|
||||
|
||||
(with-output-to-file "config.json"
|
||||
(lambda ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue