guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/06: profiles: Packages in a profile can be cross-compiled.


From: Ludovic Courtès
Subject: 02/06: profiles: Packages in a profile can be cross-compiled.
Date: Fri, 17 Mar 2017 19:42:31 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 176febe3776b272dffbe757414225702d08c3bdf
Author: Ludovic Courtès <address@hidden>
Date:   Fri Mar 17 21:48:40 2017 +0100

    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.
---
 guix/profiles.scm  | 10 +++++++---
 tests/profiles.scm | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index de82eae..a62a076 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
 ;;; Copyright © 2014, 2016 Alex Kost <address@hidden>
 ;;; Copyright © 2015 Mark H Weaver <address@hidden>
@@ -933,13 +933,16 @@ files for the truetype fonts of the @var{manifest} 
entries."
                              #:key
                              (hooks %default-profile-hooks)
                              (locales? #t)
-                             system)
+                             system target)
   "Return a derivation that builds a profile (aka. 'user environment') with
 the given MANIFEST.  The profile includes additional derivations returned by
 the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc.
 
 When LOCALES? is true, the build is performed under a UTF-8 locale; this adds
-a dependency on the 'glibc-utf8-locales' package."
+a dependency on the 'glibc-utf8-locales' package.
+
+When TARGET is true, it must be a GNU triplet, and the packages in MANIFEST
+are cross-built for TARGET."
   (mlet %store-monad ((system (if system
                                   (return system)
                                   (current-system)))
@@ -1000,6 +1003,7 @@ a dependency on the 'glibc-utf8-locales' package."
 
     (gexp->derivation "profile" builder
                       #:system system
+                      #:target target
 
                       ;; Not worth offloading.
                       #:local-build? #t
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 5536364..d0b1e14 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2014 Alex Kost <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -212,6 +212,35 @@
                                        #:locales? #f)))
     (return (derivation-inputs drv))))
 
+(test-assertm "profile-derivation, cross-compilation"
+  (mlet* %store-monad
+      ((manifest -> (packages->manifest (list packages:sed packages:grep)))
+       (target ->   "arm-linux-gnueabihf")
+       (grep        (package->cross-derivation packages:grep target))
+       (sed         (package->cross-derivation packages:sed target))
+       (locales     (package->derivation packages:glibc-utf8-locales))
+       (drv         (profile-derivation manifest
+                                        #:hooks '()
+                                        #:locales? #t
+                                        #:target target)))
+    (define (find-input name)
+      (let ((name (string-append name ".drv")))
+        (any (lambda (input)
+               (let ((input (derivation-input-path input)))
+                 (and (string-suffix? name input) input)))
+             (derivation-inputs drv))))
+
+    ;; The inputs for grep and sed should be cross-build derivations, but that
+    ;; for the glibc-utf8-locales should be a native build.
+    (return (and (string=? (derivation-system drv) (%current-system))
+                 (string=? (find-input (package-full-name packages:grep))
+                           (derivation-file-name grep))
+                 (string=? (find-input (package-full-name packages:sed))
+                           (derivation-file-name sed))
+                 (string=? (find-input
+                            (package-full-name packages:glibc-utf8-locales))
+                           (derivation-file-name locales))))))
+
 (test-assert "package->manifest-entry defaults to \"out\""
   (let ((outputs (package-outputs packages:glibc)))
     (equal? (manifest-entry-output



reply via email to

[Prev in Thread] Current Thread [Next in Thread]