hydra: guix-modular: Explicitly build for the latest 2.2.
[jackhill/guix/guix.git] / build-aux / hydra / gnu-system.scm
index 04845a3..e5326c4 100644 (file)
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
   ;; Use our very own Guix modules.
   (set! %fresh-auto-compile #t)
 
+  ;; Ignore .go files except for Guile's.  This is because our checkout in the
+  ;; store has mtime set to the epoch, and thus .go files look newer, even
+  ;; though they may not correspond.  Use 'reverse' so that /gnu/store/…-guile
+  ;; comes before /run/current-system/profile.
+  (set! %load-compiled-path
+    (list
+     (dirname (dirname (search-path (reverse %load-compiled-path)
+                                    "ice-9/boot-9.go")))))
+
   (and=> (assoc-ref (current-source-location) 'filename)
          (lambda (file)
            (let ((dir (string-append (dirname file) "/../..")))
@@ -51,6 +60,8 @@
              ((guix scripts system) #:select (read-operating-system))
              ((guix scripts pack)
               #:select (lookup-compressor self-contained-tarball))
+             (gnu bootloader)
+             (gnu bootloader u-boot)
              (gnu packages)
              (gnu packages gcc)
              (gnu packages base)
@@ -135,7 +146,10 @@ SYSTEM."
     "i686-w64-mingw32"))
 
 (define %guixsd-supported-systems
-  '("x86_64-linux" "i686-linux"))
+  '("x86_64-linux" "i686-linux" "armhf-linux"))
+
+(define %u-boot-systems
+  '("armhf-linux"))
 
 (define (qemu-jobs store system)
   "Return a list of jobs that build QEMU images for SYSTEM."
@@ -159,20 +173,32 @@ system.")
     (expt 2 20))
 
   (if (member system %guixsd-supported-systems)
-      (list (->job 'usb-image
-                   (run-with-store store
-                     (mbegin %store-monad
-                       (set-guile-for-build (default-guile))
-                       (system-disk-image installation-os
-                                          #:disk-image-size
-                                          (* 1024 MiB)))))
-            (->job 'iso9660-image
-                   (run-with-store store
-                     (mbegin %store-monad
-                       (set-guile-for-build (default-guile))
-                       (system-disk-image installation-os
-                                          #:file-system-type
-                                          "iso9660")))))
+      (if (member system %u-boot-systems)
+          (list (->job 'flash-image
+                       (run-with-store store
+                         (mbegin %store-monad
+                           (set-guile-for-build (default-guile))
+                           (system-disk-image
+                            (operating-system (inherit installation-os)
+                             (bootloader (bootloader-configuration
+                                          (bootloader u-boot-bootloader)
+                                          (target #f))))
+                            #:disk-image-size
+                            (* 1024 MiB))))))
+          (list (->job 'usb-image
+                       (run-with-store store
+                         (mbegin %store-monad
+                           (set-guile-for-build (default-guile))
+                           (system-disk-image installation-os
+                                              #:disk-image-size
+                                              (* 1024 MiB)))))
+                (->job 'iso9660-image
+                       (run-with-store store
+                         (mbegin %store-monad
+                           (set-guile-for-build (default-guile))
+                           (system-disk-image installation-os
+                                              #:file-system-type
+                                              "iso9660"))))))
       '()))
 
 (define (system-test-jobs store system)
@@ -297,6 +323,12 @@ valid."
       (((? string?) (? string?) ...) 'list)       ; only build selected list of packages
       (_ 'all)))                                  ; build everything
 
+  (define systems
+    (match (assoc-ref arguments 'systems)
+      (#f              %hydra-supported-systems)
+      ((lst ...)       lst)
+      ((? string? str) (call-with-input-string str read))))
+
   (define (cross-jobs system)
     (define (from-32-to-64? target)
       ;; Return true if SYSTEM is 32-bit and TARGET is 64-bit.  This hack
@@ -317,8 +349,15 @@ valid."
 
     (define (pointless? target)
       ;; Return #t if it makes no sense to cross-build to TARGET from SYSTEM.
-      (and (string-contains target "mingw")
-           (not (string=? "x86_64-linux" system))))
+      (match system
+        ((or "x86_64-linux" "i686-linux")
+         (if (string-contains target "mingw")
+             (not (string=? "x86_64-linux" system))
+             #f))
+        (_
+         ;; Don't try to cross-compile from non-Intel platforms: this isn't
+         ;; very useful and these are often brittle configurations.
+         #t)))
 
     (define (either proc1 proc2 proc3)
       (lambda (x)
@@ -380,4 +419,4 @@ valid."
                          '()))
                     (else
                      (error "unknown subset" subset))))
-                %hydra-supported-systems)))
+                systems)))