channels: Export channel-instance->sexp.
[jackhill/guix/guix.git] / build-aux / hydra / guix.scm
CommitLineData
59e6ae6c 1;;; GNU Guix --- Functional package management for GNU
df154c05 2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
59e6ae6c
LC
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/>.
18
19;;;
20;;; This file defines build jobs of Guix itself for the Hydra continuation
21;;; integration tool.
22;;;
23
24;; Attempt to use our very own Guix modules.
df154c05 25(eval-when (expand load eval)
59e6ae6c
LC
26
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)
31
a8bcd6eb
LC
32 ;; Display which files are loaded.
33 (set! %load-verbosely #t)
34
59e6ae6c
LC
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))))))
41
42
43(use-modules (guix store)
44 (guix packages)
45 (guix utils)
386f5415 46 (guix grafts)
97d010b7 47 (guix derivations)
59e6ae6c
LC
48 (guix build-system gnu)
49 (gnu packages package-management)
50 (srfi srfi-1)
d29aa3b5 51 (srfi srfi-26)
59e6ae6c
LC
52 (ice-9 match))
53
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))
58
59(define* (package->alist store package system
60 #:optional (package-derivation package-derivation))
61 "Convert PACKAGE to an alist suitable for Hydra."
3301f179 62 `((derivation . ,(derivation-file-name
386f5415
LC
63 (parameterize ((%graft? #f))
64 (package-derivation store package system
65 #:graft? #f))))
59e6ae6c
LC
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"))))
71
59e6ae6c
LC
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)))))
84
72d9148f 85 (define guix-checkout
59e6ae6c
LC
86 (assq-ref arguments 'guix))
87
06ce8e56 88 (let ((file (assq-ref guix-checkout 'file-name)))
a413bc8b 89 (format (current-error-port) "using checkout ~s (~s)~%"
06ce8e56 90 guix-checkout file)
386f5415 91
6ad507ae 92 `((tarball . ,(cute package->alist store
06ce8e56 93 (dist-package guix file)
386f5415
LC
94 (%current-system)))
95
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))))