From c3343d62f682b33b1eefce74e9b08585faa8680c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 25 Apr 2018 08:17:52 +0100 Subject: services: cgit: Improve handling of extra-options. * gnu/services/cgit.scm (serialize-cgit-configuration): Add the extra options, one per line, before the scan-path, as this makes it possible to use the extra-options to affect the global behaviour for repositories. (serialize-extra-options): New procedure. --- gnu/services/cgit.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gnu/services/cgit.scm') diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm index 8ef12cd5a0..3183535d4a 100644 --- a/gnu/services/cgit.scm +++ b/gnu/services/cgit.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Oleg Pykhalov ;;; Copyright © 2018 Clément Lassieur +;;; Copyright © 2018 Christopher Baines ;;; ;;; This file is part of GNU Guix. ;;; @@ -169,6 +170,9 @@ 'project-list (plain-file "project-list" (string-join val "\n"))))) +(define (serialize-extra-options extra-options) + (string-join extra-options "\n" 'suffix)) + (define repository-directory? string?) (define (serialize-repository-directory _ val) @@ -641,6 +645,7 @@ for cgit to allow access to that repository.") (define (rest? field) (not (memq (configuration-field-name field) '(project-list + extra-options repository-directory repositories)))) #~(string-append @@ -649,6 +654,8 @@ for cgit to allow access to that repository.") #$(serialize-project-list 'project-list (cgit-configuration-project-list config)) + #$(serialize-extra-options + (cgit-configuration-extra-options config)) #$(serialize-repository-directory 'repository-directory (cgit-configuration-repository-directory config)) -- cgit v1.2.3 From 6ee3f3dec72f87187226bc11ff190f030169e55a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 25 Apr 2018 08:18:38 +0100 Subject: services: cgit: Make project-list permit a file-object. Instead of having the service manage the list, it's useful to be able to point this at an existing file, for example, when using cgit together with gitolite. * gnu/services/cgit.scm (project-list?): New procedure. (serialize-project-list): Handle file-object values. (): Change the predicate for project-list to allow lists and file-objects. --- doc/guix.texi | 2 +- gnu/services/cgit.scm | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'gnu/services/cgit.scm') diff --git a/doc/guix.texi b/doc/guix.texi index 005c0597ad..81ad4f48f1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19241,7 +19241,7 @@ Defaults to @samp{#f}. @end deftypevr -@deftypevr {@code{cgit-configuration} parameter} list project-list +@deftypevr {@code{cgit-configuration} parameter} project-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. diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm index 3183535d4a..3289d37333 100644 --- a/gnu/services/cgit.scm +++ b/gnu/services/cgit.scm @@ -116,6 +116,10 @@ (define (serialize-file-object field-name val) (serialize-string field-name val)) +(define (project-list? val) + (or (list? val) + (file-object? val))) + ;;; ;;; Serialize @@ -168,7 +172,9 @@ (if (null? val) "" (serialize-field 'project-list - (plain-file "project-list" (string-join val "\n"))))) + (if (file-object? val) + val + (plain-file "project-list" (string-join val "\n")))))) (define (serialize-extra-options extra-options) (string-join extra-options "\n" 'suffix)) @@ -547,7 +553,7 @@ disabled.") "Flag which, when set to @samp{#t}, will make cgit omit the standard header on all pages.") (project-list - (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.") -- cgit v1.2.3