Merge branch 'master' into core-updates
[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 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 "27af1d34646f4e3fca09283cb52caa8b89cbb2b1")
51 (revision "29"))
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 "199fzv4d18qslcggl7lj42ib600nckp0c40x7ahnb4rgnjw8ppyi"))))
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 (guix (assoc-ref inputs "guix"))
97 (deps (list gcrypt json sqlite git bytes fibers guix))
98 (guile (assoc-ref %build-inputs "guile"))
99 (effective (read-line
100 (open-pipe* OPEN_READ
101 (string-append guile "/bin/guile")
102 "-c" "(display (effective-version))")))
103 (mods (string-drop-right ;drop trailing colon
104 (string-join deps
105 (string-append "/share/guile/site/"
106 effective ":")
107 'suffix)
108 1))
109 (objs (string-drop-right
110 (string-join deps
111 (string-append "/lib/guile/" effective
112 "/site-ccache:")
113 'suffix)
114 1)))
115 ;; Make sure 'cuirass' can find the 'evaluate' command, as
116 ;; well as the relevant Guile modules.
117 (wrap-program (string-append out "/bin/cuirass")
118 `("PATH" ":" prefix (,(string-append out "/bin")))
119 `("GUILE_LOAD_PATH" ":" prefix (,mods))
120 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
121 #t))))))
122 (inputs
123 `(("guile" ,guile-3.0)
124 ("guile-fibers" ,guile-fibers)
125 ("guile-gcrypt" ,guile-gcrypt)
126 ("guile-json" ,guile-json-3)
127 ("guile-sqlite3" ,guile-sqlite3)
128 ("guile-git" ,guile-git)
129 ;; FIXME: this is propagated by "guile-git", but it needs to be among
130 ;; the inputs to add it to GUILE_LOAD_PATH.
131 ("guile-bytestructures" ,guile-bytestructures)
132 ("guix" ,guix)))
133 (native-inputs
134 `(("autoconf" ,autoconf)
135 ("automake" ,automake)
136 ("pkg-config" ,pkg-config)
137 ("texinfo" ,texinfo)))
138 (native-search-paths
139 ;; For HTTPS access, Cuirass itself honors these variables, with the
140 ;; same semantics as Git and OpenSSL (respectively).
141 (list (search-path-specification
142 (variable "GIT_SSL_CAINFO")
143 (file-type 'regular)
144 (separator #f) ;single entry
145 (files '("etc/ssl/certs/ca-certificates.crt")))
146 (search-path-specification
147 (variable "SSL_CERT_DIR")
148 (files '("etc/ssl/certs")))))
149 (synopsis "Continuous integration system")
150 (description
151 "Cuirass is a continuous integration tool using GNU Guix. It is
152 intended as a replacement for Hydra.")
153 (home-page "https://www.gnu.org/software/guix/")
154 (license l:gpl3+))))