From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eTW7d-0004Ew-M3 for guix-patches@gnu.org; Mon, 25 Dec 2017 12:01:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eTW7a-0000Vm-GI for guix-patches@gnu.org; Mon, 25 Dec 2017 12:01:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:43330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eTW7a-0000Vh-Cd for guix-patches@gnu.org; Mon, 25 Dec 2017 12:01:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eTW7a-0006m0-1F for guix-patches@gnu.org; Mon, 25 Dec 2017 12:01:02 -0500 Subject: [bug#29820] [PATCH] services: cgit: Add more configuration fields. Resent-Message-ID: References: <87incy9yv6.fsf@gmail.com> From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: <87incy9yv6.fsf@gmail.com> Date: Mon, 25 Dec 2017 18:00:32 +0100 Message-ID: <87lghqbv4f.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain 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: Oleg Pykhalov Cc: 29820@debbugs.gnu.org Oleg Pykhalov writes: > From 26b620e568dd5ad6d2429138e3d34533cb764036 Mon Sep 17 00:00:00 2001 > From: Oleg Pykhalov > Date: Tue, 12 Dec 2017 02:13:55 +0300 > Subject: [PATCH] services: cgit: Add more configuration fields. > > * gnu/services/version-control.scm (cgit-service-type): Move to separate file. > * gnu/services/cgit.scm: New file. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add this. > * gnu/tests/version-control.scm (gnu): Add this. > * doc/guix.texi (Cgit Service): Document this. > --- > doc/guix.texi | 925 +++++++++++++++++++++++++++++++++++++-- > gnu/local.mk | 1 + > gnu/services/cgit.scm | 642 +++++++++++++++++++++++++++ > gnu/services/version-control.scm | 118 ----- > gnu/tests/version-control.scm | 1 + > 5 files changed, 1535 insertions(+), 152 deletions(-) > create mode 100644 gnu/services/cgit.scm Hi Oleg, thank you very much for this work! > +(define (serialize-repository-cgit-configuration x) > + (serialize-configuration x repository-cgit-configuration-fields)) 'url' needs to be the first setting specified for each repo. I think you could use something like this to make sure it is: (define (serialize-repository-cgit-configuration x) (define (rest? field) (not (eq? (configuration-field-name field) 'url))) (let ((url (repository-cgit-configuration-url x)) (rest (filter rest? repository-cgit-configuration-fields))) (serialize-repo-string 'url url) (serialize-configuration x rest))) The same mechanism could be used for 'snapshots' and 'source-filter', according to the Archlinux link you provided. > +(define (serialize-module-link-path field-name val) > + (if (null? val) > + "" > + (format #t "repo.~a.~a=~a\n" > + (uglify-field-name field-name) > + (car val) (cadr val)))) I think 'match' is better than 'car' and 'cadr' because it names things. > +(define (serialize-mimetype-alist field-name val) > + (format #t "# Mimetypes\n~a" > + (apply string-append > + (fold (lambda (x xs) > + (cons* (symbol->string (car x)) "=" (cadr x) "\n" xs)) > + '() val)))) Maybe you could use 'match' instead of 'car' and 'cadr'? And I think 'x' and 'xs' are not very clear. Also, isn't 'map' more natural than 'fold'? I'd use something like this: (define (serialize-mimetype-alist-clem field-name val) (format #t "# Mimetypes\n~a" (string-join (map (match-lambda ((extension mimetype) (format #f "~a=~a" (symbol->string extension) mimetype))) val) "\n"))) Another advantage is that the order won't be inverted. > + (defbranch > + (repo-string "") ^--- Extra space here (because of 'def' being interpreted by your text editor I reckon). > + "The name of the default branch for this repository. If no such branch Two spaces here :-) --------^ > + (email-filter > + (repo-string "") > + "Override the default @code{email-filter.}") }. ---^ > + (enable-remote-branches? > + (repo-boolean #f) > + "Flag which, when set to @code{#t}, will make Cgit display remote > +branches in the summary and refs views.") I think the official project uses 'cgit' instead of 'Cgit' (there are other occurrences where you use 'Cgit'). > +(define-configuration cgit-configuration > + (package > + (package cgit) ^--- There is one extra space here (because package is interpreted by your text editor I reckon). > + (footer > + (string "") > + "The content of the file specified with this option will be included > +verbatim at the bottom of all pages (i.e. it replaces the standard > +\"generated by...\" message.") I think you forgot the closing parenthesis inside the comment. > + (max-stats > + (string "") > + "Maximum statistics period. Valid values are @samp{week},@samp{month}, Space here :-) ---^ > +@samp{quarter} and @samp{year.}") }. ----^ > + (scan-hidden-path > + (boolean #f) > + "If set to @samp{#t} and repository-directory is enabled, > +repository-directory will recurse into directories whose name starts with a > +period. Otherwise, repository-directory will stay away from such directories, > +considered as \"hidden\". Note that this does not apply to the \".git\" Space here -----^ > + (repository-directory > + (repository-directory "/srv/git") > + "Name of the directory to scan for repositories.") I believe it would be clearer if it was named the same way cgit names it: scan-path.