From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dymDT-0001He-PJ for guix-patches@gnu.org; Sun, 01 Oct 2017 17:56:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dymDS-0000ZE-Er for guix-patches@gnu.org; Sun, 01 Oct 2017 17:56:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:34492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dymDS-0000Yt-Ae for guix-patches@gnu.org; Sun, 01 Oct 2017 17:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dymDS-0007tG-37 for guix-patches@gnu.org; Sun, 01 Oct 2017 17:56:02 -0400 Subject: [bug#28283] Status: [PATCH 1/1] gnu: services: version-control: Add cgit. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87h8wq2hxw.fsf@gmail.com> <87a82i2hur.fsf@gmail.com> <873787rh4a.fsf@gnu.org> <87d16mv0o3.fsf@gnu.org> <87efr19fms.fsf@gmail.com> <87ingasvfx.fsf@gnu.org> <87h8vuehv6.fsf@gmail.com> <87d16ibeif.fsf@gnu.org> <874lrlr46b.fsf@gmail.com> Date: Sun, 01 Oct 2017 23:55:16 +0200 In-Reply-To: <874lrlr46b.fsf@gmail.com> (Oleg Pykhalov's message of "Fri, 29 Sep 2017 17:05:16 +0300") Message-ID: <871smmr0sb.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Oleg Pykhalov Cc: 28283@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Oleg, Oleg Pykhalov skribis: > =E2=80=98try-files=E2=80=99 are in =E2=80=98= =E2=80=99 in origin/master now, > https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D4d14808af4c01b4fb= 0a4564584aa68f0e53c4ef4 Awesome. >> Please add a sentence above or below the example like =E2=80=9CThis exam= ple >> shows =E2=80=A6=E2=80=9D. > > Sorry, I don't understand what do you mean. There is a sentence above > example that answers a question =E2=80=9CWhat does example do?=E2=80=9D a= nd I guess > =E2=80=9CWhat does example show?=E2=80=9D. Oops you=E2=80=99re right, sorry for overlooking this. > From 64b328c90fbaedca4b081fb33af6e3dbae27eeb6 Mon Sep 17 00:00:00 2001 > From: Oleg Pykhalov > Date: Thu, 28 Sep 2017 20:02:35 +0300 > Subject: [PATCH] gnu: services: version-control: Add cgit. > > * gnu/services/version-control.scm > (, ): 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 ) system target) > + (match file > + (($ css logo > + robots virtual-root repository-directo= ry) > + (text-file > + "cgitrc" > + (string-concatenate > + (filter-map > + (match-lambda > + ((key . #f) #f) > + ((key . value) (string-append key "=3D" 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): --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =20 -@subsubheading Cgit service +@subsubheading Cgit Service =20 +@cindex Cgit service +@cindex Git, web interface @uref{https://git.zx2c4.com/cgit/, Cgit} is a web frontend for Git repositories written in C. =20 diff --git a/gnu/services/version-control.scm b/gnu/services/version-contro= l.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 =C2=A9 2016 ng0 ;;; Copyright =C2=A9 2016 Sou Bunnbu +;;; Copyright =C2=A9 2017 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -189,18 +190,23 @@ access to exported repositories under @file{/srv/git}= ." (match 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 "=3D" 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 "=3D" ,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 robot= s)) + ("virtual-root" virtual-root) + ("repository-directory" repository-directory)))))= )) =20 (define %cgit-configuration-nginx (list --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I looked at the test failures, and I wonder if everything=E2=80=99s working= as intended. What I did for debugging was: --8<---------------cut here---------------start------------->8--- $ guix gc -R /gnu/store/i71plcn5y8b29nc59s5d7m2cx810ki6n-cgit-test.drv |gr= ep 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 =E2=80=A6 --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/=E2=80=A6 and so on, which looks weird. Could you investigate more in a VM (you can simply use =E2=80=98guix system= vm=E2=80=99 with a config similar to that of the test) to see what=E2=80=99s going on? Looks like we=E2=80=99re almost there, but I=E2=80=99d feel more confident = if we could get a test running. :-) Thank you! Ludo=E2=80=99. --=-=-=--