diff options
| -rw-r--r-- | guix/scripts/system.scm | 11 | ||||
| -rw-r--r-- | tests/profiles.scm | 6 |
2 files changed, 4 insertions, 13 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index b9c60918f36..8277e24e5f7 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm | |||
| @@ -133,20 +133,9 @@ BODY..., and restore them." | |||
| 133 | (set! %load-path path) | 133 | (set! %load-path path) |
| 134 | (set! %load-compiled-path cpath))))) | 134 | (set! %load-compiled-path cpath))))) |
| 135 | 135 | ||
| 136 | (define-syntax-rule (save-environment-excursion body ...) | ||
| 137 | "Save the current environment variables, run BODY..., and restore them." | ||
| 138 | (let ((env (environ))) | ||
| 139 | (dynamic-wind | ||
| 140 | (const #t) | ||
| 141 | (lambda () | ||
| 142 | body ...) | ||
| 143 | (lambda () | ||
| 144 | (environ env))))) | ||
| 145 | |||
| 146 | (define topologically-sorted* | 136 | (define topologically-sorted* |
| 147 | (store-lift topologically-sorted)) | 137 | (store-lift topologically-sorted)) |
| 148 | 138 | ||
| 149 | |||
| 150 | (define* (copy-item item info target db | 139 | (define* (copy-item item info target db |
| 151 | #:key (log-port (current-error-port))) | 140 | #:key (log-port (current-error-port))) |
| 152 | "Copy ITEM to the store under root directory TARGET and populate DB with the | 141 | "Copy ITEM to the store under root directory TARGET and populate DB with the |
diff --git a/tests/profiles.scm b/tests/profiles.scm index 55e7146a7a0..e2472aa9e85 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm | |||
| @@ -367,11 +367,13 @@ | |||
| 367 | (profile -> (derivation->output-path drv)) | 367 | (profile -> (derivation->output-path drv)) |
| 368 | (bindir -> (string-append profile "/bin")) | 368 | (bindir -> (string-append profile "/bin")) |
| 369 | (_ (built-derivations (list drv)))) | 369 | (_ (built-derivations (list drv)))) |
| 370 | (define-syntax-rule (with-environment-excursion exp ...) | 370 | (define-syntax-rule (with-environment-excursion body ...) |
| 371 | ;; Save the current environment variables, run BODY..., and restore | ||
| 372 | ;; them. | ||
| 371 | (let ((env (environ))) | 373 | (let ((env (environ))) |
| 372 | (dynamic-wind | 374 | (dynamic-wind |
| 373 | (const #t) | 375 | (const #t) |
| 374 | (lambda () exp ...) | 376 | (lambda () body ...) |
| 375 | (lambda () (environ env))))) | 377 | (lambda () (environ env))))) |
| 376 | 378 | ||
| 377 | (return (and (with-environment-excursion | 379 | (return (and (with-environment-excursion |
