summary refs log tree commit diff
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-03-20 21:05:09 +0100
committerClément Lassieur <clement@lassieur.org>2018-04-11 21:23:59 +0200
commit80b76b93506cadc967164cb07093f86bafb5aa77 (patch)
tree983dd7c4487bbde37b84c5d8383aaf1cc416f231
parentad05e96e14ff61c5739a9f8fc79aba8ed6545d16 (diff)
downloadguix-80b76b93506cadc967164cb07093f86bafb5aa77.tar.gz
services: cgit: Enforce serialization order.
* gnu/services/cgit.scm (serialize-cgit-configuration): New procedure that
serializes fields with a precise order.
(cgit-activation): Replace the generic SERIALIZE-CONFIGURATION with
SERIALIZE-CGIT-CONFIGURATION.
-rw-r--r--gnu/services/cgit.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index 98e46e0b88..73d459ccf5 100644
--- a/gnu/services/cgit.scm
+++ b/gnu/services/cgit.scm
@@ -631,6 +631,19 @@ for cgit to allow access to that repository.")
    (list '())
    "Extra options will be appended to cgitrc file."))
 
+;; This distinguishes fields whose order matters, and makes sure further
+;; changes won't inadvertently change the order.
+(define (serialize-cgit-configuration config)
+  (define (rest? field)
+    (not (memq (configuration-field-name field)
+               '(repositories))))
+  #~(string-append
+     #$(let ((rest (filter rest? cgit-configuration-fields)))
+         (serialize-configuration config rest))
+     #$(serialize-repository-cgit-configuration-list
+        'repositories
+        (cgit-configuration-repositories config))))
+
 (define-configuration opaque-cgit-configuration
   (cgit
    (package cgit)
@@ -651,7 +664,7 @@ for cgit to allow access to that repository.")
          (config-str
           (if opaque-config?
               (opaque-cgit-configuration-cgitrc config)
-              (serialize-configuration config cgit-configuration-fields))))
+              (serialize-cgit-configuration config))))
     #~(begin
         (use-modules (guix build utils))
         (mkdir-p #$(if opaque-config?