[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/22: gexp: Add 'with-build-variables'.
From: |
guix-commits |
Subject: |
01/22: gexp: Add 'with-build-variables'. |
Date: |
Tue, 30 Mar 2021 17:00:12 -0400 (EDT) |
civodul pushed a commit to branch core-updates
in repository guix.
commit 789babb76174758cbe0f159d4f61a65aefa9b4a4
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Mar 8 09:39:27 2021 +0100
gexp: Add 'with-build-variables'.
* guix/gexp.scm (with-build-variables): New procedure.
---
guix/gexp.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 78ce199..6bdc7ba 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -104,6 +104,7 @@
lowered-gexp-load-path
lowered-gexp-load-compiled-path
+ with-build-variables
gexp->derivation
gexp->file
gexp->script
@@ -1786,6 +1787,30 @@ are searched for in PATH. Return #f when MODULES and
EXTENSIONS are empty."
extensions))
%load-compiled-path)))))))))
+(define (with-build-variables inputs outputs body)
+ "Return a gexp that surrounds BODY with a definition of the legacy
+'%build-inputs', '%outputs', and '%output' variables based on INPUTS, a list
+of name/gexp-input tuples, and OUTPUTS, a list of strings."
+
+ ;; These two variables are defined for backward compatibility. They are
+ ;; used by package expressions. These must be top-level defines so that
+ ;; 'use-modules' form in BODY that are required for macro expansion work as
+ ;; expected.
+ (gexp (begin
+ (define %build-inputs
+ (map (lambda (tuple)
+ (apply cons tuple))
+ '(ungexp inputs)))
+ (define %outputs
+ (list (ungexp-splicing
+ (map (lambda (name)
+ (gexp (cons (ungexp name)
+ (ungexp output name))))
+ outputs))))
+ (define %output
+ (assoc-ref %outputs "out"))
+ (ungexp body))))
+
(define* (gexp->script name exp
#:key (guile (default-guile))
(module-path %load-path)
- branch core-updates updated (cea364e -> 2eafeb2), guix-commits, 2021/03/30
- 01/22: gexp: Add 'with-build-variables'.,
guix-commits <=
- 02/22: gexp: Optimize 'with-build-variables'., guix-commits, 2021/03/30
- 13/22: packages: Call 'bag-grafts' only on the tip of the package graph., guix-commits, 2021/03/30
- 17/22: gnu: docbook-xsl: Move 'use-modules' form to the top level., guix-commits, 2021/03/30
- 15/22: gexp: Allowed/disallowed references and graphs never refer to grafted inputs., guix-commits, 2021/03/30
- 04/22: packages: Turn 'bag->derivation' into a monadic procedure., guix-commits, 2021/03/30
- 03/22: build-system: Rewrite using gexps., guix-commits, 2021/03/30
- 05/22: packages: Simplify patch instantiation., guix-commits, 2021/03/30
- 11/22: packages: '%standard-patch-inputs' is not influenced by '%current-target-system'., guix-commits, 2021/03/30
- 10/22: build-system: Use 'input-tuples->gexp' and 'outputs->gexp'., guix-commits, 2021/03/30
- 07/22: packages: Default origin 'patch-flags' is a gexp., guix-commits, 2021/03/30