From patchwork Sat Mar 22 17:00:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 40627 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 553A427BBE9; Sat, 22 Mar 2025 17:02:51 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_ALL,DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AC2EC27BBE2 for ; Sat, 22 Mar 2025 17:02:49 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tw2Ez-0006PF-V0; Sat, 22 Mar 2025 13:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tw2EY-0006Js-5j for guix-patches@gnu.org; Sat, 22 Mar 2025 13:02:06 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tw2EX-0005Dx-RN; Sat, 22 Mar 2025 13:02:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=eUQ+xTz/JCxeWQx7sF1shbL1y0G0bsPcjMeEPkCMlT4=; b=rY5V89cMhOxmxHOJjoMTeWb/60snCT48+Y/rrsWiZ5KJYQTx1tluPVn7TQiW2tKqUm6zJGJjXIGFbd7O8AVHfla7U5VbHd1WYBP9w7H2xTr8EcetTcDC+HSd8jTpkCWzSl1hgvo2cpcf3sjRQHMYSqM3w8gFmC2/TrqZ7Ypnnonk03GXvAJPWFOWHtwu6giKhOQnoaAhN985KAns2N5X/P+dU7Pr+rJfo1xtmhlkWxbMPmx3gwHFFOQSBHaH+Xlhz76jcxquKLXrbABQMsx1o8w4uzIpujEFWN/rgs/+aZNL2PGF3A5J8pMtsIaS9gaQY/C568pIbovVXEE6fv4vng==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tw2EX-0006hd-LQ; Sat, 22 Mar 2025 13:02:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77186] [PATCH 10/13] services: Add gitolite-git-configuration. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 17:02:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77186 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77186@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77186-submit@debbugs.gnu.org id=B77186.174266288525618 (code B ref 77186); Sat, 22 Mar 2025 17:02:05 +0000 Received: (at 77186) by debbugs.gnu.org; 22 Mar 2025 17:01:25 +0000 Received: from localhost ([127.0.0.1]:45108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tw2Ds-0006f1-AR for submit@debbugs.gnu.org; Sat, 22 Mar 2025 13:01:24 -0400 Received: from wolfsden.cz ([37.205.8.62]:58364) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1tw2DF-0006bS-HZ for 77186@debbugs.gnu.org; Sat, 22 Mar 2025 13:00:46 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 8C57C380499; Sat, 22 Mar 2025 17:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1742662844; bh=e8TxQKZER5tX3gME0OMxfIEAzgMPZDphzZNxbGiXfTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CXR60rNCT+IzFnv9sYVYWYzbyGTbj0qN8lCK+J8pn+wBznhb5T3Wi9R5R5JNOTtm8 2KxZRROBB0UEdEvjSIBqi0GjvRTYDdts7aTz6mHteztiXEKDRZGMvf7caGdrO1GtI5 gnNGxIycn/rOylFJANHAZB7HePCdaj78jg+Fv4mKHzsjcFzb0OKz75cVHn3xP2Qygd 4XLzenQ6nUjh9y6V9Ft6eO+nFzTFFLpojFWy0jbzCtJ+hvJoK6ZIch7fglLbDstaf9 +LPQ/QbZq1eLlIBQota7Hr+lyuK1yTadft981HFoXcajb3JR+tO5C1HuAiFCggnj5j 8r3Nk/Wc5sWGn4AnFFoyvRs4+yd9JJQICH3MYRM8AehihKKFE2eC1soxu03tRySaZC C4vPA88+zltSb0UK2dYv7Nidq87W7pOQx+HTjg/9g49kBPAT1WzlcKks/hN9X9ysjK 0tPNxVna/M2sV8kG2ij07XrFDpbAyMIQV4z51ipL1Qy5ZiOtmczZ0QUrNzyjju+rIr 7VqrsE5NfMJcVryEYn32+OQUBIUw27GgntmbmelsDFx6R6kuBg6KVvVd4rJDw9krl6 4tLsjasozkphZRKheV4I+lTosk2CW7Ti/NTV76bGMD5UNo4qgrJjUB0YHPXEaA76vR GyFrmYz8HeD6oE2P+5z5kRgI= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 8F2D5380C82; Sat, 22 Mar 2025 17:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1742662843; bh=e8TxQKZER5tX3gME0OMxfIEAzgMPZDphzZNxbGiXfTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HJBERhQJTnn78RomuUTZqL+m2NUC3qEc8dpuBNfxN38Lgibdge4vXuHNtgWa0y21S DCCqMZV5w4vfe0L4UqhVrooJspagKo9SvoGxf0OxqRju+RLYLSKLkQrZOmfXz+Sznp zrh0TgxEoaZYiJWqOCFdJdIWOwlpgoDj6devbCzMHUwJ/zuavTdriOuYC38YkYVjY0 T9fo6t+h8zp/qrPcgtbleVfZPI1ZkmmKTiqTUE/rZFnaa+npDTrMGCpN4M9TdzxFDu n5KkvhVSzYWSZYn3Meb5Spn3Q4TfAxMR1TEGCzmf4Yfo5mzwJ20ro7lAQP35oRPkmB w3nzRkHl9mWT//5V4kCaC8NZKTnvXUIDisHkQ7KKtt4122Gf+IEcfXT7d02RvmkwDd /OwzRnjgBmiymzze5VO4sq1a6WoW3EbK+6N+ainSjIdYqVyjxO7QVwM14lWsCtdQ7P rIFMU2eHlyhRxpwH6tSoeKhXOI4I4Fh8lL/RMZ69ZI/GP9U0lWF251B2knDCKFPXEs 3VbGiIWQS7Jz5V+mAvGmgzUqZ5dmpahU17gVdnPM58NKIvugybRhR2p5PjfoG4sTsE HraVTaPV/TgeCXJOyWWMbDZ11bScJ3yTek5LVcgyi9GvKwObsPNG//4wpy2ap3D/OW Sb749lCSnwmBP0gJ/9ZDvBzQ= From: Tomas Volf <~@wolfsden.cz> Date: Sat, 22 Mar 2025 18:00:30 +0100 Message-ID: <2de343c2499bf0297cf03c58226670b02710d9ad.1742661305.git.~@wolfsden.cz> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches In preparation for further customizability of the git configuration, extract the current setup into a separate record type. * gnu/services/version-control.scm (): New record type. (gitolite-git-configuration-compiler): And gexp compiler for it. (): Add git-config field. (gitolite-activation): Use it. * doc/guix.texi (Version Control Services): Document both. Change-Id: I7658698a93f938f62f41a4fa45b72de1eeb14414 --- doc/guix.texi | 17 +++++++++++++++ gnu/services/version-control.scm | 37 ++++++++++++++++++++++++++------ 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index e60fef9673..e584b072e1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41095,6 +41095,10 @@ Version Control Services A ``file-like'' object (@pxref{G-Expressions, file-like objects}), representing the configuration for Gitolite. +@item @code{git-config} (default: @code{(gitolite-git-configuration)}) +A ``file-like'' object (@pxref{G-Expressions, file-like objects}), +representing the git configuration for Gitolite. + @item @code{admin-pubkey} (default: @code{#f}) A ``file-like'' object (@pxref{G-Expressions, file-like objects}) used to setup Gitolite. This will be inserted in to the @file{keydir} directory @@ -41170,6 +41174,19 @@ Version Control Services @end table @end deftp +@deftp {Data Type} gitolite-git-configuration +Data type representing the git configuration file for gitolite. + +@table @asis +@item @code{name} (default: @code{"GNU GNU"}) +User name used for commits (e.g. during setting up the admin +repository). + +@item @code{email} (default: @code{"guix@@localhost"}) +Email used for commits (e.g. during setting up the admin repository). + +@end table +@end deftp @subsubheading Gitile Service diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm index 67009620b4..68297dee19 100644 --- a/gnu/services/version-control.scm +++ b/gnu/services/version-control.scm @@ -66,6 +66,12 @@ (define-module (gnu services version-control) gitolite-rc-file-extra-content gitolite-rc-file-default-enable + + gitolite-git-configuration + gitolite-git-configuration? + gitolite-git-configuration-name + gitolite-git-configuration-email + gitolite-service-type gitile-configuration @@ -320,6 +326,23 @@ (define-gexp-compiler (gitolite-rc-file-compiler "# End:\n" "# vim: set syn=perl:\n")))) +(define-record-type* + gitolite-git-configuration make-gitolite-git-configuration + gitolite-git-configuration? + (name gitolite-git-configuration-name + (default "GNU Guix")) + (email gitolite-git-configuration-email + (default "guix@localhost"))) + +(define-gexp-compiler (gitolite-git-configuration-compiler + (config ) system target) + (match-record config + (name email) + (apply text-file* "gitconfig" + `("[user]\n" + "name = " ,name "\n" + "email = " ,email "\n")))) + (define-record-type* gitolite-configuration make-gitolite-configuration gitolite-configuration? @@ -333,6 +356,8 @@ (define-record-type* (default "/var/lib/gitolite")) (rc-file gitolite-configuration-rc-file (default (gitolite-rc-file))) + (git-config gitolite-configuration-git-config + (default (gitolite-git-configuration))) (admin-pubkey gitolite-configuration-admin-pubkey)) (define (gitolite-accounts config) @@ -351,7 +376,8 @@ (define (gitolite-accounts config) (define (gitolite-activation config) (match-record config - (package user group home-directory rc-file admin-pubkey) + ( package user group home-directory rc-file admin-pubkey + git-config) #~(begin (use-modules (ice-9 match) (guix build utils)) @@ -389,12 +415,9 @@ (define (gitolite-activation config) ;; Set the git configuration, to avoid gitolite trying to use ;; the hostname command, as the network might not be up yet - (with-output-to-file #$(string-append home-directory "/.gitconfig") - (lambda () - (display "[user] - name = GNU Guix - email = guix@localhost -"))) + (copy-file #$git-config + #$(string-append home-directory "/.gitconfig")) + ;; Run Gitolite setup, as this updates the hooks and include the ;; admin pubkey if specified. The admin pubkey is required for ;; initial setup, and will replace the previous key if run after