Merge remote-tracking branch 'origin/master' into staging
[jackhill/guix/guix.git] / gnu / packages / ci.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
4 ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
5 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
6 ;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages ci)
25 #:use-module ((guix licenses) #:prefix l:)
26 #:use-module (gnu packages)
27 #:use-module (guix packages)
28 #:use-module (guix git-download)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages docbook)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages guile)
35 #:use-module (gnu packages guile-xyz)
36 #:use-module (gnu packages gnupg)
37 #:use-module (gnu packages mail)
38 #:use-module (gnu packages package-management)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages perl-compression)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages tls)
43 #:use-module (gnu packages texinfo)
44 #:use-module (gnu packages version-control)
45 #:use-module (gnu packages web)
46 #:use-module (gnu packages xml)
47 #:use-module (guix build-system gnu))
48
49 (define-public cuirass
50 (let ((commit "f2984c7230f69a6e50810edc5e9d36bd671801f9")
51 (revision "43"))
52 (package
53 (name "cuirass")
54 (version (git-version "0.0.1" revision commit))
55 (source (origin
56 (method git-fetch)
57 (uri (git-reference
58 (url "https://git.savannah.gnu.org/git/guix/guix-cuirass.git")
59 (commit commit)))
60 (file-name (git-file-name name version))
61 (sha256
62 (base32
63 "1p9mlmhv4kz8wixgywh1ffm3140p4mkgz92n7ry3n5s9w5n7fpjl"))))
64 (build-system gnu-build-system)
65 (arguments
66 '(#:modules ((guix build utils)
67 (guix build gnu-build-system)
68 (ice-9 rdelim)
69 (ice-9 popen))
70
71 #:configure-flags '("--localstatedir=/var") ;for /var/log/cuirass
72
73 #:phases
74 (modify-phases %standard-phases
75 (add-after 'unpack 'disable-repo-tests
76 (λ _
77 ;; Disable tests that use a connection to the Guix daemon.
78 (substitute* "Makefile.am"
79 (("tests/repo.scm \\\\") "\\"))
80 #t))
81 (add-after 'disable-repo-tests 'patch-/bin/sh
82 (lambda _
83 (substitute* "build-aux/git-version-gen"
84 (("#!/bin/sh") (string-append "#!" (which "sh"))))
85 #t))
86 (add-after 'install 'wrap-program
87 (lambda* (#:key inputs outputs #:allow-other-keys)
88 ;; Wrap the 'cuirass' command to refer to the right modules.
89 (let* ((out (assoc-ref outputs "out"))
90 (gcrypt (assoc-ref inputs "guile-gcrypt"))
91 (json (assoc-ref inputs "guile-json"))
92 (sqlite (assoc-ref inputs "guile-sqlite3"))
93 (git (assoc-ref inputs "guile-git"))
94 (bytes (assoc-ref inputs "guile-bytestructures"))
95 (fibers (assoc-ref inputs "guile-fibers"))
96 (zlib (assoc-ref inputs "guile-zlib"))
97 (guix (assoc-ref inputs "guix"))
98 (deps (list gcrypt json sqlite git bytes fibers
99 zlib guix))
100 (guile (assoc-ref %build-inputs "guile"))
101 (effective (read-line
102 (open-pipe* OPEN_READ
103 (string-append guile "/bin/guile")
104 "-c" "(display (effective-version))")))
105 (mods (string-drop-right ;drop trailing colon
106 (string-join deps
107 (string-append "/share/guile/site/"
108 effective ":")
109 'suffix)
110 1))
111 (objs (string-drop-right
112 (string-join deps
113 (string-append "/lib/guile/" effective
114 "/site-ccache:")
115 'suffix)
116 1)))
117 ;; Make sure 'cuirass' can find the 'evaluate' command, as
118 ;; well as the relevant Guile modules.
119 (wrap-program (string-append out "/bin/cuirass")
120 `("PATH" ":" prefix (,(string-append out "/bin")))
121 `("GUILE_LOAD_PATH" ":" prefix (,mods))
122 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
123 #t))))))
124 (inputs
125 `(("guile" ,@(assoc-ref (package-native-inputs guix) "guile"))
126 ("guile-fibers" ,guile-fibers)
127 ("guile-gcrypt" ,guile-gcrypt)
128 ("guile-json" ,guile-json-4)
129 ("guile-sqlite3" ,guile-sqlite3)
130 ("guile-git" ,guile-git)
131 ("guile-zlib" ,guile-zlib)
132 ;; FIXME: this is propagated by "guile-git", but it needs to be among
133 ;; the inputs to add it to GUILE_LOAD_PATH.
134 ("guile-bytestructures" ,guile-bytestructures)
135 ("guix" ,guix)))
136 (native-inputs
137 `(("autoconf" ,autoconf)
138 ("automake" ,automake)
139 ("pkg-config" ,pkg-config)
140 ("texinfo" ,texinfo)))
141 (native-search-paths
142 ;; For HTTPS access, Cuirass itself honors these variables, with the
143 ;; same semantics as Git and OpenSSL (respectively).
144 (list (search-path-specification
145 (variable "GIT_SSL_CAINFO")
146 (file-type 'regular)
147 (separator #f) ;single entry
148 (files '("etc/ssl/certs/ca-certificates.crt")))
149 (search-path-specification
150 (variable "SSL_CERT_DIR")
151 (files '("etc/ssl/certs")))))
152 (synopsis "Continuous integration system")
153 (description
154 "Cuirass is a continuous integration tool using GNU Guix. It is
155 intended as a replacement for Hydra.")
156 (home-page "https://www.gnu.org/software/guix/")
157 (license l:gpl3+))))