diff options
| author | Maxime Devos <maximedevos@telenet.be> | 2022-03-03 14:14:22 +0000 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-03-13 23:20:07 +0100 |
| commit | 2e5c3d91fea5b583c541d70b4c318c2f81554d43 (patch) | |
| tree | e71a9fa0119d38668047f4e26fff46c813c297df | |
| parent | 5aec62ee0f69d691c1c1e322029463beb8bfc3cd (diff) | |
gexp: Correctly handle #$output in 'gexp->approximate-sexp'.
This addresses the following backtrace from
"guix lint -c wrapper-inputs hostapd":
Backtrace:ostapd@2.10 [wrapper-inputs]...
[...]
174:9 3 (gexp->approximate-sexp #<gexp (modify-phases %standard?>)
In srfi/srfi-1.scm:
586:17 2 (map1 (#<gexp-output out> #<gexp-input "pkg-config":o?>))
In guix/gexp.scm:
175:16 1 (_ _)
In ice-9/boot-9.scm:
1685:16 0 (raise-exception _ #:continuable? _)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" #<gexp-output out>)'.
* guix/gexp.scm (gexp->approximate-sexp): Handle the case where 'reference' is
a <gexp-output>,, by returning (*approximate*).
* tests/gexp.scm ("gexp->approximate-sexp, outputs"): Test it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| -rw-r--r-- | guix/gexp.scm | 3 | ||||
| -rw-r--r-- | tests/gexp.scm | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index 38114f88632..9fdb7a30be2 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm | |||
| @@ -181,7 +181,8 @@ As a result, the S-expression will be approximate if GEXP has references." | |||
| 181 | (#true | 181 | (#true |
| 182 | ;; Simply returning 'thing' won't work in some | 182 | ;; Simply returning 'thing' won't work in some |
| 183 | ;; situations; see 'write-gexp' below. | 183 | ;; situations; see 'write-gexp' below. |
| 184 | '(*approximate*)))))) | 184 | '(*approximate*)))) |
| 185 | (($ <gexp-output>) '(*approximate*)))) | ||
| 185 | (gexp-references gexp)))) | 186 | (gexp-references gexp)))) |
| 186 | 187 | ||
| 187 | (define (write-gexp gexp port) | 188 | (define (write-gexp gexp port) |
diff --git a/tests/gexp.scm b/tests/gexp.scm index 61ed5bc02d9..c80ca13fab7 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm | |||
| @@ -148,6 +148,11 @@ | |||
| 148 | (null? (gexp-inputs exp)) | 148 | (null? (gexp-inputs exp)) |
| 149 | (gexp->sexp* exp)))) | 149 | (gexp->sexp* exp)))) |
| 150 | 150 | ||
| 151 | (test-equal "gexp->approximate-sexp, outputs" | ||
| 152 | '(list 'out:foo (*approximate*) 'out:bar (*approximate*)) | ||
| 153 | (gexp->approximate-sexp | ||
| 154 | #~(list 'out:foo #$output:foo 'out:bar #$output:bar))) | ||
| 155 | |||
| 151 | (test-equal "unquote" | 156 | (test-equal "unquote" |
| 152 | '(display `(foo ,(+ 2 3))) | 157 | '(display `(foo ,(+ 2 3))) |
| 153 | (let ((exp (gexp (display `(foo ,(+ 2 3)))))) | 158 | (let ((exp (gexp (display `(foo ,(+ 2 3)))))) |
