[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/05: services: cgit: Add support for project-list.
From: |
Clément Lassieur |
Subject: |
05/05: services: cgit: Add support for project-list. |
Date: |
Wed, 11 Apr 2018 15:24:23 -0400 (EDT) |
snape pushed a commit to branch master
in repository guix.
commit e5fe544eaac4d478a09a9e22ffa460602f770910
Author: Clément Lassieur <address@hidden>
Date: Tue Mar 20 21:15:05 2018 +0100
services: cgit: Add support for project-list.
* doc/guix.texi (Version Control Services): Update accordingly.
* gnu/services/cgit.scm (cgit-configuration)[project-list]: New field.
(serialize-project-list): New procedure that uses PLAIN-FILE to generate a
file from the string list given by the user as input.
(serialize-cgit-configuration): Make sure to serialize 'project-list' before
'repostory-directory'.
---
doc/guix.texi | 9 +++++++++
gnu/services/cgit.scm | 28 ++++++++++++++++++++--------
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1e9601c..1bf9685 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19017,6 +19017,15 @@ Defaults to @samp{#f}.
@end deftypevr
address@hidden address@hidden parameter} list project-list
+A list of subdirectories inside of @code{repository-directory}, relative
+to it, that should loaded as Git repositories. An empty list means that
+all subdirectories will be loaded.
+
+Defaults to @samp{()}.
+
address@hidden deftypevr
+
@deftypevr address@hidden parameter} file-object readme
Text which will be used as default value for @code{cgit-repo-readme}.
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index 73d459c..8ef12cd 100644
--- a/gnu/services/cgit.scm
+++ b/gnu/services/cgit.scm
@@ -163,6 +163,12 @@
((path text)
(format #f "repo.module-link.~a=~a\n" path text)))))
+(define (serialize-project-list _ val)
+ (if (null? val) ""
+ (serialize-field
+ 'project-list
+ (plain-file "project-list" (string-join val "\n")))))
+
(define repository-directory? string?)
(define (serialize-repository-directory _ val)
@@ -536,13 +542,11 @@ disabled.")
(boolean #f)
"Flag which, when set to @samp{#t}, will make cgit omit the standard
header on all pages.")
- ;; TODO: cgit expects a file name
- ;; that should be created from a list of strings provided by the user.
- ;;
- ;; (project-list
- ;; (string "")
- ;; "A list of subdirectories inside of @code{repository-directory},
- ;; relative to it, that should loaded as Git repositories.")
+ (project-list
+ (list '())
+ "A list of subdirectories inside of @code{repository-directory}, relative
+to it, that should loaded as Git repositories. An empty list means that all
+subdirectories will be loaded.")
(readme
(file-object "")
"Text which will be used as default value for @code{cgit-repo-readme}.")
@@ -636,10 +640,18 @@ for cgit to allow access to that repository.")
(define (serialize-cgit-configuration config)
(define (rest? field)
(not (memq (configuration-field-name field)
- '(repositories))))
+ '(project-list
+ repository-directory
+ repositories))))
#~(string-append
#$(let ((rest (filter rest? cgit-configuration-fields)))
(serialize-configuration config rest))
+ #$(serialize-project-list
+ 'project-list
+ (cgit-configuration-project-list config))
+ #$(serialize-repository-directory
+ 'repository-directory
+ (cgit-configuration-repository-directory config))
#$(serialize-repository-cgit-configuration-list
'repositories
(cgit-configuration-repositories config))))