* [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts.
2018-04-26 21:13 [bug#31277] [PATCH] cgit changes Christopher Baines
@ 2018-04-26 21:23 ` Christopher Baines
2018-04-26 21:23 ` [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options Christopher Baines
` (2 more replies)
2018-04-28 11:39 ` [bug#31277] [PATCH] cgit changes Clément Lassieur
2018-05-18 10:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
2 siblings, 3 replies; 16+ messages in thread
From: Christopher Baines @ 2018-04-26 21:23 UTC (permalink / raw)
To: 31277
Fix the about-formatting.sh, syntax-highlighting.py and html-converters files.
* gnu/packages/version-control.scm (cgit)[arguments]: Include
about-formatting.sh and the html-converters in the patch-absolute-file-names
phase and add a wrap-python-scripts phase to wrap syntax-highlighting.py and
the md2html converter.
[inputs]: Add groff, python, python-docutils, python-markdown and
python-pygments.
---
gnu/packages/version-control.scm | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index b82abaf9e..f75900d28 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -551,6 +551,21 @@ collaboration using typical untrusted file hosts or services.")
(quoted-file-name (assoc-ref inputs "bzip2") "/bin/bzip2"))
(("\"xz\"")
(quoted-file-name (assoc-ref inputs "xz") "/bin/xz")))
+
+ (substitute* "filters/about-formatting.sh"
+ (("$\\(dirname $0\\)") (string-append (assoc-ref outputs "out")
+ "/lib/cgit/filters"))
+ (("\\| tr") (string-append "| " (which "tr"))))
+
+ (substitute* "filters/html-converters/txt2html"
+ (("sed") (which "sed")))
+
+ (substitute* "filters/html-converters/man2html"
+ (("groff") (which "groff")))
+
+ (substitute* "filters/html-converters/rst2html"
+ (("rst2html\\.py") (which "rst2html.py")))
+
#t))
(delete 'configure) ; no configure script
(add-after 'build 'build-man
@@ -569,7 +584,17 @@ collaboration using typical untrusted file hosts or services.")
;; to get it stripped.
(rename-file (string-append out "/share/cgit/cgit.cgi")
(string-append out "/lib/cgit/cgit.cgi"))
- #t)))))))
+ #t))))
+ (add-after 'install 'wrap-python-scripts
+ (lambda* (#:key outputs #:allow-other-keys)
+ (for-each
+ (lambda (file)
+ (wrap-program (string-append (assoc-ref outputs "out")
+ "/lib/cgit/filters/" file)
+ `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))))
+ '("syntax-highlighting.py"
+ "html-converters/md2html"))
+ #t)))))
(native-inputs
;; For building manpage.
`(("asciidoc" ,asciidoc)
@@ -588,6 +613,11 @@ collaboration using typical untrusted file hosts or services.")
(base32
"1r2aa19gnrvm2y4fqcvpw1g9l72n48axqmpgv18s6d0y2p72vhzj"))))
("openssl" ,openssl)
+ ("groff" ,groff)
+ ("python" ,python)
+ ("python-docutils" ,python-docutils)
+ ("python-markdown" ,python-markdown)
+ ("python-pygments" ,python-pygments)
("zlib" ,zlib)))
(home-page "https://git.zx2c4.com/cgit/")
(synopsis "Web frontend for git repositories")
--
2.17.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options.
2018-04-26 21:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
@ 2018-04-26 21:23 ` Christopher Baines
2018-04-28 11:19 ` Clément Lassieur
2018-04-26 21:23 ` [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a string Christopher Baines
2018-04-28 11:30 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Clément Lassieur
2 siblings, 1 reply; 16+ messages in thread
From: Christopher Baines @ 2018-04-26 21:23 UTC (permalink / raw)
To: 31277
* 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.
---
gnu/services/cgit.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index 8ef12cd5a..bacd6ca16 100644
--- a/gnu/services/cgit.scm
+++ b/gnu/services/cgit.scm
@@ -642,13 +642,19 @@ for cgit to allow access to that repository.")
(not (memq (configuration-field-name field)
'(project-list
repository-directory
- repositories))))
+ repositories
+ extra-options))))
#~(string-append
#$(let ((rest (filter rest? cgit-configuration-fields)))
(serialize-configuration config rest))
#$(serialize-project-list
'project-list
(cgit-configuration-project-list config))
+ #$(string-join
+ (append
+ (cgit-configuration-extra-options config)
+ '(""))
+ "\n")
#$(serialize-repository-directory
'repository-directory
(cgit-configuration-repository-directory config))
--
2.17.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options.
2018-04-26 21:23 ` [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options Christopher Baines
@ 2018-04-28 11:19 ` Clément Lassieur
2018-05-18 10:56 ` Christopher Baines
0 siblings, 1 reply; 16+ messages in thread
From: Clément Lassieur @ 2018-04-28 11:19 UTC (permalink / raw)
To: Christopher Baines; +Cc: 31277
Christopher Baines <mail@cbaines.net> writes:
> * 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.
> ---
> gnu/services/cgit.scm | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
> index 8ef12cd5a..bacd6ca16 100644
> --- a/gnu/services/cgit.scm
> +++ b/gnu/services/cgit.scm
> @@ -642,13 +642,19 @@ for cgit to allow access to that repository.")
> (not (memq (configuration-field-name field)
> '(project-list
> repository-directory
> - repositories))))
> + repositories
> + extra-options))))
---^
Very small nitpick: could you put extra-options between project-list and
repository-directory there? So that the order is the same with what
comes below.
> #~(string-append
> #$(let ((rest (filter rest? cgit-configuration-fields)))
> (serialize-configuration config rest))
> #$(serialize-project-list
> 'project-list
> (cgit-configuration-project-list config))
> + #$(string-join
> + (append
> + (cgit-configuration-extra-options config)
> + '(""))
> + "\n")
Could you put the serialization code in a dedicated function?
(e.g. SERIALIZE-EXTRA-OPTION) So that SERIALIZE-CGIT-CONFIGURATION is
only responsible for the field ordering.
Also, I don't understand why you append '(""). If it's just to make
cgitrc look prettier, I'm not sure it's a good idea. But maybe I missed
something?
Otherwise LGTM :-)
Clément
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options.
2018-04-28 11:19 ` Clément Lassieur
@ 2018-05-18 10:56 ` Christopher Baines
0 siblings, 0 replies; 16+ messages in thread
From: Christopher Baines @ 2018-05-18 10:56 UTC (permalink / raw)
To: Clément Lassieur; +Cc: 31277
[-- Attachment #1: Type: text/plain, Size: 2056 bytes --]
Clément Lassieur <clement@lassieur.org> writes:
> Christopher Baines <mail@cbaines.net> writes:
>
>> * 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.
>> ---
>> gnu/services/cgit.scm | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
>> index 8ef12cd5a..bacd6ca16 100644
>> --- a/gnu/services/cgit.scm
>> +++ b/gnu/services/cgit.scm
>> @@ -642,13 +642,19 @@ for cgit to allow access to that repository.")
>> (not (memq (configuration-field-name field)
>> '(project-list
>> repository-directory
>> - repositories))))
>> + repositories
>> + extra-options))))
>
> ---^
> Very small nitpick: could you put extra-options between project-list and
> repository-directory there? So that the order is the same with what
> comes below.
Sure, this should be fixed now.
>> #~(string-append
>> #$(let ((rest (filter rest? cgit-configuration-fields)))
>> (serialize-configuration config rest))
>> #$(serialize-project-list
>> 'project-list
>> (cgit-configuration-project-list config))
>> + #$(string-join
>> + (append
>> + (cgit-configuration-extra-options config)
>> + '(""))
>> + "\n")
>
> Could you put the serialization code in a dedicated function?
> (e.g. SERIALIZE-EXTRA-OPTION) So that SERIALIZE-CGIT-CONFIGURATION is
> only responsible for the field ordering.
Done.
> Also, I don't understand why you append '(""). If it's just to make
> cgitrc look prettier, I'm not sure it's a good idea. But maybe I missed
> something?
The '("") was to add an extra newline effectively. I've replaced this by
using the 'suffix option of string-join in the updated patch.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a string.
2018-04-26 21:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
2018-04-26 21:23 ` [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options Christopher Baines
@ 2018-04-26 21:23 ` Christopher Baines
2018-04-28 10:57 ` Clément Lassieur
2018-04-28 11:30 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Clément Lassieur
2 siblings, 1 reply; 16+ messages in thread
From: Christopher Baines @ 2018-04-26 21:23 UTC (permalink / raw)
To: 31277
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 string values.
(<cgit-configuration>): Change the predicate for project-list to allow lists
and strings.
---
gnu/services/cgit.scm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index bacd6ca16..240d4d8d9 100644
--- a/gnu/services/cgit.scm
+++ b/gnu/services/cgit.scm
@@ -115,6 +115,10 @@
(define (serialize-file-object field-name val)
(serialize-string field-name val))
+(define (project-list? val)
+ (or (list? val)
+ (string? val)))
+
\f
;;;
;;; Serialize <nginx-server-configuration>
@@ -167,7 +171,9 @@
(if (null? val) ""
(serialize-field
'project-list
- (plain-file "project-list" (string-join val "\n")))))
+ (if (string? val)
+ val
+ (plain-file "project-list" (string-join val "\n"))))))
(define repository-directory? string?)
@@ -543,7 +549,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.")
--
2.17.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a string.
2018-04-26 21:23 ` [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a string Christopher Baines
@ 2018-04-28 10:57 ` Clément Lassieur
2018-05-18 10:57 ` Christopher Baines
0 siblings, 1 reply; 16+ messages in thread
From: Clément Lassieur @ 2018-04-28 10:57 UTC (permalink / raw)
To: Christopher Baines; +Cc: 31277
Christopher Baines <mail@cbaines.net> writes:
> 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 string values.
> (<cgit-configuration>): Change the predicate for project-list to allow lists
> and strings.
Hi Christopher,
Good idea! But could you replace 'string?' with 'file-object?', so that
the file can be in the store?
And could you update the documentation? There is a helper
(generate-cgit-documentation) that might help you do it.
Otherwise it looks good to me. Thank you!
Clément
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts.
2018-04-26 21:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
2018-04-26 21:23 ` [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options Christopher Baines
2018-04-26 21:23 ` [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a string Christopher Baines
@ 2018-04-28 11:30 ` Clément Lassieur
2018-05-18 10:55 ` Christopher Baines
2 siblings, 1 reply; 16+ messages in thread
From: Clément Lassieur @ 2018-04-28 11:30 UTC (permalink / raw)
To: Christopher Baines; +Cc: 31277
Christopher Baines <mail@cbaines.net> writes:
> Fix the about-formatting.sh, syntax-highlighting.py and html-converters files.
>
> * gnu/packages/version-control.scm (cgit)[arguments]: Include
> about-formatting.sh and the html-converters in the patch-absolute-file-names
> phase and add a wrap-python-scripts phase to wrap syntax-highlighting.py and
> the md2html converter.
> [inputs]: Add groff, python, python-docutils, python-markdown and
> python-pygments.
> ---
> gnu/packages/version-control.scm | 32 +++++++++++++++++++++++++++++++-
> 1 file changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
> index b82abaf9e..f75900d28 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -551,6 +551,21 @@ collaboration using typical untrusted file hosts or services.")
> (quoted-file-name (assoc-ref inputs "bzip2") "/bin/bzip2"))
> (("\"xz\"")
> (quoted-file-name (assoc-ref inputs "xz") "/bin/xz")))
> +
> + (substitute* "filters/about-formatting.sh"
> + (("$\\(dirname $0\\)") (string-append (assoc-ref outputs "out")
> + "/lib/cgit/filters"))
> + (("\\| tr") (string-append "| " (which "tr"))))
> +
> + (substitute* "filters/html-converters/txt2html"
> + (("sed") (which "sed")))
> +
> + (substitute* "filters/html-converters/man2html"
> + (("groff") (which "groff")))
> +
> + (substitute* "filters/html-converters/rst2html"
> + (("rst2html\\.py") (which "rst2html.py")))
> +
> #t))
> (delete 'configure) ; no configure script
> (add-after 'build 'build-man
> @@ -569,7 +584,17 @@ collaboration using typical untrusted file hosts or services.")
> ;; to get it stripped.
> (rename-file (string-append out "/share/cgit/cgit.cgi")
> (string-append out "/lib/cgit/cgit.cgi"))
> - #t)))))))
> + #t))))
> + (add-after 'install 'wrap-python-scripts
> + (lambda* (#:key outputs #:allow-other-keys)
> + (for-each
> + (lambda (file)
> + (wrap-program (string-append (assoc-ref outputs "out")
> + "/lib/cgit/filters/" file)
> + `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))))
> + '("syntax-highlighting.py"
> + "html-converters/md2html"))
> + #t)))))
> (native-inputs
> ;; For building manpage.
> `(("asciidoc" ,asciidoc)
> @@ -588,6 +613,11 @@ collaboration using typical untrusted file hosts or services.")
> (base32
> "1r2aa19gnrvm2y4fqcvpw1g9l72n48axqmpgv18s6d0y2p72vhzj"))))
> ("openssl" ,openssl)
> + ("groff" ,groff)
> + ("python" ,python)
> + ("python-docutils" ,python-docutils)
> + ("python-markdown" ,python-markdown)
> + ("python-pygments" ,python-pygments)
> ("zlib" ,zlib)))
> (home-page "https://git.zx2c4.com/cgit/")
> (synopsis "Web frontend for git repositories")
Great! LGTM :-)
Clément
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts.
2018-04-28 11:30 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Clément Lassieur
@ 2018-05-18 10:55 ` Christopher Baines
2018-05-18 15:49 ` Clément Lassieur
0 siblings, 1 reply; 16+ messages in thread
From: Christopher Baines @ 2018-05-18 10:55 UTC (permalink / raw)
To: Clément Lassieur; +Cc: 31277
[-- Attachment #1: Type: text/plain, Size: 819 bytes --]
Clément Lassieur <clement@lassieur.org> writes:
> Christopher Baines <mail@cbaines.net> writes:
>
>> Fix the about-formatting.sh, syntax-highlighting.py and html-converters files.
>>
>> * gnu/packages/version-control.scm (cgit)[arguments]: Include
>> about-formatting.sh and the html-converters in the patch-absolute-file-names
>> phase and add a wrap-python-scripts phase to wrap syntax-highlighting.py and
>> the md2html converter.
>> [inputs]: Add groff, python, python-docutils, python-markdown and
>> python-pygments.
>> ---
>> gnu/packages/version-control.scm | 32 +++++++++++++++++++++++++++++++-
>> 1 file changed, 31 insertions(+), 1 deletion(-)
>>
...
> Great! LGTM :-)
>
> Clément
Thanks for taking a look Clément, I've now sent another set of patches
with some changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts.
2018-05-18 10:55 ` Christopher Baines
@ 2018-05-18 15:49 ` Clément Lassieur
2018-05-18 18:13 ` bug#31277: " Christopher Baines
0 siblings, 1 reply; 16+ messages in thread
From: Clément Lassieur @ 2018-05-18 15:49 UTC (permalink / raw)
To: Christopher Baines; +Cc: 31277
Christopher Baines <mail@cbaines.net> writes:
> Clément Lassieur <clement@lassieur.org> writes:
>
>> Christopher Baines <mail@cbaines.net> writes:
>>
>>> Fix the about-formatting.sh, syntax-highlighting.py and html-converters files.
>>>
>>> * gnu/packages/version-control.scm (cgit)[arguments]: Include
>>> about-formatting.sh and the html-converters in the patch-absolute-file-names
>>> phase and add a wrap-python-scripts phase to wrap syntax-highlighting.py and
>>> the md2html converter.
>>> [inputs]: Add groff, python, python-docutils, python-markdown and
>>> python-pygments.
>>> ---
>>> gnu/packages/version-control.scm | 32 +++++++++++++++++++++++++++++++-
>>> 1 file changed, 31 insertions(+), 1 deletion(-)
>>>
>
> ...
>
>> Great! LGTM :-)
>>
>> Clément
>
> Thanks for taking a look Clément, I've now sent another set of patches
> with some changes.
Ok, thank you! LGTM then :-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31277: [PATCH 1/3] gnu: cgit: Fix included scripts.
2018-05-18 15:49 ` Clément Lassieur
@ 2018-05-18 18:13 ` Christopher Baines
0 siblings, 0 replies; 16+ messages in thread
From: Christopher Baines @ 2018-05-18 18:13 UTC (permalink / raw)
To: Clément Lassieur; +Cc: 31277-done
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]
Clément Lassieur <clement@lassieur.org> writes:
> Christopher Baines <mail@cbaines.net> writes:
>
>> Clément Lassieur <clement@lassieur.org> writes:
>>
>>> Christopher Baines <mail@cbaines.net> writes:
>>>
>>>> Fix the about-formatting.sh, syntax-highlighting.py and html-converters files.
>>>>
>>>> * gnu/packages/version-control.scm (cgit)[arguments]: Include
>>>> about-formatting.sh and the html-converters in the patch-absolute-file-names
>>>> phase and add a wrap-python-scripts phase to wrap syntax-highlighting.py and
>>>> the md2html converter.
>>>> [inputs]: Add groff, python, python-docutils, python-markdown and
>>>> python-pygments.
>>>> ---
>>>> gnu/packages/version-control.scm | 32 +++++++++++++++++++++++++++++++-
>>>> 1 file changed, 31 insertions(+), 1 deletion(-)
>>>>
>>
>> ...
>>
>>> Great! LGTM :-)
>>>
>>> Clément
>>
>> Thanks for taking a look Clément, I've now sent another set of patches
>> with some changes.
>
> Ok, thank you! LGTM then :-)
Great, I've pushed these patches now :)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH] cgit changes
2018-04-26 21:13 [bug#31277] [PATCH] cgit changes Christopher Baines
2018-04-26 21:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
@ 2018-04-28 11:39 ` Clément Lassieur
2018-05-18 10:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
2 siblings, 0 replies; 16+ messages in thread
From: Clément Lassieur @ 2018-04-28 11:39 UTC (permalink / raw)
To: Christopher Baines; +Cc: 31277
Oh, and please could you add copyright lines?
Thanks!
Clément
^ permalink raw reply [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts.
2018-04-26 21:13 [bug#31277] [PATCH] cgit changes Christopher Baines
2018-04-26 21:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
2018-04-28 11:39 ` [bug#31277] [PATCH] cgit changes Clément Lassieur
@ 2018-05-18 10:23 ` Christopher Baines
2018-05-18 10:23 ` [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options Christopher Baines
2018-05-18 10:23 ` [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a file-object Christopher Baines
2 siblings, 2 replies; 16+ messages in thread
From: Christopher Baines @ 2018-05-18 10:23 UTC (permalink / raw)
To: 31277
Fix the about-formatting.sh, syntax-highlighting.py and html-converters files.
* gnu/packages/version-control.scm (cgit)[arguments]: Include
about-formatting.sh and the html-converters in the patch-absolute-file-names
phase and add a wrap-python-scripts phase to wrap syntax-highlighting.py and
the md2html converter.
[inputs]: Add groff, python, python-docutils, python-markdown and
python-pygments.
---
gnu/packages/version-control.scm | 33 +++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index b41529d4f..f53d0f4fa 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -19,6 +19,7 @@
;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
+;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -551,6 +552,21 @@ collaboration using typical untrusted file hosts or services.")
(quoted-file-name (assoc-ref inputs "bzip2") "/bin/bzip2"))
(("\"xz\"")
(quoted-file-name (assoc-ref inputs "xz") "/bin/xz")))
+
+ (substitute* "filters/about-formatting.sh"
+ (("$\\(dirname $0\\)") (string-append (assoc-ref outputs "out")
+ "/lib/cgit/filters"))
+ (("\\| tr") (string-append "| " (which "tr"))))
+
+ (substitute* "filters/html-converters/txt2html"
+ (("sed") (which "sed")))
+
+ (substitute* "filters/html-converters/man2html"
+ (("groff") (which "groff")))
+
+ (substitute* "filters/html-converters/rst2html"
+ (("rst2html\\.py") (which "rst2html.py")))
+
#t))
(delete 'configure) ; no configure script
(add-after 'build 'build-man
@@ -569,7 +585,17 @@ collaboration using typical untrusted file hosts or services.")
;; to get it stripped.
(rename-file (string-append out "/share/cgit/cgit.cgi")
(string-append out "/lib/cgit/cgit.cgi"))
- #t)))))))
+ #t))))
+ (add-after 'install 'wrap-python-scripts
+ (lambda* (#:key outputs #:allow-other-keys)
+ (for-each
+ (lambda (file)
+ (wrap-program (string-append (assoc-ref outputs "out")
+ "/lib/cgit/filters/" file)
+ `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))))
+ '("syntax-highlighting.py"
+ "html-converters/md2html"))
+ #t)))))
(native-inputs
;; For building manpage.
`(("asciidoc" ,asciidoc)
@@ -588,6 +614,11 @@ collaboration using typical untrusted file hosts or services.")
(base32
"1r2aa19gnrvm2y4fqcvpw1g9l72n48axqmpgv18s6d0y2p72vhzj"))))
("openssl" ,openssl)
+ ("groff" ,groff)
+ ("python" ,python)
+ ("python-docutils" ,python-docutils)
+ ("python-markdown" ,python-markdown)
+ ("python-pygments" ,python-pygments)
("zlib" ,zlib)))
(home-page "https://git.zx2c4.com/cgit/")
(synopsis "Web frontend for git repositories")
--
2.17.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options.
2018-05-18 10:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
@ 2018-05-18 10:23 ` Christopher Baines
2018-05-18 10:23 ` [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a file-object Christopher Baines
1 sibling, 0 replies; 16+ messages in thread
From: Christopher Baines @ 2018-05-18 10:23 UTC (permalink / raw)
To: 31277
* 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(+)
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index 8ef12cd5a..3183535d4 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 <go.wigust@gmail.com>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
;;;
;;; 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))
--
2.17.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [bug#31277] [PATCH 3/3] services: cgit: Make project-list permit a file-object.
2018-05-18 10:23 ` [bug#31277] [PATCH 1/3] gnu: cgit: Fix included scripts Christopher Baines
2018-05-18 10:23 ` [bug#31277] [PATCH 2/3] services: cgit: Improve handling of extra-options Christopher Baines
@ 2018-05-18 10:23 ` Christopher Baines
1 sibling, 0 replies; 16+ messages in thread
From: Christopher Baines @ 2018-05-18 10:23 UTC (permalink / raw)
To: 31277
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.
(<cgit-configuration>): 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(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 005c0597a..81ad4f48f 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 3183535d4..3289d3733 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)))
+
\f
;;;
;;; Serialize <nginx-server-configuration>
@@ -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.")
--
2.17.0
^ permalink raw reply related [flat|nested] 16+ messages in thread