mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
environment: Rename '--inherit' to '--preserve'.
Suggested by Eric Bavier and Ricardo Wurmus. * guix/scripts/environment.scm (show-help, %options): Emit a deprecation warning for "--inherit" and add -E/--preserve. * tests/guix-environment.sh: Adjust accordingly. * doc/guix.texi (Invoking guix environment): Update accordingly.
This commit is contained in:
parent
bab9cc4aff
commit
dca5821958
3 changed files with 16 additions and 8 deletions
|
@ -4456,17 +4456,18 @@ that will be added to the environment directly.
|
||||||
|
|
||||||
@item --pure
|
@item --pure
|
||||||
Unset existing environment variables when building the new environment, except
|
Unset existing environment variables when building the new environment, except
|
||||||
those specified with @option{--inherit} (see below.) This has the effect of
|
those specified with @option{--preserve} (see below.) This has the effect of
|
||||||
creating an environment in which search paths only contain package inputs.
|
creating an environment in which search paths only contain package inputs.
|
||||||
|
|
||||||
@item --inherit=@var{regexp}
|
@item --preserve=@var{regexp}
|
||||||
When used alongside @option{--pure}, inherit all the environment variables
|
@itemx -E @var{regexp}
|
||||||
|
When used alongside @option{--pure}, preserve the environment variables
|
||||||
matching @var{regexp}---in other words, put them on a ``white list'' of
|
matching @var{regexp}---in other words, put them on a ``white list'' of
|
||||||
environment variables that must be preserved. This option can be repeated
|
environment variables that must be preserved. This option can be repeated
|
||||||
several times.
|
several times.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
guix environment --pure --inherit=^SLURM --ad-hoc openmpi @dots{} \
|
guix environment --pure --preserve=^SLURM --ad-hoc openmpi @dots{} \
|
||||||
-- mpirun @dots{}
|
-- mpirun @dots{}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ (define (show-help)
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--pure unset existing environment variables"))
|
--pure unset existing environment variables"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--inherit=REGEXP inherit environment variables that match REGEXP"))
|
-E, --preserve=REGEXP preserve environment variables that match REGEXP"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--search-paths display needed environment variable definitions"))
|
--search-paths display needed environment variable definitions"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
|
@ -215,11 +215,18 @@ (define %options
|
||||||
(option '("pure") #f #f
|
(option '("pure") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'pure #t result)))
|
(alist-cons 'pure #t result)))
|
||||||
(option '("inherit") #t #f
|
(option '(#\E "preserve") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'inherit-regexp
|
(alist-cons 'inherit-regexp
|
||||||
(make-regexp* arg)
|
(make-regexp* arg)
|
||||||
result)))
|
result)))
|
||||||
|
(option '("inherit") #t #f ;deprecated
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(warning (G_ "'--inherit' is deprecated, \
|
||||||
|
use '--preserve' instead~%"))
|
||||||
|
(alist-cons 'inherit-regexp
|
||||||
|
(make-regexp* arg)
|
||||||
|
result)))
|
||||||
(option '("search-paths") #f #f
|
(option '("search-paths") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'search-paths #t result)))
|
(alist-cons 'search-paths #t result)))
|
||||||
|
|
|
@ -49,13 +49,13 @@ test -x `sed -r 's/^export PATH="(.*)"/\1/' "$tmpdir/a"`/guile
|
||||||
|
|
||||||
cmp "$tmpdir/a" "$tmpdir/b"
|
cmp "$tmpdir/a" "$tmpdir/b"
|
||||||
|
|
||||||
# Check '--inherit'.
|
# Check '--preserve'.
|
||||||
GUIX_TEST_ABC=1
|
GUIX_TEST_ABC=1
|
||||||
GUIX_TEST_DEF=2
|
GUIX_TEST_DEF=2
|
||||||
GUIX_TEST_XYZ=3
|
GUIX_TEST_XYZ=3
|
||||||
export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ
|
export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ
|
||||||
guix environment --bootstrap --ad-hoc guile-bootstrap --pure \
|
guix environment --bootstrap --ad-hoc guile-bootstrap --pure \
|
||||||
--inherit='^GUIX_TEST_A' --inherit='^GUIX_TEST_D' \
|
--preserve='^GUIX_TEST_A' --preserve='^GUIX_TEST_D' \
|
||||||
-- "$SHELL" -c set > "$tmpdir/a"
|
-- "$SHELL" -c set > "$tmpdir/a"
|
||||||
grep '^PATH=' "$tmpdir/a"
|
grep '^PATH=' "$tmpdir/a"
|
||||||
grep '^GUIX_TEST_ABC=' "$tmpdir/a"
|
grep '^GUIX_TEST_ABC=' "$tmpdir/a"
|
||||||
|
|
Loading…
Reference in a new issue