From d63ee94d63c667e0c63651d6b775460f4c67497d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 6 Dec 2019 23:12:49 +0100 Subject: gexp: Add 'raw-derivation-file'. * guix/gexp.scm (): New record type. (raw-derivation-file-compiler): New gexp compiler. * tests/gexp.scm ("lower-gexp, raw-derivation-file") ("raw-derivation-file"): New tests. --- guix/gexp.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'guix') diff --git a/guix/gexp.scm b/guix/gexp.scm index 912960fd1d..c4f4e80209 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -79,6 +79,9 @@ file-append-base file-append-suffix + raw-derivation-file + raw-derivation-file? + load-path-expression gexp-modules @@ -265,6 +268,29 @@ The expander specifies how an object is converted to its sexp representation." (with-monad %store-monad (return drv))) +;; Expand to a raw ".drv" file for the lowerable object it wraps. In other +;; words, this gives the raw ".drv" file instead of its build result. +(define-record-type + (raw-derivation-file obj) + raw-derivation-file? + (obj raw-derivation-file-object)) ;lowerable object + +(define-gexp-compiler raw-derivation-file-compiler + compiler => (lambda (obj system target) + (mlet %store-monad ((obj (lower-object + (raw-derivation-file-object obj) + system #:target target))) + ;; Returning the .drv file name instead of the + ;; record ensures that 'lower-gexp' will classify it as a + ;; "source" and not as an "input". + (return (if (derivation? obj) + (derivation-file-name obj) + obj)))) + expander => (lambda (obj lowered output) + (if (derivation? lowered) + (derivation-file-name lowered) + lowered))) + ;;; ;;; File declarations. -- cgit v1.2.3