guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: services: cuirass: Improve simple-cuirass-service


From: guix-commits
Subject: branch master updated: services: cuirass: Improve simple-cuirass-services.
Date: Tue, 23 Feb 2021 03:45:18 -0500

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new bebcf97  services: cuirass: Improve simple-cuirass-services.
bebcf97 is described below

commit bebcf97600b2fa65482ae8ee870800dafa34d3f8
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Feb 22 15:41:06 2021 +0100

    services: cuirass: Improve simple-cuirass-services.
    
    Instead of returning multiple services in simple-cuirass-services, rely on 
the
    instantiate-missing-services procedure to instantiate postgresql and
    postgresql-role-service-type when missing.
    
    Turn simple-cuirass-services procedure into
    simple-cuirass-configuration->specs, that takes a 
simple-cuirass-configuration
    record and returns a Cuirass specification.
    
    Suggested-by: Ludovic Courtès <ludo@gnu.org>
    
    * gnu/services/cuirass.scm (%default-cuirass-config): Remove it.
    (simple-cuirass-services): Rename it to ...
    (simple-cuirass-configuration->specs): ... this procedure.
    * gnu/tests/cuirass.scm (cuirass-services): Remove postgresql and
    postgresql-role services that are automatically instantiated.
    (simple-cuirass-service): New variable.
    (%cuirass-simple-test): Adapt it to use simple-cuirass-configuration->specs
    instead of simple-cuirass-services.
    * doc/guix.texi (Simple Cuirass): Update it.
---
 doc/guix.texi            | 62 ++++++++++++++++++++++++++++--------------------
 gnu/services/cuirass.scm | 22 +++--------------
 gnu/tests/cuirass.scm    | 33 +++++++++++++-------------
 3 files changed, 56 insertions(+), 61 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5f55853..1a467ce 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -27145,11 +27145,15 @@ The Cuirass package to use.
 @subsubheading Simple Cuirass
 
 The Cuirass service configuration described above can be a little
-intimidating.  The @code{simple-cuirass-services} procedure offers a way
-to setup a continuous integration server more readily.
-
-It takes a @code{simple-cuirass-configuration} record as its first
-argument.
+intimidating.  In particular, getting the right @code{specifications}
+can prove difficult.  The @code{simple-cuirass-configuration->specs}
+procedure offers a way to generate those @code{specifications} and thus
+setup a continuous integration server more readily.
+
+@deffn {Scheme Procedure} simple-cuirass-configuration->specs 
@var{configuration}
+This procedure takes a @code{simple-cuirass-configuration} record as
+argument and returns the corresponding Cuirass specifications gexp.
+@end deffn
 
 @deftp {Data Type} simple-cuirass-configuration
 Data type representing the configuration of a simple Cuirass instance.
@@ -27195,13 +27199,16 @@ is re-evaluated each time a commit is pushed in one 
of the declared
 channels.
 
 @lisp
