Update license headers.
[jackhill/guix/guix.git] / hydra.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 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/>.
18
19 ;;;
20 ;;; This file defines build jobs for the Hydra continuation integration
21 ;;; tool.
22 ;;;
23
24 (use-modules (guix store)
25 (guix packages)
26 ((guix utils) #:select (%current-system))
27 (distro)
28 (distro packages base)
29 (distro packages guile)
30 (srfi srfi-1)
31 (srfi srfi-26)
32 (ice-9 match))
33
34 ;; XXX: Debugging hack: since `hydra-eval-guile-jobs' redirects the output
35 ;; port to the bit bucket, let us write to the error port instead.
36 (setvbuf (current-error-port) _IOLBF)
37 (set-current-output-port (current-error-port))
38
39 (define (package->alist store package system)
40 "Convert PACKAGE to an alist suitable for Hydra."
41 `((derivation . ,(package-derivation store package system))
42 (description . ,(package-synopsis package))
43 (long-description . ,(package-description package))
44 (license . ,(package-license package))
45 (home-page . ,(package-home-page package))
46 (maintainers . ("bug-guix@gnu.org"))))
47
48 (define (package-job store job-name package system)
49 "Return a job called JOB-NAME that builds PACKAGE on SYSTEM."
50 `(,job-name . ,(cut package->alist store package system)))
51
52 (define (hydra-jobs store arguments)
53 "Return Hydra jobs."
54 (define system
55 (or (assoc-ref arguments system)
56 (%current-system)))
57
58 ;; Return one job for each package, except bootstrap packages.
59 (let ((base-packages (delete-duplicates
60 (append-map (match-lambda
61 ((_ package _ ...)
62 (match (package-transitive-inputs
63 package)
64 (((_ inputs _ ...) ...)
65 inputs))))
66 %final-inputs))))
67 (fold-packages (lambda (package result)
68 (if (member package base-packages)
69 result
70 (let ((name (string->symbol
71 (package-full-name package))))
72 (cons (package-job store name package
73 system)
74 result))))
75 '())))