diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-12-06 23:12:49 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-01-04 23:44:26 +0100 |
commit | d63ee94d63c667e0c63651d6b775460f4c67497d (patch) | |
tree | b9b2615305e4c95fd80532b30f1517bfa28e499f /guix | |
parent | f918a8d9d80b9500d5f336c0d872fe06ef48c1e2 (diff) | |
download | gnu-guix-d63ee94d63c667e0c63651d6b775460f4c67497d.tar gnu-guix-d63ee94d63c667e0c63651d6b775460f4c67497d.tar.gz |
gexp: Add 'raw-derivation-file'.
* guix/gexp.scm (<raw-derivation-file>): New record type.
(raw-derivation-file-compiler): New gexp compiler.
* tests/gexp.scm ("lower-gexp, raw-derivation-file")
("raw-derivation-file"): New tests.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/gexp.scm | 26 |
1 files changed, 26 insertions, 0 deletions
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> + (raw-derivation-file obj) + raw-derivation-file? + (obj raw-derivation-file-object)) ;lowerable object + +(define-gexp-compiler raw-derivation-file-compiler <raw-derivation-file> + 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 <derivation> + ;; 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. |