[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/08: service: cuirass: Update it.
From: |
guix-commits |
Subject: |
06/08: service: cuirass: Update it. |
Date: |
Thu, 28 Jan 2021 07:00:05 -0500 (EST) |
mothacehe pushed a commit to branch master
in repository guix.
commit 0f01493dc893e43858953a37bc4859b323264524
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Fri Jan 15 17:10:41 2021 +0100
service: cuirass: Update it.
---
gnu/packages/ci.scm | 46 ++++++++++++++----------------
gnu/services/cuirass.scm | 74 +++++++++++++-----------------------------------
2 files changed, 40 insertions(+), 80 deletions(-)
diff --git a/gnu/packages/ci.scm b/gnu/packages/ci.scm
index 161b458..dad2e4e 100644
--- a/gnu/packages/ci.scm
+++ b/gnu/packages/ci.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
-;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2017, 2020, 2021 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;;
@@ -26,6 +26,7 @@
#:use-module (gnu packages)
#:use-module (guix packages)
#:use-module (guix git-download)
+ #:use-module (guix download)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages docbook)
@@ -68,8 +69,8 @@
(file-name (string-append name "-" version "-checkout")))))))
(define-public cuirass
- (let ((commit "697fa14584551d9595cd042f1ffeba240e45a127")
- (revision "56"))
+ (let ((commit "da6a5c0355e72d725003c9005a9974f2a476d999")
+ (revision "58"))
(package
(name "cuirass")
(version (git-version "0.0.1" revision commit))
@@ -81,43 +82,33 @@
(file-name (git-file-name name version))
(sha256
(base32
- "0gw9cja8fiyra9vnn3y384gwanvsqdq6gwjcvmz91sy5lvfwv34m"))))
+ "0p9ad0aisbl7clb3vi7zmfbnmnsnxq90vgx8v9ly5b0dgrav91p4"))))
(build-system gnu-build-system)
(arguments
'(#:modules ((guix build utils)
(guix build gnu-build-system)
(ice-9 rdelim)
(ice-9 popen))
-
#:configure-flags '("--localstatedir=/var") ;for /var/log/cuirass
-
+ #:tests? #f ;requires a PostgreSQL database.
#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'disable-repo-tests
- (lambda _
- ;; Disable tests that use a connection to the Guix daemon.
- (substitute* "Makefile.am"
- (("tests/repo.scm \\\\") "\\"))
- #t))
- (add-after 'disable-repo-tests 'patch-/bin/sh
- (lambda _
- (substitute* "build-aux/git-version-gen"
- (("#!/bin/sh") (string-append "#!" (which "sh"))))
- #t))
(add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Wrap the 'cuirass' command to refer to the right modules.
(let* ((out (assoc-ref outputs "out"))
+ (avahi (assoc-ref inputs "guile-avahi"))
(gcrypt (assoc-ref inputs "guile-gcrypt"))
(json (assoc-ref inputs "guile-json"))
- (sqlite (assoc-ref inputs "guile-sqlite3"))
+ (zmq (assoc-ref inputs "guile-simple-zmq"))
+ (squee (assoc-ref inputs "guile-squee"))
(git (assoc-ref inputs "guile-git"))
(bytes (assoc-ref inputs "guile-bytestructures"))
(fibers (assoc-ref inputs "guile-fibers"))
(zlib (assoc-ref inputs "guile-zlib"))
(guix (assoc-ref inputs "guix"))
- (deps (list gcrypt json sqlite git bytes fibers
- zlib guix))
+ (deps (list avahi gcrypt json zmq squee git bytes
+ fibers zlib guix))
(guile (assoc-ref %build-inputs "guile"))
(effective (read-line
(open-pipe* OPEN_READ
@@ -137,17 +128,22 @@
1)))
;; Make sure 'cuirass' can find the 'evaluate' command, as
;; well as the relevant Guile modules.
- (wrap-program (string-append out "/bin/cuirass")
- `("PATH" ":" prefix (,(string-append out "/bin")))
- `("GUILE_LOAD_PATH" ":" prefix (,mods))
- `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
+ (for-each
+ (lambda (name)
+ (wrap-program (string-append out "/bin/" name)
+ `("PATH" ":" prefix (,(string-append out "/bin")))
+ `("GUILE_LOAD_PATH" ":" prefix (,mods))
+ `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs))))
+ '("cuirass" "remote-server" "remote-worker"))
#t))))))
(inputs
`(("guile" ,guile-3.0/libgc-7)
+ ("guile-avahi" ,guile-avahi)
("guile-fibers" ,guile-fibers)
("guile-gcrypt" ,guile-gcrypt)
("guile-json" ,guile-json-4)
- ("guile-sqlite3" ,guile-sqlite3-dev)
+ ("guile-simple-zmq" ,guile-simple-zmq)
+ ("guile-squee" ,guile-squee)
("guile-git" ,guile-git)
("guile-zlib" ,guile-zlib)
;; FIXME: this is propagated by "guile-git", but it needs to be among
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index 7706ed4..cb98f1e 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -29,6 +29,7 @@
#:use-module (gnu packages version-control)
#:use-module (gnu services)
#:use-module (gnu services base)
+ #:use-module (gnu services databases)
#:use-module (gnu services shepherd)
#:use-module (gnu services admin)
#:use-module (gnu system shadow)
@@ -54,11 +55,6 @@
(default "/var/log/cuirass.log"))
(web-log-file cuirass-configuration-web-log-file ;string
(default "/var/log/cuirass-web.log"))
- (queries-log-file cuirass-configuration-queries-log-file ;string
- (default #f))
- (web-queries-log-file
- cuirass-configuration-web-queries-log-file ;string
- (default #f))
(cache-directory cuirass-configuration-cache-directory ;string (dir-name)
(default "/var/cache/cuirass"))
(ttl cuirass-configuration-ttl ;integer
@@ -69,10 +65,8 @@
(default "cuirass"))
(interval cuirass-configuration-interval ;integer (seconds)
(default 60))
- (queue-size cuirass-configuration-queue-size
- (default 1))
- (database cuirass-configuration-database ;string (file-name)
- (default "/var/lib/cuirass/cuirass.db"))
+ (database cuirass-configuration-database ;string
+ (default "dbname=cuirass host=/var/run/postgresql"))
(port cuirass-configuration-port ;integer (port)
(default 8081))
(host cuirass-configuration-host ;string
@@ -94,13 +88,9 @@
(cache-directory (cuirass-configuration-cache-directory config))
(web-log-file (cuirass-configuration-web-log-file config))
(log-file (cuirass-configuration-log-file config))
- (queries-log-file (cuirass-configuration-queries-log-file config))
- (web-queries-log-file
- (cuirass-configuration-web-queries-log-file config))
(user (cuirass-configuration-user config))
(group (cuirass-configuration-group config))
(interval (cuirass-configuration-interval config))
- (queue-size (cuirass-configuration-queue-size config))
(database (cuirass-configuration-database config))
(ttl (cuirass-configuration-ttl config))
(port (cuirass-configuration-port config))
@@ -113,7 +103,7 @@
(list (shepherd-service
(documentation "Run Cuirass.")
(provision '(cuirass))
- (requirement '(guix-daemon networking))
+ (requirement '(guix-daemon postgres networking))
(start #~(make-forkexec-constructor
(list (string-append #$cuirass "/bin/cuirass")
"--cache-directory" #$cache-directory
@@ -122,11 +112,6 @@
"--database" #$database
"--ttl" #$(string-append (number->string ttl) "s")
"--interval" #$(number->string interval)
- "--queue-size" #$(number->string queue-size)
- #$@(if queries-log-file
- (list (string-append "--log-queries="
- queries-log-file))
- '())
#$@(if use-substitutes? '("--use-substitutes") '())
#$@(if one-shot? '("--one-shot") '())
#$@(if fallback? '("--fallback") '())
@@ -144,22 +129,16 @@
(shepherd-service
(documentation "Run Cuirass web interface.")
(provision '(cuirass-web))
- (requirement '(guix-daemon networking))
+ (requirement '(guix-daemon postgres networking))
(start #~(make-forkexec-constructor
(list (string-append #$cuirass "/bin/cuirass")
"--cache-directory" #$cache-directory
- "--specifications"
- #$(scheme-file "cuirass-specs.scm" specs)
"--database" #$database
"--ttl" #$(string-append (number->string ttl) "s")
"--web"
"--port" #$(number->string port)
"--listen" #$host
"--interval" #$(number->string interval)
- #$@(if web-queries-log-file
- (list (string-append "--log-queries="
- web-queries-log-file))
- '())
#$@(if use-substitutes? '("--use-substitutes") '())
#$@(if fallback? '("--fallback") '())
#$@extra-options)
@@ -184,15 +163,18 @@
(home-directory (string-append "/var/lib/" cuirass-user))
(shell (file-append shadow "/sbin/nologin"))))))
+(define (cuirass-postgresql-role config)
+ (let ((user (cuirass-configuration-user config)))
+ (list (postgresql-role
+ (name user)
+ (create-database? #t)))))
+
(define (cuirass-activation config)
"Return the activation code for CONFIG."
(let ((cache (cuirass-configuration-cache-directory config))
(db (dirname (cuirass-configuration-database config)))
(user (cuirass-configuration-user config))
(log "/var/log/cuirass")
- (queries-log-file (cuirass-configuration-queries-log-file config))
- (web-queries-log-file
- (cuirass-configuration-web-queries-log-file config))
(group (cuirass-configuration-group config)))
(with-imported-modules '((guix build utils))
#~(begin
@@ -206,33 +188,14 @@
(gid (group:gid (getgr #$group))))
(chown #$cache uid gid)
(chown #$db uid gid)
- (chown #$log uid gid)
-
- (let ((queries-log-file #$queries-log-file))
- (when queries-log-file
- (call-with-output-file queries-log-file (const #t))
- (chown #$queries-log-file uid gid)))
-
- (let ((web-queries-log-file #$web-queries-log-file))
- (when web-queries-log-file
- (call-with-output-file web-queries-log-file (const #t))
- (chown web-queries-log-file uid gid))))))))
+ (chown #$log uid gid))))))
(define (cuirass-log-rotations config)
"Return the list of log rotations that corresponds to CONFIG."
- (let ((queries-log-file (cuirass-configuration-queries-log-file config))
- (web-queries-log-file
- (cuirass-configuration-web-queries-log-file config)))
- (list (log-rotation
- (files `(,(cuirass-configuration-log-file config)
- ,@(if queries-log-file
- (list queries-log-file)
- '())
- ,@(if web-queries-log-file
- (list web-queries-log-file)
- '())))
- (frequency 'weekly)
- (options '("rotate 40")))))) ;worth keeping
+ (list (log-rotation
+ (files (list (cuirass-configuration-log-file config)))
+ (frequency 'weekly)
+ (options '("rotate 40"))))) ;worth keeping
(define cuirass-service-type
(service-type
@@ -244,7 +207,8 @@
(service-extension rottlog-service-type cuirass-log-rotations)
(service-extension activation-service-type cuirass-activation)
(service-extension shepherd-root-service-type cuirass-shepherd-service)
- (service-extension account-service-type cuirass-account)))
+ (service-extension account-service-type cuirass-account)
+ (service-extension postgresql-role-service-type
+ cuirass-postgresql-role)))
(description
"Run the Cuirass continuous integration service.")))
-
- branch master updated (ff0ff69 -> f58d071), guix-commits, 2021/01/28
- 02/08: services: postgresql: Add socket directory support., guix-commits, 2021/01/28
- 03/08: services: postgresql: Add log directory support., guix-commits, 2021/01/28
- 06/08: service: cuirass: Update it.,
guix-commits <=
- 04/08: services: postgresql: Wrap long lines., guix-commits, 2021/01/28
- 08/08: tests: Add cuirass test., guix-commits, 2021/01/28
- 01/08: services: postgresql: Use Guile datatypes., guix-commits, 2021/01/28
- 05/08: services: postgresql: Add postgresql-role-service-type., guix-commits, 2021/01/28
- 07/08: services: cuirass: Add remote build support., guix-commits, 2021/01/28