gnu: signify: Update to 26.
[guix.git] / build-aux / hydra / guix.scm
blob08193ec82e278181dd9a815493ef37b4f98cafc8
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
19 ;;;
20 ;;; This file defines build jobs of Guix itself for the Hydra continuation
21 ;;; integration tool.
22 ;;;
24 ;; Attempt to use our very own Guix modules.
25 (eval-when (expand load eval)
27   ;; Ignore any available .go, and force recompilation.  This is because our
28   ;; checkout in the store has mtime set to the epoch, and thus .go files look
29   ;; newer, even though they may not correspond.
30   (set! %fresh-auto-compile #t)
32   ;; Display which files are loaded.
33   (set! %load-verbosely #t)
35   (and=> (assoc-ref (current-source-location) 'filename)
36          (lambda (file)
37            (let ((dir (string-append (dirname file) "/../..")))
38              (format (current-error-port) "prepending ~s to the load path~%"
39                      dir)
40              (set! %load-path (cons dir %load-path))))))
43 (use-modules (guix store)
44              (guix packages)
45              (guix utils)
46              (guix grafts)
47              (guix derivations)
48              (guix build-system gnu)
49              (gnu packages package-management)
50              (srfi srfi-1)
51              (srfi srfi-26)
52              (ice-9 match))
54 ;; XXX: Debugging hack: since `hydra-eval-guile-jobs' redirects the output
55 ;; port to the bit bucket, let us write to the error port instead.
56 (setvbuf (current-error-port) _IOLBF)
57 (set-current-output-port (current-error-port))
59 (define* (package->alist store package system
60                          #:optional (package-derivation package-derivation))
61   "Convert PACKAGE to an alist suitable for Hydra."
62   `((derivation . ,(derivation-file-name
63                     (parameterize ((%graft? #f))
64                       (package-derivation store package system
65                                           #:graft? #f))))
66     (description . ,(package-synopsis package))
67     (long-description . ,(package-description package))
68     (license . ,(package-license package))
69     (home-page . ,(package-home-page package))
70     (maintainers . ("bug-guix@gnu.org"))))
72 (define (hydra-jobs store arguments)
73   "Return Hydra jobs."
74   (define systems
75     (match (filter-map (match-lambda
76                         (('system . value)
77                          value)
78                         (_ #f))
79                        arguments)
80       ((lst ..1)
81        lst)
82       (_
83        (list (%current-system)))))
85   (define guix-checkout
86     (assq-ref arguments 'guix))
88   (let ((file (assq-ref guix-checkout 'file-name)))
89     (format (current-error-port) "using checkout ~s (~s)~%"
90             guix-checkout file)
92     `((tarball . ,(cute package->alist store
93                         (dist-package guix file)
94                         (%current-system)))
96       ,@(map (lambda (system)
97                (let ((name (string->symbol
98                             (string-append "guix." system))))
99                  `(,name
100                    . ,(cute package->alist store
101                             (package
102                               (inherit guix)
103                               (version "latest")
104                               (source file))
105                             system))))
106              %hydra-supported-systems))))