all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Oleg Pykhalov <go.wigust@gmail.com>
Cc: 28283@debbugs.gnu.org
Subject: [bug#28283] Status: [PATCH 1/1] gnu: services: version-control: Add cgit.
Date: Sun, 01 Oct 2017 23:55:16 +0200	[thread overview]
Message-ID: <871smmr0sb.fsf@gnu.org> (raw)
In-Reply-To: <874lrlr46b.fsf@gmail.com> (Oleg Pykhalov's message of "Fri, 29 Sep 2017 17:05:16 +0300")

[-- Attachment #1: Type: text/plain, Size: 2049 bytes --]

Hi Oleg,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

> ‘try-files’ are in ‘<nginx-server-configuration>’ in origin/master now,
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=4d14808af4c01b4fb0a4564584aa68f0e53c4ef4

Awesome.

>> Please add a sentence above or below the example like “This example
>> shows …”.
>
> Sorry, I don't understand what do you mean.  There is a sentence above
> example that answers a question “What does example do?” and I guess
> “What does example show?”.

Oops you’re right, sorry for overlooking this.

> From 64b328c90fbaedca4b081fb33af6e3dbae27eeb6 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> Date: Thu, 28 Sep 2017 20:02:35 +0300
> Subject: [PATCH] gnu: services: version-control: Add cgit.
>
> * gnu/services/version-control.scm
> (<cgit-configuration-file>, <cgit-configuration>): New record types.
> (cgit-configuration-robots-string, cgit-activation,
> cgit-configuration-nginx-config): New procedures.
> (%cgit-configuration-nginx, cgit-service-type): New variables.
> * doc/guix.texi (Version Control): Document the cgit service.

[...]

> +(define-gexp-compiler (cgit-configuration-file-compiler
> +                       (file <cgit-configuration-file>) system target)
> +  (match file
> +    (($ <cgit-configuration-file> css logo
> +                                  robots virtual-root repository-directory)
> +     (text-file
> +      "cgitrc"
> +      (string-concatenate
> +       (filter-map
> +        (match-lambda
> +          ((key . #f) #f)
> +          ((key . value) (string-append key "=" value "\n")))
> +        `(("css" . ,css)
> +          ("logo" . ,logo)
> +          ("robots" . ,(cgit-configuration-robots-string robots))
> +          ("virtual-root" . ,virtual-root)
> +          ("repository-directory" . ,repository-directory))))))))

I changed this part like this so that things work as expected if we pass
items that live in the store (along with other changes):


[-- Attachment #2: Type: text/x-patch, Size: 2634 bytes --]

diff --git a/doc/guix.texi b/doc/guix.texi
index 4bdbe4b70..d5abf900a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17000,8 +17000,10 @@ Extra options will be passed to @code{git daemon}, please run
 @end table
 @end deftp
 
-@subsubheading Cgit service
+@subsubheading Cgit Service
 
+@cindex Cgit service
+@cindex Git, web interface
 @uref{https://git.zx2c4.com/cgit/, Cgit} is a web frontend for Git
 repositories written in C.
 
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index 50b09c0ce..208351447 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org>
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -189,18 +190,23 @@ access to exported repositories under @file{/srv/git}."
   (match file
     (($ <cgit-configuration-file> css logo
                                   robots virtual-root repository-directory)
-     (text-file
-      "cgitrc"
-      (string-concatenate
-       (filter-map
-        (match-lambda
-          ((key . #f) #f)
-          ((key . value) (string-append key "=" value "\n")))
-        `(("css" . ,css)
-          ("logo" . ,logo)
-          ("robots" . ,(cgit-configuration-robots-string robots))
-          ("virtual-root" . ,virtual-root)
-          ("repository-directory" . ,repository-directory))))))))
+     (apply text-file* "cgitrc"
+            (letrec-syntax ((option (syntax-rules ()
+                                      ((_ key value)
+                                       (if value
+                                           `(,key "=" ,value)
+                                           '()))))
+                            (key/value (syntax-rules ()
+                                         ((_ (key value) rest ...)
+                                          (append (option key value)
+                                                  (key/value rest ...)))
+                                         ((_)
+                                          '()))))
+              (key/value ("css" css)
+                         ("logo" logo)
+                         ("robots" (cgit-configuration-robots-string robots))
+                         ("virtual-root" virtual-root)
+                         ("repository-directory" repository-directory)))))))
 
 (define %cgit-configuration-nginx
   (list

[-- Attachment #3: Type: text/plain, Size: 1102 bytes --]


I looked at the test failures, and I wonder if everything’s working as
intended.  What I did for debugging was:

--8<---------------cut here---------------start------------->8---
$ guix gc -R  /gnu/store/i71plcn5y8b29nc59s5d7m2cx810ki6n-cgit-test.drv |grep run-vm
/gnu/store/v9s4ai0dvgvmga6lyj4z2733lavr3acl-run-vm.sh-builder
/gnu/store/6a2l7mcshdzc38zj8nkinjlzqmgjnx3b-run-vm.sh.drv
$ guix build /gnu/store/6a2l7mcshdzc38zj8nkinjlzqmgjnx3b-run-vm.sh.drv
/gnu/store/igjg0i4d3sj77jpgppn09r66jql6nliw-run-vm.sh
$ /gnu/store/igjg0i4d3sj77jpgppn09r66jql6nliw-run-vm.sh -serial stdio
…
--8<---------------cut here---------------end--------------->8---

Then I experimented with w3m inside the VM.

Apparently some URLs are being rewritten, with
/cgit.cgi/cgit.cgi/cgit.cgi/… and so on, which looks weird.

Could you investigate more in a VM (you can simply use ‘guix system vm’
with a config similar to that of the test) to see what’s going on?
Looks like we’re almost there, but I’d feel more confident if we could
get a test running.  :-)

Thank you!

Ludo’.

  reply	other threads:[~2017-10-01 21:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 21:16 [bug#28283] [PATCH 0/1] gnu: services: version-control: Add cgit Oleg Pykhalov
2017-08-29 21:18 ` [bug#28283] Status: [PATCH 1/1] " Oleg Pykhalov
2017-08-29 21:53   ` Oleg Pykhalov
2017-08-31 13:39   ` Ludovic Courtès
2017-09-19 21:27     ` Ludovic Courtès
2017-09-20 22:20       ` Oleg Pykhalov
2017-09-22 13:40         ` Ludovic Courtès
2017-09-22 17:57           ` Oleg Pykhalov
2017-09-22 21:38             ` Ludovic Courtès
2017-09-29 14:05               ` Oleg Pykhalov
2017-10-01 21:55                 ` Ludovic Courtès [this message]
2017-10-03  6:22                   ` Oleg Pykhalov
2017-10-03  6:31                     ` Oleg Pykhalov
2017-10-03  7:30                       ` Oleg Pykhalov
2017-10-03  7:36                         ` Oleg Pykhalov
2017-10-03 13:07                           ` bug#28283: " Ludovic Courtès

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=871smmr0sb.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=28283@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.