unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: 31089@debbugs.gnu.org
Subject: [bug#31089] [PATCH 5/5] services: cgit: Add support for project-list.
Date: Sat,  7 Apr 2018 19:07:09 +0200	[thread overview]
Message-ID: <20180407170709.22160-5-clement@lassieur.org> (raw)
In-Reply-To: <20180407170709.22160-1-clement@lassieur.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

  parent reply	other threads:[~2018-04-07 17:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 17:04 [bug#31089] cgit service: add support for file-like objects Clément Lassieur
2018-04-07 17:07 ` [bug#31089] [PATCH 1/5] services: cgit: Simplify 'uglify-field-name' Clément Lassieur
2018-04-07 17:07   ` [bug#31089] [PATCH 2/5] services: cgit: Simplify 'serialize-module-link-path' Clément Lassieur
2018-04-10 20:56     ` Ludovic Courtès
2018-04-07 17:07   ` [bug#31089] [PATCH 3/5] services: cgit: Add support for file-like objects Clément Lassieur
2018-04-09  7:19     ` Clément Lassieur
2018-04-10 20:59     ` Ludovic Courtès
2018-04-11  8:35       ` Clément Lassieur
2018-04-11 19:27         ` bug#31089: " Clément Lassieur
2018-04-07 17:07   ` [bug#31089] [PATCH 4/5] services: cgit: Enforce serialization order Clément Lassieur
2018-04-10 21:00     ` Ludovic Courtès
2018-04-07 17:07   ` Clément Lassieur [this message]
2018-04-10 21:00     ` [bug#31089] [PATCH 5/5] services: cgit: Add support for project-list Ludovic Courtès
2018-04-10 20:56   ` [bug#31089] [PATCH 1/5] services: cgit: Simplify 'uglify-field-name' Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180407170709.22160-5-clement@lassieur.org \
    --to=clement@lassieur.org \
    --cc=31089@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).