From patchwork Wed Mar 29 13:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 48789 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 669361718C; Wed, 29 Mar 2023 14:50:28 +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=-2.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS 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 A283D17152 for ; Wed, 29 Mar 2023 14:50:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phWBg-0001uw-G9; Wed, 29 Mar 2023 09:50:04 -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 1phWBe-0001uZ-Lz for guix-patches@gnu.org; Wed, 29 Mar 2023 09:50: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 1phWBe-0007gM-Bl for guix-patches@gnu.org; Wed, 29 Mar 2023 09:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phWBe-0000TQ-7p for guix-patches@gnu.org; Wed, 29 Mar 2023 09:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62465] [PATCH v2 1/2] services: mcron: Add 'shepherd-requirement' field. References: <47e924fd42f74fc2800dc64399f7a069ad463515.1679854500.git.mirai@makinata.eu> In-Reply-To: <47e924fd42f74fc2800dc64399f7a069ad463515.1679854500.git.mirai@makinata.eu> Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 29 Mar 2023 13:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62465 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62465@debbugs.gnu.org Cc: Bruno Victal , maxim.cournoyer@gmail.com Received: via spool by 62465-submit@debbugs.gnu.org id=B62465.16800977801786 (code B ref 62465); Wed, 29 Mar 2023 13:50:02 +0000 Received: (at 62465) by debbugs.gnu.org; 29 Mar 2023 13:49:40 +0000 Received: from localhost ([127.0.0.1]:51550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phWBH-0000Sj-SR for submit@debbugs.gnu.org; Wed, 29 Mar 2023 09:49:40 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:49320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phWBF-0000SX-5j for 62465@debbugs.gnu.org; Wed, 29 Mar 2023 09:49:38 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id B3F5820D03; Wed, 29 Mar 2023 15:49:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id BE80A800A9; Wed, 29 Mar 2023 15:44:12 +0200 (CEST) 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 SIOLVCxnlxZS; Wed, 29 Mar 2023 15:44:12 +0200 (CEST) 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 23DB98009F; Wed, 29 Mar 2023 15:44:12 +0200 (CEST) From: Bruno Victal Date: Wed, 29 Mar 2023 14:44:05 +0100 Message-Id: <26ad3fb85ba517dc1a500c287f07f20a00cec625.1680097409.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 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-configuration)[shepherd-requirement]: New field. (list-of-symbols?): New predicate. (mcron-shepherd-services): Add support for additional shepherd requirements. * doc/guix.texi (Scheduled Job Execution): Update it. --- doc/guix.texi | 4 ++++ gnu/services/mcron.scm | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c49e51b72e..5a597cf122 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19379,6 +19379,10 @@ Scheduled Job Execution @item @code{mcron} (default: @code{mcron}) (type: file-like) The mcron package to use. +@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols) +This is a list of symbols naming Shepherd services that this service +will depend on. + @item @code{jobs} (default: @code{()}) (type: list-of-gexps) This is a list of gexps (@pxref{G-Expressions}), where each gexp corresponds to an mcron job specification (@pxref{Syntax, mcron job diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 2ef5980e09..99eb0edd60 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -32,6 +32,7 @@ (define-module (gnu services mcron) #:export (mcron-configuration mcron-configuration? mcron-configuration-mcron + mcron-configuration-shepherd-requirement mcron-configuration-jobs mcron-configuration-log? mcron-configuration-log-file @@ -58,6 +59,9 @@ (define-module (gnu services mcron) (define list-of-gexps? (list-of gexp?)) +(define list-of-symbols? + (list-of symbol?)) + (define-maybe/no-serialization string) (define-configuration/no-serialization mcron-configuration @@ -65,6 +69,11 @@ (define-configuration/no-serialization mcron-configuration (file-like mcron) "The mcron package to use.") + (shepherd-requirement + (list-of-symbols '()) + "This is a list of symbols naming Shepherd services that this service +will depend on.") + (jobs (list-of-gexps '()) "This is a list of gexps (@pxref{G-Expressions}), where each gexp @@ -158,13 +167,13 @@ (define (shepherd-schedule-action mcron files) (define (mcron-shepherd-services config) (match-record config - (mcron jobs log? log-file log-format date-format) + (mcron shepherd-requirement jobs log? log-file log-format date-format) (if (eq? jobs '()) '() ;nothing to do (let ((files (job-files mcron jobs))) (list (shepherd-service (provision '(mcron)) - (requirement '(user-processes)) + (requirement `(user-processes ,@shepherd-requirement)) (modules `((srfi srfi-1) (srfi srfi-26) (ice-9 popen) ;for the 'schedule' action