diff options
| author | Tomas Volf <~@wolfsden.cz> | 2026-05-14 21:26:16 +0200 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2026-06-15 10:48:17 +0900 |
| commit | d11615f609d2cd58fb1305205a4fa975dc8e4657 (patch) | |
| tree | 7f282d90f61523ff71c5d342aaa53ed7dd98b5bb /tests | |
| parent | 2c646830c1de33fba8e761b86a173041150a030c (diff) | |
environment: Allow setting environment variables with -E.
* guix/scripts/environment.scm (show-environment-options-help) [-E]: Document
the change.
* guix/scripts/environment.scm (%options) [-E]: If arg contains =, split it
and store under 'extra-env.
* guix/scripts/environment.scm (launch-environment, launch-environment/fork)
(launch-environment/container): Take and use `environment-variables' keyword argument.
* guix/scripts/environment.scm (guix-environment*): Process 'environment-variables opts.
* guix/profiles.scm (load-profile): Add `environment-variables' keyword argument.
* doc/guix.texi (Invoking guix shell): Document the change.
* tests/guix-environment.sh (GUIX_TEST_ZZZ): Test it.
Change-Id: Ib1db19ef73dda8f561b05731079a96eda076e365
Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Modified-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/guix-environment.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh index 56cb289f2ff..450f0265221 100644 --- a/tests/guix-environment.sh +++ b/tests/guix-environment.sh | |||
| @@ -49,18 +49,21 @@ test -x `sed -r 's/^export PATH="(.*)"/\1/' "$tmpdir/a"`/guile | |||
| 49 | 49 | ||
| 50 | cmp "$tmpdir/a" "$tmpdir/b" | 50 | cmp "$tmpdir/a" "$tmpdir/b" |
| 51 | 51 | ||
| 52 | # Check '--preserve'. | 52 | # Check '--preserve', as well as its -E VAR=VALUE special case. |
| 53 | GUIX_TEST_ABC=1 | 53 | GUIX_TEST_ABC=1 |
| 54 | GUIX_TEST_DEF=2 | 54 | GUIX_TEST_DEF=2 |
| 55 | GUIX_TEST_XYZ=3 | 55 | GUIX_TEST_XYZ=3 |
| 56 | GUIX_TEST_ZZZ=4 | ||
| 56 | export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ | 57 | export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ |
| 57 | guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ | 58 | guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ |
| 58 | --preserve='^GUIX_TEST_A' --preserve='^GUIX_TEST_D' \ | 59 | --preserve='^GUIX_TEST_A' --preserve='^GUIX_TEST_D' \ |
| 60 | --preserve='^GUIX_TEST_Z' -E 'GUIX_TEST_ZZZ=overridden' \ | ||
| 59 | -- "$SHELL" -c set > "$tmpdir/a" | 61 | -- "$SHELL" -c set > "$tmpdir/a" |
| 60 | grep '^PATH=' "$tmpdir/a" | 62 | grep '^PATH=' "$tmpdir/a" |
| 61 | grep '^GUIX_TEST_ABC=1' "$tmpdir/a" | 63 | grep '^GUIX_TEST_ABC=1' "$tmpdir/a" |
| 62 | grep '^GUIX_TEST_DEF=2' "$tmpdir/a" | 64 | grep '^GUIX_TEST_DEF=2' "$tmpdir/a" |
| 63 | grep '^GUIX_TEST_XYZ=3' "$tmpdir/a" && false | 65 | grep '^GUIX_TEST_XYZ=3' "$tmpdir/a" && false |
| 66 | grep '^GUIX_TEST_ZZZ=overridden' "$tmpdir/a" | ||
| 64 | 67 | ||
| 65 | # Make sure the exit value is preserved. | 68 | # Make sure the exit value is preserved. |
| 66 | if guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ | 69 | if guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ |
