summaryrefslogtreecommitdiff
path: root/guix/scripts/shell.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-10-13 15:52:43 +0200
committerLudovic Courtès <ludo@gnu.org>2022-10-13 15:56:56 +0200
commit8b192c5550213911f930594f4fd7386f36618237 (patch)
treeab0a0715f95d0db36e1d6ccba7aff4ab194188ce /guix/scripts/shell.scm
parent10d429f2fce321d8285684503094694ec3979865 (diff)
shell: Handle '--emulate-fhs' in 'guix shell', not in 'guix environment'.
Previously, using 'guix shell -CF coreutils' twice (such that the profile is cache) would result in: guix shell: error: '--profile' cannot be used with package options This patch fixes it by moving argument handling to (guix scripts shell), before 'options-with-caching' is called. * guix/scripts/environment.scm (show-environment-options-help) (%options): Remove '--emulate-fhs'. (guix-environment*): Pass OPTS as-is to 'options/resolve-packages'. * guix/scripts/shell.scm (show-help, %options): Add '--emulate-fhs'. Add the (expression . ...) component to RESULT right from the argument handler. * tests/guix-environment-container.sh: Change '--emulate-fhs' tests to use 'guix shell' instead of 'guix environment'.
Diffstat (limited to 'guix/scripts/shell.scm')
-rw-r--r--guix/scripts/shell.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm
index c115a00320..a2836629ad 100644
--- a/guix/scripts/shell.scm
+++ b/guix/scripts/shell.scm
@@ -68,6 +68,9 @@ interactive shell in that environment.\n"))
--rebuild-cache rebuild cached environment, if any"))
(display (G_ "
--export-manifest print a manifest for the given options"))
+ (display (G_ "
+ -F, --emulate-fhs for containers, emulate the Filesystem Hierarchy
+ Standard (FHS)"))
(show-environment-options-help)
(newline)
@@ -136,7 +139,20 @@ interactive shell in that environment.\n"))
(alist-cons 'explicit-loading? #t result)))
(option '("rebuild-cache") #f #f
(lambda (opt name arg result)
- (alist-cons 'rebuild-cache? #t result))))
+ (alist-cons 'rebuild-cache? #t result)))
+
+ (option '(#\F "emulate-fhs") #f #f
+ (lambda (opt name arg result)
+ (let ((result
+ ;; For an FHS-container, add the (hidden)
+ ;; package glibc-for-fhs which uses the global
+ ;; cache at /etc/ld.so.cache.
+ (alist-cons
+ 'expression
+ '(ad-hoc-package
+ "(@@ (gnu packages base) glibc-for-fhs)")
+ result)))
+ (alist-cons 'emulate-fhs? #t result)))))
(filter-map (lambda (opt)
(and (not (any (lambda (name)
(member name to-remove))