From: "Clément Lassieur" <clement@lassieur.org>
To: Oleg Pykhalov <go.wigust@gmail.com>
Cc: 29820@debbugs.gnu.org
Subject: [bug#29820] [PATCH] services: cgit: Add more configuration fields.
Date: Mon, 25 Dec 2017 18:00:32 +0100 [thread overview]
Message-ID: <87lghqbv4f.fsf@lassieur.org> (raw)
In-Reply-To: <87incy9yv6.fsf@gmail.com>
Oleg Pykhalov <go.wigust@gmail.com> writes:
> From 26b620e568dd5ad6d2429138e3d34533cb764036 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> 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.
next prev parent reply other threads:[~2017-12-25 17:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-22 22:33 [bug#29820] [PATCH] services: cgit: Add more configuration fields Oleg Pykhalov
2017-12-25 17:00 ` Clément Lassieur [this message]
2017-12-26 13:54 ` Clément Lassieur
2017-12-26 19:59 ` Clément Lassieur
2017-12-28 16:45 ` Oleg Pykhalov
2017-12-29 18:40 ` Clément Lassieur
2018-01-31 3:26 ` Oleg Pykhalov
2018-02-24 23:03 ` Clément Lassieur
2018-02-24 23:09 ` Clément Lassieur
2018-02-25 5:25 ` Oleg Pykhalov
2018-02-25 9:34 ` Clément Lassieur
2018-02-27 17:25 ` Ludovic Courtès
2018-02-28 1:50 ` bug#29820: " Oleg Pykhalov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lghqbv4f.fsf@lassieur.org \
--to=clement@lassieur.org \
--cc=29820@debbugs.gnu.org \
--cc=go.wigust@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.