From patchwork Mon Mar 13 19:30:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 47946 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 73A7916E3E; Mon, 13 Mar 2023 19:31:28 +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=-2.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS 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 C1BCA16E04 for ; Mon, 13 Mar 2023 19:31:27 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbnsw-0003E7-4z; Mon, 13 Mar 2023 15:31:06 -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 1pbnss-0003CO-M5 for guix-patches@gnu.org; Mon, 13 Mar 2023 15:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbnss-0008Mm-4Y for guix-patches@gnu.org; Mon, 13 Mar 2023 15:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pbnss-0003Hj-0X for guix-patches@gnu.org; Mon, 13 Mar 2023 15:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62169] [PATCH 2/3] services: mcron: Use match-record. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Mar 2023 19:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62169 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62169@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 62169-submit@debbugs.gnu.org id=B62169.167873585712598 (code B ref 62169); Mon, 13 Mar 2023 19:31:01 +0000 Received: (at 62169) by debbugs.gnu.org; 13 Mar 2023 19:30:57 +0000 Received: from localhost ([127.0.0.1]:35660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbnsm-0003H3-HZ for submit@debbugs.gnu.org; Mon, 13 Mar 2023 15:30:56 -0400 Received: from smtpmciv5.myservices.hosting ([185.26.107.241]:60244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbnsl-0003Gu-8s for 62169@debbugs.gnu.org; Mon, 13 Mar 2023 15:30:55 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv5.myservices.hosting (Postfix) with ESMTP id A3B7620D93 for <62169@debbugs.gnu.org>; Mon, 13 Mar 2023 20:30:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 3F8CA800A5; Mon, 13 Mar 2023 20:30:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Q7FeGqCIykyO; Mon, 13 Mar 2023 20:30:53 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id C3F20800A1; Mon, 13 Mar 2023 20:30:52 +0100 (CET) From: Bruno Victal Date: Mon, 13 Mar 2023 19:30:49 +0000 Message-Id: <691ab538c6a9ea4d62b9113416114d12ddca0d54.1678735825.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.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/mcron.scm (mcron-shepherd-services): Use match-record. --- gnu/services/mcron.scm | 68 ++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 6ee333f253..9f3afecf62 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -143,41 +143,39 @@ (define (shepherd-schedule-action mcron files) (display line) (loop))))))))) -(define mcron-shepherd-services - (match-lambda - (($ mcron ()) ;nothing to do! - '()) - (($ mcron jobs log? log-format) - (let ((files (job-files mcron jobs))) - (list (shepherd-service - (provision '(mcron)) - (requirement '(user-processes)) - (modules `((srfi srfi-1) - (srfi srfi-26) - (ice-9 popen) ;for the 'schedule' action - (ice-9 rdelim) - (ice-9 match) - ,@%default-modules)) - (start #~(make-forkexec-constructor - (list (string-append #$mcron "/bin/mcron") - #$@(if log? - #~("--log" "--log-format" #$log-format) - #~()) - #$@files) - - ;; Disable auto-compilation of the job files and set a - ;; sane value for 'PATH'. - #:environment-variables - (cons* "GUILE_AUTO_COMPILE=0" - "PATH=/run/current-system/profile/bin" - (remove (cut string-prefix? "PATH=" <>) - (environ))) - - #:log-file "/var/log/mcron.log")) - (stop #~(make-kill-destructor)) - - (actions - (list (shepherd-schedule-action mcron files))))))))) +(define (mcron-shepherd-services config) + (match-record config (mcron jobs log? log-format) + (if (eq? jobs '()) + '() ; nothing to do + (let ((files (job-files mcron jobs))) + (list (shepherd-service + (provision '(mcron)) + (requirement '(user-processes)) + (modules `((srfi srfi-1) + (srfi srfi-26) + (ice-9 popen) ;for the 'schedule' action + (ice-9 rdelim) + (ice-9 match) + ,@%default-modules)) + (start #~(make-forkexec-constructor + (list (string-append #$mcron "/bin/mcron") + #$@(if log? + #~("--log" "--log-format" #$log-format) + #~()) + #$@files) + + ;; Disable auto-compilation of the job files and + ;; set a sane value for 'PATH'. + #:environment-variables + (cons* "GUILE_AUTO_COMPILE=0" + "PATH=/run/current-system/profile/bin" + (remove (cut string-prefix? "PATH=" <>) + (environ))) + + #:log-file "/var/log/mcron.log")) + (stop #~(make-kill-destructor)) + (actions + (list (shepherd-schedule-action mcron files))))))))) (define mcron-service-type (service-type (name 'mcron)