[PATCH] Add gitile and gitile service

  • Done
  • quality assurance status badge
Details
3 participants
  • Julien Lepiller
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Julien Lepiller
Severity
normal
J
M
M
Maxime Devos wrote on 5 Aug 2021 16:58
ce8fa1553cfe2cde7a10f4f3828ef5f711b44aeb.camel@telenet.be
Julien Lepiller schreef op do 05-08-2021 om 03:51 [+0200]:
Toggle quote (4 lines)
> + (add-after 'install-bin 'wrap-program
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + ;; Wrap the 'cuirass' command to refer to the right modules.

'gitile' isn't "cuirass".

Toggle quote (11 lines)
> + (let* ((out (assoc-ref outputs "out"))
> + (commonmark (assoc-ref inputs "guile-commonmark"))
> + (git (assoc-ref inputs "guile-git"))
> + (bytes (assoc-ref inputs "guile-bytestructures"))
> + (fibers (assoc-ref inputs "guile-fibers"))
> + (gcrypt (assoc-ref inputs "guile-gcrypt"))
> + (syntax-highlight (assoc-ref inputs "guile-syntax-highlight"))
> + (deps (list out commonmark git bytes fibers gcrypt
> + syntax-highlight))
> + (guile (assoc-ref %build-inputs "guile"))

I wold use 'inputs' instead of '%build-inputs' here.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYQv8pRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kCFAPwOVVkguOlHZ2g3xlfP3KcEdChI
meaDye4S0xG2vnlMJQEAqPcafweVmkpSjsBkRkWC8IiEFFvcdxLd0OrJYOqtIQ8=
=nML3
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 10 Aug 2021 12:38
Re: bug#49886: [PATCH] Add gitile and gitile service
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49886@debbugs.gnu.org)
87lf59shyi.fsf@gnu.org
Hello!

Julien Lepiller <julien@lepiller.eu> skribis:

Toggle quote (4 lines)
> Attached is a small patch series that adds gitile and the associated
> service type. Gitile is a small git forge project I have, and some of
> you expressed their interest, so here it is :)

Woohoo, nice! To complement Maxime’s comments:

Toggle quote (7 lines)
> From 38773e575b313caedfc788d4e28fd219265b4254 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Thu, 5 Aug 2021 02:57:32 +0200
> Subject: [PATCH 1/2] gnu: Add gitile.
>
> * gnu/packages/version-control.scm (gitile): New variable.

[...]

Toggle quote (3 lines)
> + (synopsis "Simple git forge written in Guile")
> + (description "Gitile is a git forge written in Guile that lets you

s/git/Git/

Toggle quote (8 lines)
> From 3cd7ef0ae922d77ff5d29c831dbdf8d350210fb7 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Thu, 5 Aug 2021 03:46:40 +0200
> Subject: [PATCH 2/2] gnu: version-control: Add gitile service.
>
> * gnu/services/version-control.scm (gitile-service-type): New variable.
> * doc/guix.texi (Version Control Services): Document it.

[...]

Toggle quote (7 lines)
> +@subsubheading Gitile Service
> +
> +@cindex Gitile service
> +@cindex Git, forge
> +@uref{https://git.lepiller.eu/gitile, Gitile} is a Git forge for viewing
> +public git repository contents from a web browser.

s/git/Git/

Toggle quote (30 lines)
> +Gitile works best in collaboration with Gitolite, and will serve the public
> +repositories from Gitolite by default.
> +
> +The following example will configure Gitile to serve repositories from a
> +custom location, with some default messages for the home page and the
> +footers.
> +
> +@lisp
> +(service gitile-service-type
> + (gitile-configuration
> + (repositories "/srv/git")
> + (base-git-url "https://myweb.site/git")
> + (index-title "My git repositories")
> + (intro '((p "This is all my public work!")))
> + (footer '((p "This is the end")))
> + (nginx-server-block
> + (nginx-server-configuration
> + (ssl-certificate
> + "/etc/letsencrypt/live/myweb.site/fullchain.pem")
> + (ssl-certificate-key
> + "/etc/letsencrypt/live/myweb.site/privkey.pem")
> + (listen '("443 ssl http2" "[::]:443 ssl http2"))
> + (locations
> + (list
> + (git-http-nginx-location-configuration
> + (git-http-configuration
> + (uri-path "/git/")
> + (git-root "/var/lib/gitolite/repositories")))))))))
> +@end lisp

Could you write a couple of lines about the nginx server block? It’s
quite intimidating and it’s not introduced in the paragraph above.


[...]

Toggle quote (2 lines)
> + <gitile-configuration>

No need to export the record type descriptor.

Toggle quote (8 lines)
> + (start (let ((gitile (file-append package "/bin/gitile")))
> + #~(make-forkexec-constructor
> + `(,#$gitile "-c" #$(gitile-config-file
> + host port database
> + repositories
> + base-git-url index-title
> + intro footer))

As a followup it’d be interesting to see if it can run in
‘make-forkexec-constructor/container’.

Toggle quote (11 lines)
> +(define gitile-service-type
> + (service-type
> + (name 'gitile)
> + (extensions
> + (list (service-extension account-service-type
> + (const %gitile-accounts))
> + (service-extension shepherd-root-service-type
> + gitile-shepherd-service)
> + (service-extension nginx-service-type
> + gitile-nginx-server-block)))))

Please add a ‘description’ field.

Would be great if you could add a system test too.

Otherwise LGTM, it’s exciting to get more Guilish tooling! :-)

Ludo’.
J
J
Julien Lepiller wrote on 25 Aug 2021 23:31
Re: bug#49886: [PATCH v2] Add gitile and gitile service
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49886@debbugs.gnu.org)
20210825233136.450d778b@tachikoma.lepiller.eu
Thanks for the feedback!

attached is a v2 of the series. I added a small change to gitolite that
allows changing UNSAFE_PATT (a regex that matches configuration values
that contain unsafe characters). I wanted to link to it and to the
nginx configuration sections in the manual, but I don't know how to
create that link? I see the @subsubheading NGINX for instance, but I
can't @ref{NGINX}.

I had to update gitile for the tests to pass and had a few false
starts, but now the tests pass and gitile is working even better than
before :)
From 2652e5515c84505c63072309f3b3e7837649cdb9 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Wed, 25 Aug 2021 03:00:44 +0200
Subject: [PATCH 2/3] gnu: gitolite: Add unsafe-patt configuration option.

* gnu/services/version-control.scm (gitolite-rc-file): Add unsafe-patt
field.
(gitolite-rc-file-compiler): Write it.
* doc/guix.texi (Version Control Services): Document it.
---
doc/guix.texi | 9 +++++++++
gnu/services/version-control.scm | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

Toggle diff (62 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index a826171f34..29a2fffdfd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31426,6 +31426,15 @@ A value like @code{#o0027} will give read access to the group used by Gitolite
(by default: @code{git}). This is necessary when using Gitolite with software
like cgit or gitweb.
+@item @code{unsafe-patt} (default: @code{#f})
+An optional pattern for catching unsafe configurations in the configuration
+file. See
+@uref{https://gitolite.com/gitolite/git-config.html#compensating-for-unsafe_patt,
+Gitolite's documentation} for more information.
+
+When the value is not @code{#f}, it should be a string containing a Perl
+regular expression, such as @samp{"[`~#\$\&()|;<>]"}.
+
@item @code{git-config-keys} (default: @code{""})
Gitolite allows you to set git config values using the @samp{config}
keyword. This setting allows control over the config keys to accept.
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index 8cb5633165..d0ac2e4a18 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -54,6 +54,7 @@
<gitolite-rc-file>
gitolite-rc-file
gitolite-rc-file-umask
+ gitolite-rc-file-unsafe-patt
gitolite-rc-file-git-config-keys
gitolite-rc-file-roles
gitolite-rc-file-enable
@@ -226,6 +227,8 @@ access to exported repositories under @file{/srv/git}."
gitolite-rc-file?
(umask gitolite-rc-file-umask
(default #o0077))
+ (unsafe-patt gitolite-rc-file-unsafe-patt
+ (default #f))
(git-config-keys gitolite-rc-file-git-config-keys
(default ""))
(roles gitolite-rc-file-roles
@@ -245,7 +248,7 @@ access to exported repositories under @file{/srv/git}."
(define-gexp-compiler (gitolite-rc-file-compiler
(file <gitolite-rc-file>) system target)
(match file
- (($ <gitolite-rc-file> umask git-config-keys roles enable)
+ (($ <gitolite-rc-file> umask unsafe-patt git-config-keys roles enable)
(apply text-file* "gitolite.rc"
`("%RC = (\n"
" UMASK => " ,(format #f "~4,'0o" umask) ",\n"
@@ -264,6 +267,9 @@ access to exported repositories under @file{/srv/git}."
" ],\n"
");\n"
"\n"
+ ,(if unsafe-patt
+ (string-append "$UNSAFE_PATT = qr(" unsafe-patt ");")
+ "")
"1;\n")))))
(define-record-type* <gitolite-configuration>
--
2.32.0
L
L
Ludovic Courtès wrote on 30 Aug 2021 14:49
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 49886@debbugs.gnu.org)
87tuj7ayh7.fsf@gnu.org
Hi Julien!

Julien Lepiller <julien@lepiller.eu> skribis:

Toggle quote (7 lines)
> attached is a v2 of the series. I added a small change to gitolite that
> allows changing UNSAFE_PATT (a regex that matches configuration values
> that contain unsafe characters). I wanted to link to it and to the
> nginx configuration sections in the manual, but I don't know how to
> create that link? I see the @subsubheading NGINX for instance, but I
> can't @ref{NGINX}.

Right, you cannot cross-reference a heading; you’d need either a node or
an anchor so you can cross-reference it.

Toggle quote (4 lines)
> I had to update gitile for the tests to pass and had a few false
> starts, but now the tests pass and gitile is working even better than
> before :)

Yay! :-)

Toggle quote (7 lines)
> From d43a77241defdea7848ab4596b427c33675f050e Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Thu, 5 Aug 2021 02:57:32 +0200
> Subject: [PATCH 1/3] gnu: Add gitile.
>
> * gnu/packages/version-control.scm (gitile): New variable.

LGTM!

Toggle quote (10 lines)
> From 2652e5515c84505c63072309f3b3e7837649cdb9 Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Wed, 25 Aug 2021 03:00:44 +0200
> Subject: [PATCH 2/3] gnu: gitolite: Add unsafe-patt configuration option.
>
> * gnu/services/version-control.scm (gitolite-rc-file): Add unsafe-patt
> field.
> (gitolite-rc-file-compiler): Write it.
> * doc/guix.texi (Version Control Services): Document it.

[...]

Toggle quote (8 lines)
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -31426,6 +31426,15 @@ A value like @code{#o0027} will give read access to the group used by Gitolite
> (by default: @code{git}). This is necessary when using Gitolite with software
> like cgit or gitweb.
>
> +@item @code{unsafe-patt} (default: @code{#f})

I’d call this field ‘unsafe-pattern’ for clarity.

Toggle quote (2 lines)
> +An optional pattern for catching unsafe configurations in the configuration

s/pattern/Perl regular expression/ ?

Toggle quote (7 lines)
> +file. See
> +@uref{https://gitolite.com/gitolite/git-config.html#compensating-for-unsafe_patt,
> +Gitolite's documentation} for more information.
> +
> +When the value is not @code{#f}, it should be a string containing a Perl
> +regular expression, such as @samp{"[`~#\$\&()|;<>]"}.

“such as @samp{…}, which catches XYZ.”

OK with changes along these lines!

Toggle quote (9 lines)
> From a80c856fce646eee7257239e4c05e67ac292b5fc Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Thu, 5 Aug 2021 03:46:40 +0200
> Subject: [PATCH 3/3] gnu: version-control: Add gitile service.
>
> * gnu/services/version-control.scm (gitile-service-type): New variable.
> * doc/guix.texi (Version Control Services): Document it.
> * gnu/tests/version-control.scm (%test-gitile): New variable.

LGTM, thank you!

Ludo’.
M
M
Maxime Devos wrote on 30 Aug 2021 18:54
Re: [bug#49886] [PATCH v2] Add gitile and gitile service
(address . 49886@debbugs.gnu.org)
7f8054226ce4857aa98c847fb1f14c7ea4d8805d.camel@telenet.be
Julien Lepiller schreef op wo 25-08-2021 om 23:31 [+0200]:
Toggle quote (4 lines)
> + (add-after 'install-bin 'wrap-program
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + ;; Wrap the 'cuirass' command to refer to the right modules.

I think you meant 'gitile' here.

Toggle quote (15 lines)
> + (let* ((out (assoc-ref outputs "out"))
> + (commonmark (assoc-ref inputs "guile-commonmark"))
> + (git (assoc-ref inputs "guile-git"))
> + (bytes (assoc-ref inputs "guile-bytestructures"))
> + (fibers (assoc-ref inputs "guile-fibers"))
> + (gcrypt (assoc-ref inputs "guile-gcrypt"))
> + (syntax-highlight (assoc-ref inputs "guile-syntax-highlight"))
> + (deps (list out commonmark git bytes fibers gcrypt
> + syntax-highlight))
> + (guile (assoc-ref inputs "guile"))
> + (effective (read-line
> + (open-pipe* OPEN_READ
> + (string-append guile "/bin/guile")
> + "-c" "(display (effective-version))")))

You can use "target-guile-effective-version" from (guix build guile-build-system)
here.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYS0NQBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jIIAQDPsIGMbETFeclYTCsbrMiZBkjb
I8zcMHmKZK4WRT/oLAD/UNJX4bHH9LP7V6TQVZEmkt57G0oMseNox4hCTAUsFw8=
=wiVW
-----END PGP SIGNATURE-----


J
J
Julien Lepiller wrote on 3 Sep 2021 00:04
Re: bug#49886: [PATCH v2] Add gitile and gitile service
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49886-done@debbugs.gnu.org)
20210903000454.421d34ff@tachikoma.lepiller.eu
Pushed, thanks!
Closed
?