diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-09-20 11:58:32 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-09-20 19:24:31 +0200 |
| commit | 76c58ed59c05fa2ae14281109c9186e47ba810da (patch) | |
| tree | b021b38a1dcee12ff0d5b8576d0b8acd480c0cfa /tests | |
| parent | d0a1e48944cea22c6aebb22121eb21122a738d78 (diff) | |
home: import: Use (guix read-print) to render the config file.
* guix/scripts/home/import.scm (manifest+configuration-files->code):
Insert calls to 'comment' and 'vertical-space'.
(import-manifest): Use 'pretty-print-with-comments/splice' instead of a
loop on 'pretty-print'.
* tests/home-import.scm (remove-recursively): New procedure.
(eval-test-with-home-environment): Use it.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/home-import.scm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/home-import.scm b/tests/home-import.scm index d62a6de6484..04b7b761569 100644 --- a/tests/home-import.scm +++ b/tests/home-import.scm | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #:use-module (guix build utils) | 23 | #:use-module (guix build utils) |
| 24 | #:use-module (guix packages) | 24 | #:use-module (guix packages) |
| 25 | #:use-module (ice-9 match) | 25 | #:use-module (ice-9 match) |
| 26 | #:use-module ((guix read-print) #:select (blank?)) | ||
| 26 | #:use-module ((guix profiles) #:hide (manifest->code)) | 27 | #:use-module ((guix profiles) #:hide (manifest->code)) |
| 27 | #:use-module ((guix build syscalls) #:select (mkdtemp!)) | 28 | #:use-module ((guix build syscalls) #:select (mkdtemp!)) |
| 28 | #:use-module ((guix scripts package) | 29 | #:use-module ((guix scripts package) |
| @@ -85,13 +86,21 @@ corresponding file." | |||
| 85 | ((file . content) (create-file file content))) | 86 | ((file . content) (create-file file content))) |
| 86 | files-alist)) | 87 | files-alist)) |
| 87 | 88 | ||
| 89 | (define (remove-recursively pred sexp) | ||
| 90 | "Like SRFI-1 'remove', but recurse within SEXP." | ||
| 91 | (let loop ((sexp sexp)) | ||
| 92 | (match sexp | ||
| 93 | ((lst ...) | ||
| 94 | (map loop (remove pred lst))) | ||
| 95 | (x x)))) | ||
| 96 | |||
| 88 | (define (eval-test-with-home-environment files-alist manifest matcher) | 97 | (define (eval-test-with-home-environment files-alist manifest matcher) |
| 89 | (create-temporary-home files-alist) | 98 | (create-temporary-home files-alist) |
| 90 | (setenv "HOME" %temporary-home-directory) | 99 | (setenv "HOME" %temporary-home-directory) |
| 91 | (mkdir-p %temporary-home-directory) | 100 | (mkdir-p %temporary-home-directory) |
| 92 | (let* ((home-environment (manifest+configuration-files->code | 101 | (let* ((home-environment (manifest+configuration-files->code |
| 93 | manifest %destination-directory)) | 102 | manifest %destination-directory)) |
| 94 | (result (matcher home-environment))) | 103 | (result (matcher (remove-recursively blank? home-environment)))) |
| 95 | (delete-file-recursively %temporary-home-directory) | 104 | (delete-file-recursively %temporary-home-directory) |
| 96 | result)) | 105 | result)) |
| 97 | 106 | ||
