From: "Ludovic Courtès" <ludo@gnu.org>
To: 33111@debbugs.gnu.org
Subject: [bug#33111] [PATCH 2/3] pack: Add '--profile-name'.
Date: Sun, 21 Oct 2018 22:49:42 +0200 [thread overview]
Message-ID: <20181021204943.2142-2-ludo@gnu.org> (raw)
In-Reply-To: <20181021204943.2142-1-ludo@gnu.org>
* guix/scripts/pack.scm (self-contained-tarball): Add #:profile-name and
honor it.
(squashfs-image, docker-image): Add #:profile-name.
(%default-options): Add 'profile-name'.
(%options, show-help): Add "--profile-name".
(guix-pack): Honor it.
* tests/guix-pack.sh: Add test for '--localstatedir
--profile-name=current-guix'.
* doc/guix.texi (Invoking guix pack): Document "--profile-name".
---
doc/guix.texi | 7 +++++--
guix/scripts/pack.scm | 20 +++++++++++++++++++-
tests/guix-pack.sh | 17 +++++++++++++++--
3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 12346c4b8..7265eed91 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3459,8 +3459,11 @@ For instance, @code{-S /opt/gnu/bin=bin} creates a @file{/opt/gnu/bin}
symlink pointing to the @file{bin} sub-directory of the profile.
@item --localstatedir
-Include the ``local state directory'', @file{/var/guix}, in the
-resulting pack.
+@itemx --profile-name=@var{name}
+Include the ``local state directory'', @file{/var/guix}, in the resulting
+pack, and notably the @file{/var/guix/profiles/per-user/root/@var{name}}
+profile---by default @var{name} is @code{guix-profile}, which corresponds to
+@file{~root/.guix-profile}.
@file{/var/guix} contains the store database (@pxref{The Store}) as well
as garbage-collector roots (@pxref{Invoking guix gc}). Providing it in
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index b7b4e22bb..a87a96115 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -105,6 +105,7 @@ found."
(define* (self-contained-tarball name profile
#:key target
+ (profile-name "guix-profile")
deduplicate?
(compressor (first %compressors))
localstatedir?
@@ -184,6 +185,7 @@ added to the pack."
;; <http://lists.gnu.org/archive/html/bug-tar/2017-11/msg00009.html>.
(populate-single-profile-directory %root
#:profile #$profile
+ #:profile-name #$profile-name
#:closure "profile"
#:deduplicate? #f
#:register? #$localstatedir?
@@ -244,6 +246,7 @@ added to the pack."
(define* (squashfs-image name profile
#:key target
+ (profile-name "guix-profile")
deduplicate?
(compressor (first %compressors))
localstatedir?
@@ -333,6 +336,7 @@ added to the pack."
(define* (docker-image name profile
#:key target
+ (profile-name "guix-profile")
deduplicate?
(compressor (first %compressors))
localstatedir?
@@ -538,6 +542,7 @@ please email '~a'~%")
(define %default-options
;; Alist of default option values.
`((format . tarball)
+ (profile-name . "guix-profile")
(system . ,(%current-system))
(substitutes? . #t)
(build-hook? . #t)
@@ -609,6 +614,13 @@ please email '~a'~%")
(option '("localstatedir") #f #f
(lambda (opt name arg result)
(alist-cons 'localstatedir? #t result)))
+ (option '("profile-name") #t #f
+ (lambda (opt name arg result)
+ (match arg
+ ((or "guix-profile" "current-guix")
+ (alist-cons 'profile-name arg result))
+ (_
+ (leave (G_ "~a: unsupported profile name~%") arg)))))
(option '("bootstrap") #f #f
(lambda (opt name arg result)
(alist-cons 'bootstrap? #t result)))
@@ -641,6 +653,9 @@ Create a bundle of PACKAGE.\n"))
-m, --manifest=FILE create a pack with the manifest from FILE"))
(display (G_ "
--localstatedir include /var/guix in the resulting pack"))
+ (display (G_ "
+ --profile-name=NAME
+ populate /var/guix/profiles/.../NAME"))
(display (G_ "
--bootstrap use the bootstrap binaries to build the pack"))
(newline)
@@ -730,7 +745,8 @@ Create a bundle of PACKAGE.\n"))
(#f
(leave (G_ "~a: unknown pack format~%")
pack-format))))
- (localstatedir? (assoc-ref opts 'localstatedir?)))
+ (localstatedir? (assoc-ref opts 'localstatedir?))
+ (profile-name (assoc-ref opts 'profile-name)))
(run-with-store store
(mlet* %store-monad ((profile (profile-derivation
manifest
@@ -749,6 +765,8 @@ Create a bundle of PACKAGE.\n"))
symlinks
#:localstatedir?
localstatedir?
+ #:profile-name
+ profile-name
#:archiver
archiver)))
(mbegin %store-monad
diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh
index cd721a60e..c55fe6c9a 100644
--- a/tests/guix-pack.sh
+++ b/tests/guix-pack.sh
@@ -61,7 +61,7 @@ the_pack="`guix pack -S /opt/gnu/bin=bin guile-bootstrap`"
# exists because /opt/gnu/bin may be an absolute symlink to a store item that
# has been GC'd.
test_directory="`mktemp -d`"
-trap 'rm -rf "$test_directory"' EXIT
+trap 'find "$test_directory" -type d -exec chmod +w {} \; ;rm -rf "$test_directory"' EXIT
cd "$test_directory"
tar -xf "$the_pack"
test -L opt/gnu/bin
@@ -74,10 +74,23 @@ is_available () {
if is_available chroot && is_available unshare; then
# Verify we can use what we built.
unshare -r chroot . /opt/gnu/bin/guile --version
- cd -
else
echo "warning: skipped some verification because chroot or unshare is unavailable" >&2
fi
+cd -
+rm -rf "$test_directory"
+
+# Build a tarball with '--localstatedir'
+the_pack="`guix pack -C none --localstatedir --profile-name=current-guix \
+ guile-bootstrap`"
+test_directory="`mktemp -d`"
+cd "$test_directory"
+tar -xf "$the_pack"
+
+profile="`find -name current-guix`"
+test "`readlink $profile`" = "current-guix-1-link"
+test -s "`dirname $profile`/../../../db/db.sqlite"
+test -x ".`guix build guile-bootstrap`/bin/guile"
# For the tests that build Docker images below, we currently have to use
# --dry-run because if we don't, there are only two possible cases:
--
2.19.1
next prev parent reply other threads:[~2018-10-21 20:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-21 20:45 [bug#33111] [PATCH 0/3] Have the binary tarball populate ~root/.config/guix/current Ludovic Courtès
2018-10-21 20:49 ` [bug#33111] [PATCH 1/3] install: Parameterize the profile name for 'populate-single-profile-directory' Ludovic Courtès
2018-10-21 20:49 ` Ludovic Courtès [this message]
2018-10-21 20:49 ` [bug#33111] [PATCH 3/3] build: Binary tarball now populates the "current-guix" profile Ludovic Courtès
2018-10-25 20:24 ` [bug#33111] [PATCH 0/3] Have the binary tarball populate ~root/.config/guix/current Ludovic Courtès
2018-10-26 5:33 ` Ricardo Wurmus
2018-10-26 9:57 ` Ludovic Courtès
2018-11-16 21:59 ` Ludovic Courtès
2018-11-23 14:43 ` bug#33111: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181021204943.2142-2-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=33111@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).