From patchwork Mon Mar 31 22:10:16 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: 41105 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 8483727BBE2; Mon, 31 Mar 2025 23:13:30 +0100 (BST) 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 789BA27BBEA for ; Mon, 31 Mar 2025 23:13:28 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzNN4-0000Nh-0B; Mon, 31 Mar 2025 18:12:42 -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 1tzNMV-0000Ct-2n for guix-patches@gnu.org; Mon, 31 Mar 2025 18:12:09 -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 1tzNMU-0006ys-EW; Mon, 31 Mar 2025 18:12:06 -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=urPvmybsRhyUmGjQa0mMDnsBohYXM5PZx8Iqj6F+jvk=; b=Ex631SYAXDma2haGAECRhlc0No4fWOrzL37/pEssKvDSOdb48cMX4KxL2ea4cdcYj+8No+aa2RYDyWCPsvF9aXDazokcSPi+CNEekBPlng1bO84aUQwdAp1c4sVlSeXG+tnyUL55nz16k5nb7rGhXhZbBr7s5Hr5pBV5qRJZdgQ8DKhypXva2Xy1ya2cne/ZkvRegJc9I7XjPZc9ymkiSA3yEDWAjfsXoi2t4Rz3C9tOqtcJSx19lpfYddpOGJrhSblsAINA9qA/Nep88D2b2fESbr1Ozaiy9sq3keuKxTZF36qS1d0HegfPHYE794du5XgznbJYgzeVlAQKA148fg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tzNMU-0000bY-AE; Mon, 31 Mar 2025 18:12:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77186] [PATCH v2 10/14] 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: Mon, 31 Mar 2025 22:12:06 +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.17434590711980 (code B ref 77186); Mon, 31 Mar 2025 22:12:06 +0000 Received: (at 77186) by debbugs.gnu.org; 31 Mar 2025 22:11:11 +0000 Received: from localhost ([127.0.0.1]:43360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tzNLa-0000Vk-Oz for submit@debbugs.gnu.org; Mon, 31 Mar 2025 18:11:11 -0400 Received: from wolfsden.cz ([37.205.8.62]:41026) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1tzNL6-0000Qg-SJ for 77186@debbugs.gnu.org; Mon, 31 Mar 2025 18:10:42 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 2ABB63797AE; Mon, 31 Mar 2025 22:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1743459039; bh=C1ECZHbntLpyLkeSMm9EOukAKZn52GuxAZ9fkT3KszQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=chcq5wOJNH4IrtQKEDGxsVtWxpjbO7ONIGALISPLLMiQrK6zXxEd4FLp8M1CKCduu 0C1jmpAAMXYEE4HoOUdT+7UBgha4EepTcelK52pvTayxYGhvpzRMJXMCuX7FANwpDQ 6lUjTszOGZdZ4tQr4RnPAIR2b3Ey9EUBae+jaQeUmwPNGkqVmAIDrqNzJlBcedqpe/ 4Yf0gHblI52ikButp2bJM1MuEDc+8yERjg9hGFbHfZ7vl+G+Iv4+iF088g46l5B0bj 77U0+alEbaSFIljSamFGS1xTLZzogtHB9vgwym2ZMZ09TH/+XMaYqGPCUDIuv9AdmD py97yBPwx16Vc8gVGckS8mHVRBel+pGZUjFD9s2jGJPThnCvM3J/5JTxvkju502eCI 0zzi+/elpltn6vntO1JQPi6jsNQaW9OluVwFm9AO5vJak+VfvbEOMW9Bo6rtsFt9Jy 4TK3Zvqc5qLOQ66CsZ47ZNL0FspTXb1dQTzohcgfQSAG8x4DWCbJ8URq4BAoVisz3y K8ZI06QmGJrfv9hK1T3eEj3UPFp2Pkt5+6468qKxy2Kiov2Yfi0WeLv0S63F7nsI+K 7n8098V1fzrkHFu62jb9+eaXLlT7L2yWhBtoU6btzxoPjHBJM0HNviTG8YgNfIZ/nU Yc6RbCvCwm3TDA6J7SCyiCzY= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 8B492379999; Mon, 31 Mar 2025 22:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1743459037; bh=C1ECZHbntLpyLkeSMm9EOukAKZn52GuxAZ9fkT3KszQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Flrul6WwYLC1YiMXOHlySNSWX4XQTtQikW2eHSxOOMSeVIn2R3pR8HARfJN6AcW8s Z2KhWZlKUz7kn1Fn+0YlcUboSSMsPz26+Z0k9Xekm7sC2Q55QRT4GZ0UQCcvejrlcf 1o5yL3iu3jvEltYVowPBAkPRvmLO2QNtIzC02wQrMmA8t2THqPTH3yvObENG0Hjxir 2wP7lKPGf+ltno3SAU5NyObx54Nhp9o/kyTsH88uJDcgINZeDLoma1tg3CsQLNq4qE lI6wlmSoB/YKt7RyjviD5qSeVBydaK2TAD4gYQjHxOzA41rU3blaOmT1EYGNBPs28D 8Cbuz/1Rhcn8XTM8kJC39L0NnR3dme7hRlU+GaBNISS7R5voJohuNEWxGlNW0eRpia XNoufrMLa28jIJHUCYNk7SaArqGtiFPrwJFO7dc397V9d3BabzxLr1ienCO53Tz3d/ aQ66y+EutPhSbMS98c3z7osqHzKG6xnmHgSptugj2qLAwkf/lDrPoS140cB42mkLu+ ItmUVmbA2zLHjqgYZqxSmEbzwdDllYDhlSu7DloAFOXEwgIaXshTNDg3pNtSneWnJU WUHejcYfzrMsQ05jz1UbbQSLNJugUMJ2yrqyPwSOkngmHo8JHAWaMdwQ/64b58kdCX 4I1e+W84Hs/vbfpOIwlDudlg= From: Tomas Volf <~@wolfsden.cz> Date: Tue, 1 Apr 2025 00:10:16 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 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 299f84bb49..f2f9827cc0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41009,6 +41009,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 @@ -41084,6 +41088,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 268b0a47ee..dcdddf8078 100644 --- a/gnu/services/version-control.scm +++ b/gnu/services/version-control.scm @@ -67,6 +67,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 @@ -321,6 +327,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? @@ -334,6 +357,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) @@ -352,7 +377,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)) @@ -390,12 +416,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