summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-03-17 21:48:40 +0100
committerLudovic Courtès <ludo@gnu.org>2017-03-17 23:25:53 +0100
commit176febe3776b272dffbe757414225702d08c3bdf (patch)
treeb91d9240ae2cd46399aac5f2095dac7ebef111f4
parent48b444304e206c35cf2c8e0d87a4711f1aac4fd4 (diff)
profiles: Packages in a profile can be cross-compiled.
* guix/profiles.scm (profile-derivation): Add #:target parameter; pass it to 'gexp->derivation'. * tests/profiles.scm ("profile-derivation, cross-compilation"): New test.
-rw-r--r--guix/profiles.scm10
-rw-r--r--tests/profiles.scm31
2 files changed, 37 insertions, 4 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index de82eae3488..a62a076f64b 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> 3;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com> 4;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
5;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> 5;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
@@ -933,13 +933,16 @@ files for the truetype fonts of the @var{manifest} entries."
933 #:key 933 #:key
934 (hooks %default-profile-hooks) 934 (hooks %default-profile-hooks)
935 (locales? #t) 935 (locales? #t)
936 system) 936 system target)
937 "Return a derivation that builds a profile (aka. 'user environment') with 937 "Return a derivation that builds a profile (aka. 'user environment') with
938the given MANIFEST. The profile includes additional derivations returned by 938the given MANIFEST. The profile includes additional derivations returned by
939the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc. 939the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc.
940 940
941When LOCALES? is true, the build is performed under a UTF-8 locale; this adds 941When LOCALES? is true, the build is performed under a UTF-8 locale; this adds
942a dependency on the 'glibc-utf8-locales' package." 942a dependency on the 'glibc-utf8-locales' package.
943
944When TARGET is true, it must be a GNU triplet, and the packages in MANIFEST
945are cross-built for TARGET."
943 (mlet %store-monad ((system (if system 946 (mlet %store-monad ((system (if system
944 (return system) 947 (return system)
945 (current-system))) 948 (current-system)))
@@ -1000,6 +1003,7 @@ a dependency on the 'glibc-utf8-locales' package."
1000 1003
1001 (gexp->derivation "profile" builder 1004 (gexp->derivation "profile" builder
1002 #:system system 1005 #:system system
1006 #:target target
1003 1007
1004 ;; Not worth offloading. 1008 ;; Not worth offloading.
1005 #:local-build? #t 1009 #:local-build? #t
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 55363648892..d0b1e14a865 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2014 Alex Kost <alezost@gmail.com> 3;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
@@ -212,6 +212,35 @@
212 #:locales? #f))) 212 #:locales? #f)))
213 (return (derivation-inputs drv)))) 213 (return (derivation-inputs drv))))
214 214
215(test-assertm "profile-derivation, cross-compilation"
216 (mlet* %store-monad
217 ((manifest -> (packages->manifest (list packages:sed packages:grep)))
218 (target -> "arm-linux-gnueabihf")
219 (grep (package->cross-derivation packages:grep target))
220 (sed (package->cross-derivation packages:sed target))
221 (locales (package->derivation packages:glibc-utf8-locales))
222 (drv (profile-derivation manifest
223 #:hooks '()
224 #:locales? #t
225 #:target target)))
226 (define (find-input name)
227 (let ((name (string-append name ".drv")))
228 (any (lambda (input)
229 (let ((input (derivation-input-path input)))
230 (and (string-suffix? name input) input)))
231 (derivation-inputs drv))))
232
233 ;; The inputs for grep and sed should be cross-build derivations, but that
234 ;; for the glibc-utf8-locales should be a native build.
235 (return (and (string=? (derivation-system drv) (%current-system))
236 (string=? (find-input (package-full-name packages:grep))
237 (derivation-file-name grep))
238 (string=? (find-input (package-full-name packages:sed))
239 (derivation-file-name sed))
240 (string=? (find-input
241 (package-full-name packages:glibc-utf8-locales))
242 (derivation-file-name locales))))))
243
215(test-assert "package->manifest-entry defaults to \"out\"" 244(test-assert "package->manifest-entry defaults to \"out\""
216 (let ((outputs (package-outputs packages:glibc))) 245 (let ((outputs (package-outputs packages:glibc)))
217 (equal? (manifest-entry-output 246 (equal? (manifest-entry-output