From patchwork Sat Mar 22 17:09:11 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: 40642 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 1DC6927BBEA; Sat, 22 Mar 2025 17:12:02 +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=ham 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 7F40627BBE2 for ; Sat, 22 Mar 2025 17:12:01 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tw2NS-0000gZ-AC; Sat, 22 Mar 2025 13:11:18 -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 1tw2NG-0000Yc-UX for guix-patches@gnu.org; Sat, 22 Mar 2025 13:11:10 -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 1tw2NG-0007kq-JX; Sat, 22 Mar 2025 13:11: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=n7zA+XkQ2dCtTf5YWAF1NS7H2OwbIwBn6U5+qDp8GHU=; b=JabdLhwQpDZKdwwuFBl9kTwJWuqTCge9Jo9U4ix1tqYBDBV1m7dWxe+5cFOH5Q43Rssrp6zEEO6IfDekMbdOxAoz5F0eplldMKMl/6dee7W4eDfdpDJSHDfOaRcrsMBoxfhV/ZSLk4qFXoF8MGjD4/hmXLxMQv6nKTk2yk6Pf5nF/GcTWP7mFob/qsu+TLzx8m7tDNN801jSm28SU1OSHnt4yGm7jk9z0izychKLNkWjNF8nO/PiS1lhwmVIjmcQuUw2prSJMP2Aw76V1L1R1b+jp+1Bja/HNzGkrQhg7PV2PUcDZuJcrkZdl+hrl/GY9juNcWsA/TOtekstBxoW8w==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tw2NG-0007Iy-F7; Sat, 22 Mar 2025 13:11:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77186] [PATCH v2 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:11: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.174266343527789 (code B ref 77186); Sat, 22 Mar 2025 17:11:06 +0000 Received: (at 77186) by debbugs.gnu.org; 22 Mar 2025 17:10:35 +0000 Received: from localhost ([127.0.0.1]:45253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tw2Mk-0007E7-NO for submit@debbugs.gnu.org; Sat, 22 Mar 2025 13:10:35 -0400 Received: from wolfsden.cz ([37.205.8.62]:57594) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1tw2MG-00075g-92 for 77186@debbugs.gnu.org; Sat, 22 Mar 2025 13:10:06 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 2FDE837EA72; Sat, 22 Mar 2025 17:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1742663403; bh=rpAQNu5ecFY2+lEhgADPCwpqeCDjPDVaiFRFeSO5oCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bLqgid8bGsgmwziTEqft5oAH8fdKdXHpAg08DZ5x7eMxwuVkHNX8H/f9G6r0Yy1Vc wHkdSCeAvkNbNCkZtZ+iQfRpGvDyAmAxs2eJN0QVuafX0IthdMLBQF3JxnuW4MMQ9N JizakS4s/57i0rGy7mxH1P3hMQ+fi42Or20oIQMUpE4fs1czyGUeVN2bIBNxH3Rybs sCVrVBBMy9lg9ppBop2MTmWHcdQuw2JEB7LMSMSS2N96CB3s5xUv8WliTUlYstAby/ uoVk+ThjOHLrFzSEJjjfZ59JgLQVA6X6wQ6O7ck2lI/7aD5tefsz3DGPQL9BVPREkt i+BL9I5DqhwIcOlHO0rwXdnu8sZ7fQbnxdTlKnZraPoqQuCX0X7xQL0VKNOEEUxIKz LDGQnEB1GNj/RLbNqYzntJr+kYJZ8ikfxNBY4FDD0dH6fZ1GxiAdAHm8aQVAqaSSR9 kJLosrwVjz3CimUVIY3K/UDmDhvaOCpK10eio4vwqLmFZO8T1fT+g420UayTkveWyW WIkH8zIZTOHZ0MJ/Q6Byw907F6mSCWaMjrKdFsmb9jSXTMdWSo7cBwT6Zz2DpoLXF8 tGEBmCBJnsOJDqCDFib+moInE7GIGYGwD+DTcOY8hGLplC+zk8b6M487BDb1fXWdG0 /HJCvJJRzMO+TO17gUHT/ULA= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 2BE8E37F5CD; Sat, 22 Mar 2025 17:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1742663402; bh=rpAQNu5ecFY2+lEhgADPCwpqeCDjPDVaiFRFeSO5oCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BJPHpAkR2cbbQLiVutK0OybuPjX3GSmd3o43JOC7q/eTUOh21DwG37nfcjxQM9Uma ayhBpOgzl9kbT4Wsod0/DeoqV9h+bpctKF0JqGaTj+nV4NKQNwyqJ+AwVjW8nJhvBQ gwpJuWpdqVl/UuR87HRQVxMpakWhI+VO/+8cgSIbyZPz1Pp15EldTubw/787J8SiVE S50rG8h+6GACjSEUhbHEynS0Lce7yRHbK76ACKLg0foy/g4lApnX4p3BVozseN+7rv XIvQpmHvvDSLyxKIklw7Jj1S/iSOmODktOwh8DyjeoX12WCWj9yIME6RB2rC7aEBO/ 0z2Db+KEbITsbk4gBMxp6SSQ+UNkH3GPyP7DqQlnKqvvmeH+FQ+d2KZ2sqdz010seE 3pN3fLCaja8NpEPgBW6w3p3km0dfhzbMK1cD79Ktnua1kzvoQeTiXM+IzBppneRSs2 Z+42uvpDiNtdIHIsA9udkdOqOzW3WEvdYPh7zBnPrSkT7tmL2UnGZO4MRi+PKYWEJP wkd+W7aI7kIcfFoQpnyHmc9FC1G1fQG1iWP7f58azmkDRsLcj6kKbvEKE//jziNZS3 riGDhR3B72M86vuP4UOBpJnTxnVYY75y1Q/JB7whT9V/aYbMvfg67mISiehtiU0j6U RTsZbuv/mZiws+k2VZknJg4k= From: Tomas Volf <~@wolfsden.cz> Date: Sat, 22 Mar 2025 18:09:11 +0100 Message-ID: <7e43f73deff0dc29060e6f0dfe1c042e3d956a3f.1742663354.git.~@wolfsden.cz> X-Mailer: git-send-email 2.48.1 In-Reply-To: <39fb02cc97f30aa37523d9f5f9390264d53fcf8b.1742663354.git.~@wolfsden.cz> References: <39fb02cc97f30aa37523d9f5f9390264d53fcf8b.1742663354.git.~@wolfsden.cz> 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 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