guix build: Honor '--system' for file-like objects and gexps.

Fixes a bug whereby "guix build -f file.scm -s SYSTEM" would not honor
SYSTEM when 'file.scm' returns a gexp or a file-like object.

* guix/scripts/build.scm (options->derivations): Pass #:system to
'run-with-store' in the 'file-like?' and 'gexp?' cases.
This commit is contained in:
Ludovic Courtès 2019-01-05 00:04:12 +01:00
parent 9ec154f51f
commit ec651f2562
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -788,13 +788,15 @@ package '~a' has no source~%")
((? file-like? obj) ((? file-like? obj)
(list (run-with-store store (list (run-with-store store
(lower-object obj system (lower-object obj system
#:target (assoc-ref opts 'target))))) #:target (assoc-ref opts 'target))
#:system system)))
((? gexp? gexp) ((? gexp? gexp)
(list (run-with-store store (list (run-with-store store
(mbegin %store-monad (mbegin %store-monad
(set-guile-for-build (default-guile)) (set-guile-for-build (default-guile))
(gexp->derivation "gexp" gexp (gexp->derivation "gexp" gexp
#:system system)))))) #:system system))
#:system system))))
(map (cut transform store <>) (map (cut transform store <>)
(options->things-to-build opts)))))) (options->things-to-build opts))))))