From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4rJu-0003eb-2k for guix-patches@gnu.org; Sat, 07 Apr 2018 13:08:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4rJr-0002fj-O0 for guix-patches@gnu.org; Sat, 07 Apr 2018 13:08:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:33583) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4rJr-0002fd-KR for guix-patches@gnu.org; Sat, 07 Apr 2018 13:08:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f4rJr-00031u-Fi for guix-patches@gnu.org; Sat, 07 Apr 2018 13:08:03 -0400 Subject: [bug#31089] [PATCH 5/5] services: cgit: Add support for project-list. Resent-Message-ID: From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Sat, 7 Apr 2018 19:07:09 +0200 Message-Id: <20180407170709.22160-5-clement@lassieur.org> In-Reply-To: <20180407170709.22160-1-clement@lassieur.org> References: <20180407170709.22160-1-clement@lassieur.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31089@debbugs.gnu.org * 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 35d23e1be..add29320e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19010,6 +19010,15 @@ Defaults to @samp{#f}. @end deftypevr +@deftypevr {@code{cgit-configuration} 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{()}. + +@end deftypevr + @deftypevr {@code{cgit-configuration} 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 f53306cd3..a39c09721 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}.") @@ -634,10 +638,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)))) -- 2.17.0