summaryrefslogtreecommitdiff
path: root/guix/build-system
diff options
context:
space:
mode:
Diffstat (limited to 'guix/build-system')
-rw-r--r--guix/build-system/trivial.scm42
1 files changed, 37 insertions, 5 deletions
diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm
index 350b1df553..b50ef7cd92 100644
--- a/guix/build-system/trivial.scm
+++ b/guix/build-system/trivial.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2018 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -36,7 +36,7 @@
(define* (lower name
#:key source inputs native-inputs outputs system target
- guile builder modules)
+ guile builder modules allowed-references)
"Return a bag for NAME."
(bag
(name name)
@@ -51,19 +51,36 @@
(build (if target trivial-cross-build trivial-build))
(arguments `(#:guile ,guile
#:builder ,builder
- #:modules ,modules))))
+ #:modules ,modules
+ #:allowed-references ,allowed-references))))
(define* (trivial-build store name inputs
#:key
outputs guile system builder (modules '())
- search-paths)
+ search-paths allowed-references)
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
ignored."
+ (define canonicalize-reference
+ (match-lambda
+ ((? package? p)
+ (derivation->output-path (package-derivation store p system
+ #:graft? #f)))
+ (((? package? p) output)
+ (derivation->output-path (package-derivation store p system
+ #:graft? #f)
+ output))
+ ((? string? output)
+ output)))
+
(build-expression->derivation store name builder
#:inputs inputs
#:system system
#:outputs outputs
#:modules modules
+ #:allowed-references
+ (and allowed-references
+ (map canonicalize-reference
+ allowed-references))
#:guile-for-build
(guile-for-build store guile system)))
@@ -71,14 +88,29 @@ ignored."
#:key
target native-drvs target-drvs
outputs guile system builder (modules '())
- search-paths native-search-paths)
+ search-paths native-search-paths
+ allowed-references)
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
ignored."
+ (define canonicalize-reference
+ (match-lambda
+ ((? package? p)
+ (derivation->output-path (package-cross-derivation store p system)))
+ (((? package? p) output)
+ (derivation->output-path (package-cross-derivation store p system)
+ output))
+ ((? string? output)
+ output)))
+
(build-expression->derivation store name builder
#:inputs (append native-drvs target-drvs)
#:system system
#:outputs outputs
#:modules modules
+ #:allowed-references
+ (and allowed-references
+ (map canonicalize-reference
+ allowed-references))
#:guile-for-build
(guile-for-build store guile system)))