[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/09: environment: Rename '--inherit' to '--preserve'.
From: |
guix-commits |
Subject: |
06/09: environment: Rename '--inherit' to '--preserve'. |
Date: |
Mon, 4 Mar 2019 09:24:16 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit dca58219584c1163a9fbf88fccea885eb53bf2af
Author: Ludovic Courtès <address@hidden>
Date: Mon Mar 4 14:19:55 2019 +0100
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.
---
doc/guix.texi | 9 +++++----
guix/scripts/environment.scm | 11 +++++++++--
tests/guix-environment.sh | 4 ++--
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 7fcfcb1..1b77881 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4456,17 +4456,18 @@ that will be added to the environment directly.
@item --pure
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.
address@hidden address@hidden
-When used alongside @option{--pure}, inherit all the environment variables
address@hidden address@hidden
address@hidden -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
environment variables that must be preserved. This option can be repeated
several times.
@example
-guix environment --pure --inherit=^SLURM --ad-hoc openmpi @dots{} \
+guix environment --pure --preserve=^SLURM --ad-hoc openmpi @dots{} \
-- mpirun @dots{}
@end example
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 0cf7b3f..63f6129 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -141,7 +141,7 @@ COMMAND or an interactive shell in that environment.\n"))
(display (G_ "
--pure unset existing environment variables"))
(display (G_ "
- --inherit=REGEXP inherit environment variables that match REGEXP"))
+ -E, --preserve=REGEXP preserve environment variables that match REGEXP"))
(display (G_ "
--search-paths display needed environment variable definitions"))
(display (G_ "
@@ -215,11 +215,18 @@ COMMAND or an interactive shell in that environment.\n"))
(option '("pure") #f #f
(lambda (opt name arg result)
(alist-cons 'pure #t result)))
- (option '("inherit") #t #f
+ (option '(#\E "preserve") #t #f
(lambda (opt name arg result)
(alist-cons 'inherit-regexp
(make-regexp* arg)
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
(lambda (opt name arg result)
(alist-cons 'search-paths #t result)))
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index d6df623..7ea9c20 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -49,13 +49,13 @@ test -x `sed -r 's/^export PATH="(.*)"/\1/'
"$tmpdir/a"`/guile
cmp "$tmpdir/a" "$tmpdir/b"
-# Check '--inherit'.
+# Check '--preserve'.
GUIX_TEST_ABC=1
GUIX_TEST_DEF=2
GUIX_TEST_XYZ=3
export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ
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"
grep '^PATH=' "$tmpdir/a"
grep '^GUIX_TEST_ABC=' "$tmpdir/a"
- branch master updated (3a0baba -> c364481), guix-commits, 2019/03/04
- 01/09: tests: Use non-deprecated (guix store) API., guix-commits, 2019/03/04
- 04/09: doc: Better explain the 'password' field of <user-account>., guix-commits, 2019/03/04
- 06/09: environment: Rename '--inherit' to '--preserve'.,
guix-commits <=
- 02/09: activation: Make home directories #o700 by default., guix-commits, 2019/03/04
- 05/09: environment: Remove deprecated -E/--exec option., guix-commits, 2019/03/04
- 07/09: gnu: emacs: Add modules support., guix-commits, 2019/03/04
- 09/09: gnu: Add arcan-sdl., guix-commits, 2019/03/04
- 08/09: gnu: Add arcan., guix-commits, 2019/03/04
- 03/09: services: Use 'file-append' for user account shells., guix-commits, 2019/03/04