-(simple-cuirass-services
- (simple-cuirass-configuration
-  (build 'all)
-  (channels (cons (channel
-                   (name 'my-guix)
-                   (url "https://my-git-repo/guix.git";))
-                  %default-channels))))
+(service cuirass-service-type
+         (cuirass-configuration
+          (specifications
+           (simple-cuirass-configuration->specs
+            (simple-cuirass-configuration
+             (build 'all)
+             (channels (cons (channel
+                              (name 'my-guix)
+                              (url "https://my-git-repo/guix.git";))
+                             %default-channels)))))))
 @end lisp
 
 In the same spirit, this builds all the packages that are part of the
@@ -27209,20 +27216,23 @@ In the same spirit, this builds all the packages that 
are part of the
 located in the @code{conf} channel.
 
 @lisp
-(simple-cuirass-services
- (simple-cuirass-configuration
-  (build (list
-          (build-manifest
-           (channel-name 'conf)
-           (manifest "guix/manifest.scm"))))
-  (channels (cons* (channel
-                    (name 'my-guix)
-                    (url "https://my-git-repo/guix.git";))
-                   (channel
-                    (name 'conf)
-                    (url "https://my-git-repo/conf.git";))
-                   %default-channels))
-  (non-package-channels '(conf))))
+(service cuirass-service-type
+         (cuirass-configuration
+          (specifications
+           (simple-cuirass-configuration->specs
+            (simple-cuirass-configuration
+             (build (list
+                     (build-manifest
+                      (channel-name 'conf)
+                      (manifest "guix/manifest.scm"))))
+             (channels (cons* (channel
+                               (name 'my-guix)
+                               (url "https://my-git-repo/guix.git";))
+                              (channel
+                               (name 'conf)
+                               (url "https://my-git-repo/conf.git";))
+                              %default-channels))
+             (non-package-channels '(conf)))))))
 @end lisp
 
 Finally, @code{simple-cuirass-services} takes as a second optional
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index 18163b5..b962f2f 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -60,8 +60,7 @@
             simple-cuirass-configuration
             simple-cuirass-configuration?
 
-            %default-cuirass-config
-            simple-cuirass-services))
+            simple-cuirass-configuration->specs))
 
 ;;;; Commentary:
 ;;;
@@ -419,13 +418,7 @@ CONFIG."
   (systems               simple-cuirass-configuration-systems
                          (default (list (%current-system))))) ;list of strings
 
-(define %default-cuirass-config
-  (cuirass-configuration
-   (specifications #~())))
-
-(define* (simple-cuirass-services config
-                                  #:optional
-                                  (cuirass %default-cuirass-config))
+(define* (simple-cuirass-configuration->specs config)
   (define (format-name name)
     (if (string? name)
         name
@@ -475,13 +468,4 @@ CONFIG."
         (#:build-outputs . ())
         (#:priority . 1))))
 
-  (list
-   (service cuirass-service-type
-            (cuirass-configuration
-             (inherit cuirass)
-             (specifications #~(list
-                                '#$(config->spec config)))))
-   (service postgresql-service-type
-            (postgresql-configuration
-             (postgresql postgresql-10)))
-   (service postgresql-role-service-type)))
+  #~(list '#$(config->spec config)))
diff --git a/gnu/tests/cuirass.scm b/gnu/tests/cuirass.scm
index 22eab3c..e833a04 100644
--- a/gnu/tests/cuirass.scm
+++ b/gnu/tests/cuirass.scm
@@ -132,11 +132,7 @@
              (remote-server (and remote-build?
                                  (cuirass-remote-server-configuration)))
              (host "0.0.0.0")
-             (use-substitutes? #t)))
-   (service postgresql-service-type
-            (postgresql-configuration
-             (postgresql postgresql-10)))
-   (service postgresql-role-service-type)))
+             (use-substitutes? #t)))))
 
 (define (run-cuirass-test name os)
   (define os*
@@ -286,6 +282,20 @@
      (description "Connect to a Cuirass server with remote build.")
      (value (run-cuirass-test name os)))))
 
+(define simple-cuirass-service
+  (service cuirass-service-type
+           (cuirass-configuration
+            (specifications
+             (simple-cuirass-configuration->specs
+              (simple-cuirass-configuration
+               (build 'all)
+               (channels
+                (list (channel
+                       (name 'guix)
+                       (url "file:///tmp/cuirass-main/")))))))
+            (host "0.0.0.0")
+            (use-substitutes? #t))))
+
 (define %cuirass-simple-test
   (let ((os (operating-system
               (inherit %simple-os)
@@ -293,17 +303,8 @@
                (append
                 (list cow-service
                       (service dhcp-client-service-type)
-                      git-service)
-                (simple-cuirass-services
-                 (simple-cuirass-configuration
-                  (build 'all)
-                  (channels (list (channel
-                                   (name 'guix)
-                                   (url "file:///tmp/cuirass-main/")))))
-                 (cuirass-configuration
-                  (inherit %default-cuirass-config)
-                  (host "0.0.0.0")
-                  (use-substitutes? #t)))
+                      git-service
+                      simple-cuirass-service)
                 (operating-system-user-services %simple-os))))))
     (system-test
      (name "cuirass-simple")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]