1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

gexp: Add compiler for <gexp-input>.

* guix/gexp.scm (gexp-input-compiler): New procedure.
* tests/gexp.scm ("gexp references non-existent output")
("gexp-input, as first-class input"): New tests.
* doc/guix.texi (G-Expressions): Document it.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I95b58d6e4d77a54364026b4324fbb00125a9402e
This commit is contained in:
Ludovic Courtès
2023-11-12 22:47:43 +01:00
parent 4771960e5d
commit d9190abbd2
3 changed files with 80 additions and 1 deletions

View File

@@ -393,6 +393,30 @@
(list item))
(null? (lowered-gexp-inputs lexp)))))
(test-equal "gexp references non-existent output"
"no-default-output"
(guard (c ((derivation-missing-output-error? c)
(derivation-name (derivation-error-derivation c))))
(let* ((obj (computed-file "no-default-output"
#~(mkdir #$output:bar)))
(exp #~(symlink #$obj #$output))
(drv (run-with-store %store (lower-gexp exp))))
(pk 'oops! drv #f))))
(test-assert "gexp-input, as first-class input"
;; Insert a <gexp-input> record in a gexp as a way to specify which output
;; of OBJ should be used.
(let* ((obj (computed-file "foo" #~(mkdir #$output:bar)))
(exp #~(list #$(gexp-input obj "bar")))
(drv (run-with-store %store (lower-object obj)))
(item (derivation->output-path drv "bar"))
(lexp (run-with-store %store (lower-gexp exp))))
(and (match (lowered-gexp-inputs lexp)
((input)
(eq? (derivation-input-derivation input) drv)))
(equal? (lowered-gexp-sexp lexp)
`(list ,item)))))
(test-assertm "with-parameters for %current-system"
(mlet* %store-monad ((system -> (match (%current-system)
("aarch64-linux" "x86_64-linux")