From patchwork Sat Mar 22 17:00:29 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: 40632 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 4108327BBE9; Sat, 22 Mar 2025 17:04:00 +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 2AD7027BBE2 for ; Sat, 22 Mar 2025 17:03:58 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tw2GB-0006ye-TH; Sat, 22 Mar 2025 13:03:48 -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 1tw2EX-0006JK-LF for guix-patches@gnu.org; Sat, 22 Mar 2025 13:02:05 -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-0005Df-Ap for guix-patches@gnu.org; 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=rEGuXF+pNYshFXQOfEm6/ychqZFrY/VYvXMLMtAj9j0=; b=JWnrXh7xaIXQcDXrwVBFPmmxq1+g+Ukh0rVf6YDUW8S52DMET5elWyb2TyDU9M3UEmScAC91JpUR5RKLVvqDPZP3jl6FVe2Re7MLWnLh7pTk3XRpvZQbQ+GkncIzYlOjL4BBqEcPARX4TmhtE5AJ22FcG8u/nha83pkRyyc/GXye56Qur6Yoy+hhtqR7YOcYp8Bh0UlHLkwyCtp7VK0qty4NiDbnyfFyy3z9Zrm7Hlgo84+jAxjYPS/3s3SC5447Y5y8HtovS2skZ3nr0zmxGPP+zsU+cUgZNXo+WLA1DfSHkf3lRKJMiXSJUjvxm7LiikGs+Z/D+BzYJ5oinzBxAA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tw2EX-0006hV-5J for guix-patches@gnu.org; Sat, 22 Mar 2025 13:02:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77186] [PATCH 09/13] services: gitolite-activation: Convert to match-record. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: 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> Received: via spool by 77186-submit@debbugs.gnu.org id=B77186.174266288425611 (code B ref 77186); Sat, 22 Mar 2025 17:02:05 +0000 Received: (at 77186) by debbugs.gnu.org; 22 Mar 2025 17:01:24 +0000 Received: from localhost ([127.0.0.1]:45106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tw2Dr-0006ev-QE for submit@debbugs.gnu.org; Sat, 22 Mar 2025 13:01:24 -0400 Received: from wolfsden.cz ([37.205.8.62]:44932) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1tw2DE-0006bD-K1 for 77186@debbugs.gnu.org; Sat, 22 Mar 2025 13:00:46 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 9E86338005F; 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=mPyf1LBG92FYjvZw1afG21KmDbe8dK9T9gMmEEt7GGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ci22sESLP+S9pwAC+S+dBHluaa6o3Hl0b1Pz0PwViLq6AQS6pRF4WkABDphwzP1jU 346RwLJiCrMcWXRmicp50AWe16kRhun+7L02Ttc4dLcL6m+Sve2sV64icJayfkX4bS SNPk9xYjPp1YlaK0rREIyR1cD0PuhRxWZtxC7huZCh8od3+ttxwzrFmqEe0qdHkeRV kRssMU5e/Q0TMbt7LGoq66pOzC2HGt3iFYR3Q7ppz3Lg3j99q+bEcIjqe0IgmVJwjs 8/lCtqWD/bgoU5T/Z5WQ3YBHDUIS3784X0qdKRNryQFUqSNZeRWO/4x1RnHCmkFUN7 y5dAJuwOXXspNyrUlaE1l1rrGhWdcKu/kqL3ftYOh6+5tF52jQhqtivuDRuuHB7Gkn Z72VMmFSPzrgF7qTmyLr5Ic0gZe6tjCK4MdeESoNs3djS5Agognoqd6EhDPAeOO4EX Q7+i6BdAzNNXqZ9dg5MBd0+PzXJPo9HRbngC5GAAq78fEEzG4b+zv14FjsZbNypvEj +JtQ9C/s6TFoT6rR4/ksGi6ygtbgqcEYdhH9MPA1bH2QDWGZDf7dO7aQefTmwIR02c SzkZLiPHsJ4V0UkWueubE6olGDEQ5MbquYzxjKF6zDWfPV7+/ta4U8c4QbPqQCfgzJ hVwsas1cpLnE2XRecKD2Gb1Q= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 0D61C380C10; 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=mPyf1LBG92FYjvZw1afG21KmDbe8dK9T9gMmEEt7GGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ci22sESLP+S9pwAC+S+dBHluaa6o3Hl0b1Pz0PwViLq6AQS6pRF4WkABDphwzP1jU 346RwLJiCrMcWXRmicp50AWe16kRhun+7L02Ttc4dLcL6m+Sve2sV64icJayfkX4bS SNPk9xYjPp1YlaK0rREIyR1cD0PuhRxWZtxC7huZCh8od3+ttxwzrFmqEe0qdHkeRV kRssMU5e/Q0TMbt7LGoq66pOzC2HGt3iFYR3Q7ppz3Lg3j99q+bEcIjqe0IgmVJwjs 8/lCtqWD/bgoU5T/Z5WQ3YBHDUIS3784X0qdKRNryQFUqSNZeRWO/4x1RnHCmkFUN7 y5dAJuwOXXspNyrUlaE1l1rrGhWdcKu/kqL3ftYOh6+5tF52jQhqtivuDRuuHB7Gkn Z72VMmFSPzrgF7qTmyLr5Ic0gZe6tjCK4MdeESoNs3djS5Agognoqd6EhDPAeOO4EX Q7+i6BdAzNNXqZ9dg5MBd0+PzXJPo9HRbngC5GAAq78fEEzG4b+zv14FjsZbNypvEj +JtQ9C/s6TFoT6rR4/ksGi6ygtbgqcEYdhH9MPA1bH2QDWGZDf7dO7aQefTmwIR02c SzkZLiPHsJ4V0UkWueubE6olGDEQ5MbquYzxjKF6zDWfPV7+/ta4U8c4QbPqQCfgzJ hVwsas1cpLnE2XRecKD2Gb1Q= From: Tomas Volf <~@wolfsden.cz> Date: Sat, 22 Mar 2025 18:00:29 +0100 Message-ID: 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 * gnu/services/version-control.scm (gitolite-activation): Use match-record instead of match-lambda with $. Change-Id: I37e3018513a8f20eeed8614dff46a63b8d7c2883 --- gnu/services/version-control.scm | 123 +++++++++++++++---------------- 1 file changed, 61 insertions(+), 62 deletions(-) diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm index 83391c15d1..67009620b4 100644 --- a/gnu/services/version-control.scm +++ b/gnu/services/version-control.scm @@ -349,78 +349,77 @@ (define (gitolite-accounts config) (comment "Gitolite user") (home-directory home-directory))))) -(define gitolite-activation - (match-lambda - (($ package user group home - rc-file admin-pubkey) - #~(begin - (use-modules (ice-9 match) - (guix build utils)) +(define (gitolite-activation config) + (match-record config + (package user group home-directory rc-file admin-pubkey) + #~(begin + (use-modules (ice-9 match) + (guix build utils)) - (let* ((user-info (getpwnam #$user)) - (admin-pubkey #$admin-pubkey) - (pubkey-file (string-append - #$home "/" - (basename - (strip-store-file-name admin-pubkey)))) - (rc-file #$(string-append home "/.gitolite.rc"))) + (let* ((user-info (getpwnam #$user)) + (admin-pubkey #$admin-pubkey) + (pubkey-file (string-append + #$home-directory "/" + (basename + (strip-store-file-name admin-pubkey)))) + (rc-file #$(string-append home-directory "/.gitolite.rc"))) - ;; activate-users+groups in (gnu build activation) sets the - ;; permission flags of home directories to #o700 and mentions that - ;; services needing looser permissions should chmod it during - ;; service activation. We also want the git group to be able to - ;; read from the gitolite home directory, so a chmod'ing we will - ;; go! - (chmod #$home #o750) + ;; activate-users+groups in (gnu build activation) sets the + ;; permission flags of home directories to #o700 and mentions that + ;; services needing looser permissions should chmod it during + ;; service activation. We also want the git group to be able to + ;; read from the gitolite home directory, so a chmod'ing we will + ;; go! + (chmod #$home-directory #o750) - (simple-format #t "guix: gitolite: installing ~A\n" #$rc-file) - (copy-file #$rc-file rc-file) - ;; ensure gitolite's user can read the configuration - (chown rc-file - (passwd:uid user-info) - (passwd:gid user-info)) + (simple-format #t "guix: gitolite: installing ~A\n" #$rc-file) + (copy-file #$rc-file rc-file) + ;; ensure gitolite's user can read the configuration + (chown rc-file + (passwd:uid user-info) + (passwd:gid user-info)) - ;; The key must be writable, so copy it from the store - (copy-file admin-pubkey pubkey-file) + ;; The key must be writable, so copy it from the store + (copy-file admin-pubkey pubkey-file) - (chmod pubkey-file #o500) - (chown pubkey-file - (passwd:uid user-info) - (passwd:gid user-info)) + (chmod pubkey-file #o500) + (chown pubkey-file + (passwd:uid user-info) + (passwd:gid user-info)) - ;; 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 "/.gitconfig") - (lambda () - (display "[user] + ;; 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 "))) - ;; 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 - ;; initial setup - (match (primitive-fork) - (0 - ;; Exit with a non-zero status code if an exception is thrown. - (dynamic-wind - (const #t) - (lambda () - (setenv "HOME" (passwd:dir user-info)) - (setenv "USER" #$user) - (setgid (passwd:gid user-info)) - (setuid (passwd:uid user-info)) - (primitive-exit - (system* #$(file-append package "/bin/gitolite") - "setup" - "-m" "gitolite setup by GNU Guix" - "-pk" pubkey-file))) - (lambda () - (primitive-exit 1)))) - (pid (waitpid pid))) + ;; 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 + ;; initial setup + (match (primitive-fork) + (0 + ;; Exit with a non-zero status code if an exception is thrown. + (dynamic-wind + (const #t) + (lambda () + (setenv "HOME" (passwd:dir user-info)) + (setenv "USER" #$user) + (setgid (passwd:gid user-info)) + (setuid (passwd:uid user-info)) + (primitive-exit + (system* #$(file-append package "/bin/gitolite") + "setup" + "-m" "gitolite setup by GNU Guix" + "-pk" pubkey-file))) + (lambda () + (primitive-exit 1)))) + (pid (waitpid pid))) - (when (file-exists? pubkey-file) - (delete-file pubkey-file))))))) + (when (file-exists? pubkey-file) + (delete-file pubkey-file)))))) (define gitolite-service-type (service-type