* [bug#33111] [PATCH 2/3] pack: Add '--profile-name'.
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
2018-10-21 20:49 ` [bug#33111] [PATCH 3/3] build: Binary tarball now populates the "current-guix" profile Ludovic Courtès
1 sibling, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2018-10-21 20:49 UTC (permalink / raw)
To: 33111
* 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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [bug#33111] [PATCH 3/3] build: Binary tarball now populates the "current-guix" profile.
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 ` [bug#33111] [PATCH 2/3] pack: Add '--profile-name' Ludovic Courtès
@ 2018-10-21 20:49 ` Ludovic Courtès
1 sibling, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2018-10-21 20:49 UTC (permalink / raw)
To: 33111
* Makefile.am (guix-binary.%.tar.xz): Pass
'--profile-name=current-guix'. Remove glibc and glibc-utf8-locales.
* doc/guix.texi (Binary Installation): Update accordingly.
* etc/guix-install.sh
* etc/guix-install.sh (sys_create_store, sys_enable_guix_daemon)
(sys_authorize_build_farms): Likewise.
* etc/guix-publish.conf.in, etc/guix-publish.service.in,
etc/guix-daemon.conf.in, etc/guix-daemon.service.in: Update file names
accordingly.
---
Makefile.am | 6 ++----
doc/guix.texi | 30 ++++++++++++++++++------------
etc/guix-daemon.conf.in | 2 +-
etc/guix-daemon.service.in | 4 ++--
etc/guix-install.sh | 21 +++++++++++----------
etc/guix-publish.conf.in | 2 +-
etc/guix-publish.service.in | 4 ++--
7 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 7fd29b90a..8b4c431b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -593,13 +593,11 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-daemon \
ac_cv_guix_test_root="$(GUIX_TEST_ROOT)"
-# The self-contained tarball. Add 'glibc-utf8-locales' along with glibc just
-# so 'etc/profile' defines 'GUIX_LOCPATH' pointing to a valid set of locales.
+# The self-contained tarball.
guix-binary.%.tar.xz:
$(AM_V_GEN)GUIX_PACKAGE_PATH= \
tarball=`$(top_builddir)/pre-inst-env guix pack -K -C xz \
- -s "$*" --localstatedir guix glibc-utf8-locales \
- -e '(@@ (gnu packages commencement) glibc-final)'` ; \
+ -s "$*" --localstatedir --profile-name=current-guix guix` ; \
cp "$$tarball" "$@.tmp" ; mv "$@.tmp" "$@"
diff --git a/doc/guix.texi b/doc/guix.texi
index 7265eed91..de9f6ec25 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -487,18 +487,20 @@ archive content is independent of its creation time, thus making it
reproducible.
@item
-Make @code{root}'s profile available under @file{~root/.guix-profile}:
+Make the profile available under @file{~root/.config/guix/current}, which is
+where @command{guix pull} will install updates (@pxref{Invoking guix pull}):
@example
-# ln -sf /var/guix/profiles/per-user/root/guix-profile \
- ~root/.guix-profile
+# mkdir -p ~root/.config/guix
+# ln -sf /var/guix/profiles/per-user/root/current-guix \
+ ~root/.config/guix/current
@end example
Source @file{etc/profile} to augment @code{PATH} and other relevant
environment variables:
@example
-# GUIX_PROFILE="`echo ~root`/.guix-profile" ; \
+# GUIX_PROFILE="`echo ~root`/.config/guix/current" ; \
source $GUIX_PROFILE/etc/profile
@end example
@@ -520,8 +522,8 @@ with these commands:
@c http://lists.gnu.org/archive/html/guix-devel/2017-01/msg01199.html
@example
-# cp ~root/.guix-profile/lib/systemd/system/guix-daemon.service \
- /etc/systemd/system/
+# cp ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \
+ /etc/systemd/system/
# systemctl start guix-daemon && systemctl enable guix-daemon
@end example
@@ -529,14 +531,16 @@ If your host distro uses the Upstart init system:
@example
# initctl reload-configuration
-# cp ~root/.guix-profile/lib/upstart/system/guix-daemon.conf /etc/init/
+# cp ~root/.config/guix/current/lib/upstart/system/guix-daemon.conf \
+ /etc/init/
# start guix-daemon
@end example
Otherwise, you can still start the daemon manually with:
@example
-# ~root/.guix-profile/bin/guix-daemon --build-users-group=guixbuild
+# ~root/.config/guix/current/bin/guix-daemon \
+ --build-users-group=guixbuild
@end example
@item
@@ -546,7 +550,7 @@ for instance with:
@example
# mkdir -p /usr/local/bin
# cd /usr/local/bin
-# ln -s /var/guix/profiles/per-user/root/guix-profile/bin/guix
+# ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix
@end example
It is also a good idea to make the Info version of this manual available
@@ -555,7 +559,7 @@ there:
@example
# mkdir -p /usr/local/share/info
# cd /usr/local/share/info
-# for i in /var/guix/profiles/per-user/root/guix-profile/share/info/* ;
+# for i in /var/guix/profiles/per-user/root/current-guix/share/info/* ;
do ln -s $i ; done
@end example
@@ -570,7 +574,8 @@ To use substitutes from @code{hydra.gnu.org} or one of its mirrors
(@pxref{Substitutes}), authorize them:
@example
-# guix archive --authorize < ~root/.guix-profile/share/guix/hydra.gnu.org.pub
+# guix archive --authorize < \
+ ~root/.config/guix/current/share/guix/hydra.gnu.org.pub
@end example
@item
@@ -604,7 +609,8 @@ make guix-binary.@var{system}.tar.xz
... which, in turn, runs:
@example
-guix pack -s @var{system} --localstatedir guix
+guix pack -s @var{system} --localstatedir \
+ --profile-name=current-guix guix
@end example
@xref{Invoking guix pack}, for more info on this handy tool.
diff --git a/etc/guix-daemon.conf.in b/etc/guix-daemon.conf.in
index 74706055f..755192d55 100644
--- a/etc/guix-daemon.conf.in
+++ b/etc/guix-daemon.conf.in
@@ -7,4 +7,4 @@ start on runlevel [2345]
stop on runlevel [016]
-exec @localstatedir@/guix/profiles/per-user/root/guix-profile/bin/guix-daemon --build-users-group=guixbuild
+exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild
diff --git a/etc/guix-daemon.service.in b/etc/guix-daemon.service.in
index 988cf90c0..99ec7c48f 100644
--- a/etc/guix-daemon.service.in
+++ b/etc/guix-daemon.service.in
@@ -6,8 +6,8 @@
Description=Build daemon for GNU Guix
[Service]
-ExecStart=@localstatedir@/guix/profiles/per-user/root/guix-profile/bin/guix-daemon --build-users-group=guixbuild
-Environment=GUIX_LOCPATH=/root/.guix-profile/lib/locale
+ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild
+Environment=GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale
RemainAfterExit=yes
StandardOutput=syslog
StandardError=syslog
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index ca6874ba0..6a01e5972 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -269,12 +269,13 @@ sys_create_store()
fi
_msg "${INF}Linking the root user's profile"
- ln -sf /var/guix/profiles/per-user/root/guix-profile \
- "${ROOT_HOME}/.guix-profile"
+ mkdir -p "${ROOT_HOME}/.config/guix"
+ ln -sf /var/guix/profiles/per-user/root/current-guix \
+ "${ROOT_HOME}/.config/guix/current"
- GUIX_PROFILE="${ROOT_HOME}/.guix-profile"
+ GUIX_PROFILE="${ROOT_HOME}/.config/guix/current"
source "${GUIX_PROFILE}/etc/profile"
- _msg "${PAS}activated root profile at /root/.guix-profile"
+ _msg "${PAS}activated root profile at ${ROOT_HOME}/.config/guix/current"
}
sys_create_build_user()
@@ -317,18 +318,18 @@ sys_enable_guix_daemon()
info_path="/usr/local/share/info"
local_bin="/usr/local/bin"
- var_guix="/var/guix/profiles/per-user/root/guix-profile"
+ var_guix="/var/guix/profiles/per-user/root/current-guix"
case "$INIT_SYS" in
upstart)
{ initctl reload-configuration;
- cp "${ROOT_HOME}/.guix-profile/lib/upstart/system/guix-daemon.conf" \
+ cp "${ROOT_HOME}/.config/guix/current/lib/upstart/system/guix-daemon.conf" \
/etc/init/ &&
start guix-daemon; } &&
_msg "${PAS}enabled Guix daemon via upstart"
;;
systemd)
- { cp "${ROOT_HOME}/.guix-profile/lib/systemd/system/guix-daemon.service" \
+ { cp "${ROOT_HOME}/.config/guix/current/lib/systemd/system/guix-daemon.service" \
/etc/systemd/system/;
chmod 664 /etc/systemd/system/guix-daemon.service;
systemctl daemon-reload &&
@@ -338,7 +339,7 @@ sys_enable_guix_daemon()
;;
NA|*)
_msg "${ERR}unsupported init system; run the daemon manually:"
- echo " ${ROOT_HOME}/.guix-profile/bin/guix-daemon --build-users-group=guixbuild"
+ echo " ${ROOT_HOME}/.config/guix/current/bin/guix-daemon --build-users-group=guixbuild"
;;
esac
@@ -358,9 +359,9 @@ sys_authorize_build_farms()
while true; do
read -p "Permit downloading pre-built package binaries from the project's build farms? (yes/no) " yn
case $yn in
- [Yy]*) guix archive --authorize < "${ROOT_HOME}/.guix-profile/share/guix/hydra.gnu.org.pub" &&
+ [Yy]*) guix archive --authorize < "${ROOT_HOME}/.config/guix/current/share/guix/hydra.gnu.org.pub" &&
_msg "${PAS}Authorized public key for hydra.gnu.org";
- guix archive --authorize < "${ROOT_HOME}/.guix-profile/share/guix/berlin.guixsd.org.pub" &&
+ guix archive --authorize < "${ROOT_HOME}/.config/guix/current/share/guix/berlin.guixsd.org.pub" &&
_msg "${PAS}Authorized public key for berlin.guixsd.org";
break;;
[Nn]*) _msg "${INF}Skipped authorizing build farm public keys"
diff --git a/etc/guix-publish.conf.in b/etc/guix-publish.conf.in
index 241c59455..7b319f66a 100644
--- a/etc/guix-publish.conf.in
+++ b/etc/guix-publish.conf.in
@@ -9,4 +9,4 @@ stop on runlevel [016]
task
-exec @localstatedir@/guix/profiles/per-user/root/guix-profile/bin/guix publish --user=nobody --port=8181
+exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix publish --user=nobody --port=8181
diff --git a/etc/guix-publish.service.in b/etc/guix-publish.service.in
index 8aaf09e3c..0526f9799 100644
--- a/etc/guix-publish.service.in
+++ b/etc/guix-publish.service.in
@@ -6,8 +6,8 @@
Description=Publish the GNU Guix store
[Service]
-ExecStart=@localstatedir@/guix/profiles/per-user/root/guix-profile/bin/guix publish --user=nobody --port=8181
-Environment=GUIX_LOCPATH=/root/.guix-profile/lib/locale
+ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix publish --user=nobody --port=8181
+Environment=GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale
RemainAfterExit=yes
StandardOutput=syslog
StandardError=syslog
--
2.19.1
^ permalink raw reply related [flat|nested] 9+ messages in thread