mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-26 12:39:36 -05:00
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'.
This commit is contained in:
parent
10d429f2fc
commit
8b192c5550
3 changed files with 20 additions and 18 deletions
|
@ -121,9 +121,6 @@ (define (show-environment-options-help)
|
||||||
--expose=SPEC for containers, expose read-only host file system
|
--expose=SPEC for containers, expose read-only host file system
|
||||||
according to SPEC"))
|
according to SPEC"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
-F, --emulate-fhs for containers, emulate the Filesystem Hierarchy
|
|
||||||
Standard (FHS)"))
|
|
||||||
(display (G_ "
|
|
||||||
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
|
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--bootstrap use bootstrap binaries to build the environment")))
|
--bootstrap use bootstrap binaries to build the environment")))
|
||||||
|
@ -260,9 +257,6 @@ (define %options
|
||||||
(alist-cons 'file-system-mapping
|
(alist-cons 'file-system-mapping
|
||||||
(specification->file-system-mapping arg #f)
|
(specification->file-system-mapping arg #f)
|
||||||
result)))
|
result)))
|
||||||
(option '(#\F "emulate-fhs") #f #f
|
|
||||||
(lambda (opt name arg result)
|
|
||||||
(alist-cons 'emulate-fhs? #t result)))
|
|
||||||
(option '(#\r "root") #t #f
|
(option '(#\r "root") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'gc-root arg result)))
|
(alist-cons 'gc-root arg result)))
|
||||||
|
@ -1030,15 +1024,7 @@ (define-syntax-rule (with-store/maybe store exp ...)
|
||||||
(with-store/maybe store
|
(with-store/maybe store
|
||||||
(with-status-verbosity (assoc-ref opts 'verbosity)
|
(with-status-verbosity (assoc-ref opts 'verbosity)
|
||||||
(define manifest-from-opts
|
(define manifest-from-opts
|
||||||
(options/resolve-packages
|
(options/resolve-packages store opts))
|
||||||
store
|
|
||||||
;; For an FHS-container, add the (hidden) package glibc-for-fhs
|
|
||||||
;; which uses the global cache at /etc/ld.so.cache.
|
|
||||||
(if emulate-fhs?
|
|
||||||
(alist-cons 'expression
|
|
||||||
'(ad-hoc-package "(@@ (gnu packages base) glibc-for-fhs)")
|
|
||||||
opts)
|
|
||||||
opts)))
|
|
||||||
|
|
||||||
(define manifest
|
(define manifest
|
||||||
(if profile
|
(if profile
|
||||||
|
|
|
@ -68,6 +68,9 @@ (define (show-help)
|
||||||
--rebuild-cache rebuild cached environment, if any"))
|
--rebuild-cache rebuild cached environment, if any"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--export-manifest print a manifest for the given options"))
|
--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)
|
(show-environment-options-help)
|
||||||
(newline)
|
(newline)
|
||||||
|
@ -136,7 +139,20 @@ (define %options
|
||||||
(alist-cons 'explicit-loading? #t result)))
|
(alist-cons 'explicit-loading? #t result)))
|
||||||
(option '("rebuild-cache") #f #f
|
(option '("rebuild-cache") #f #f
|
||||||
(lambda (opt name arg result)
|
(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)
|
(filter-map (lambda (opt)
|
||||||
(and (not (any (lambda (name)
|
(and (not (any (lambda (name)
|
||||||
(member name to-remove))
|
(member name to-remove))
|
||||||
|
|
|
@ -217,7 +217,7 @@ fi
|
||||||
# Test that the container has FHS specific files/directories. Note that /bin
|
# Test that the container has FHS specific files/directories. Note that /bin
|
||||||
# exists in a non-FHS container as it will contain sh, a symlink to the bash
|
# exists in a non-FHS container as it will contain sh, a symlink to the bash
|
||||||
# package, so we don't test for it.
|
# package, so we don't test for it.
|
||||||
guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \
|
guix shell -C --emulate-fhs --bootstrap guile-bootstrap \
|
||||||
-- guile -c '(exit (and (file-exists? "/etc/ld.so.cache")
|
-- guile -c '(exit (and (file-exists? "/etc/ld.so.cache")
|
||||||
(file-exists? "/lib")
|
(file-exists? "/lib")
|
||||||
(file-exists? "/sbin")
|
(file-exists? "/sbin")
|
||||||
|
@ -229,5 +229,5 @@ guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \
|
||||||
(file-exists? "/usr/share")))'
|
(file-exists? "/usr/share")))'
|
||||||
|
|
||||||
# Test that the ld cache was generated and can be successfully read.
|
# Test that the ld cache was generated and can be successfully read.
|
||||||
guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \
|
guix shell -CF --bootstrap guile-bootstrap \
|
||||||
-- guile -c '(execlp "ldconfig" "ldconfig" "-p")'
|
-- guile -c '(execlp "ldconfig" "ldconfig" "-p")'
|
||||||
|
|
Loading…
Reference in a new issue