GNU bug report logs - #29820
[PATCH] services: cgit: Add more configuration fields.

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Fri, 22 Dec 2017 22:35:01 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Clément Lassieur <clement <at> lassieur.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 29820 <at> debbugs.gnu.org
Subject: [bug#29820] [PATCH] services: cgit: Add more configuration fields.
Date: Mon, 25 Dec 2017 18:00:32 +0100
Oleg Pykhalov <go.wigust <at> gmail.com> writes:

> From 26b620e568dd5ad6d2429138e3d34533cb764036 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust <at> 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.




This bug report was last modified 7 years and 87 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.