From patchwork Sat Mar 22 11:36:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 40595 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 84DFB27BBE9; Sat, 22 Mar 2025 11:38:54 +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=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 AA81F27BBE2 for ; Sat, 22 Mar 2025 11:38:53 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvxB1-0001mE-Tf; Sat, 22 Mar 2025 07:38:08 -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 1tvxAx-0001kq-5q for guix-patches@gnu.org; Sat, 22 Mar 2025 07:38:03 -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 1tvxAw-000063-Qu; Sat, 22 Mar 2025 07:38:02 -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=A9CsfCmB1L872i5JSIhAgCXZn/rLv0CIkxfwiPoFeOE=; b=Kky88CoWFJfjaijQESI4YhOQ9RzDv2PKcRPdftmr8wyX5+ftEpGIX5fC2oQqyWn6Ma5uCj/NcWFCnIF6qq5K4v6HuUbYFQSObabjvq2K4PVhK9fGQjK45t7BQUAbC84Z9tQXQF6nlLNOKOxlpzc95trVfAnBM+mlgmsjvRuXP22jBUYqgZnNSjSX5ck84sDrfK/rDmszfHXONFrph9+x5OIV3Qz2rSlWlClNeOfNNZytWcUu9rpHL6Gn/FkvhtbNWFoq9R5D6RFiFm7josnDmvWdBoUv4nDojjUqjyObXs2Niun5xl245FCOC/fS3YMLSGOVuomuinVCUudahZx05g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tvxAw-0002YI-L9; Sat, 22 Mar 2025 07:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH v2 02/16] services: file-database: Turn into a Shepherd timer. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 11:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77041 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77041@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77041-submit@debbugs.gnu.org id=B77041.17426434489591 (code B ref 77041); Sat, 22 Mar 2025 11:38:02 +0000 Received: (at 77041) by debbugs.gnu.org; 22 Mar 2025 11:37:28 +0000 Received: from localhost ([127.0.0.1]:41153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvxAN-0002UN-Ip for submit@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33528) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tvxAJ-0002TX-My for 77041@debbugs.gnu.org; Sat, 22 Mar 2025 07:37:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvxAE-0008T3-EQ; Sat, 22 Mar 2025 07:37:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=A9CsfCmB1L872i5JSIhAgCXZn/rLv0CIkxfwiPoFeOE=; b=TudasvZpViYcOlBZ6RmQ CDnQ9jiWFFTdstUKAxD49nnluX6PznLMt3EUyzPKFDYAdNtKbjq3bY6YgCIFds67LEn7HSmuDFQxT jINQ3n7679vPsNkSoy3zRErHvnCZVyHqvSL2btILKT/KUMLemjyEiPvKxw6Q2zFkapdjZh79zySyq Hm1C8/JeENWc5fdOfO6hIQQsTDsbzM5zUPYwpXG3ZcOuZcV4BPeA4ruk1xJoLf2dQ5cw66jeGF+OR M5yxurl0fvG4dplpB0YdP28FMMSMt/DWoa0pw2bXcTDdIJZq/RJ0cVurkfTuO98keN6FT891nmxow T5+mzmKas7S+9g==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 12:36:39 +0100 Message-ID: <3652998fa2af326e775f7aa7f63356e73e2ff6fa.1742642743.git.ludo@gnu.org> 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/admin.scm (file-database-mcron-jobs): Rename to… (file-database-shepherd-services): … this. Return a list of Shepherd services. (file-database-service-type): Adjust accordingly. * doc/guix.texi (File Search Services): Update documentation of ‘schedule’. Change-Id: I5734c629b113e54057694d2ec480abd26b7815db --- doc/guix.texi | 5 +++-- gnu/services/admin.scm | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0adc6f8c65..9e3b452577 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27162,8 +27162,9 @@ File Search Services is taken. @item @code{schedule} (default: @code{%default-file-database-update-schedule}) -String or G-exp denoting an mcron schedule for the periodic -@command{updatedb} job (@pxref{Guile Syntax,,, mcron, GNU@tie{}mcron}). +This is the schedule of database updates, expressed as a string in +traditional cron syntax or as a gexp evaluating to a Shepherd calendar +event (@pxref{Timers,,, shepherd, The GNU Shepherd Manual}). @item @code{excluded-directories} (default @code{%default-file-database-excluded-directories}) List of regular expressions of directories to ignore when building the diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 726ca5f918..5f5b76ffbb 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm @@ -462,7 +462,7 @@ (define-configuration/no-serialization file-database-configuration guix locate}). This list is passed to the @option{--prunepaths} option of @command{updatedb} (@pxref{Invoking updatedb,,, find, GNU@tie{}Findutils}).")) -(define (file-database-mcron-jobs configuration) +(define (file-database-shepherd-services configuration) (match-record configuration (package schedule excluded-directories) (let ((updatedb (program-file @@ -481,13 +481,27 @@ (define (file-database-mcron-jobs configuration) #$(string-append "--prunepaths=" (string-join excluded-directories))))))) - (list #~(job #$schedule #$updatedb))))) + (list (shepherd-service + (provision '(file-database-update)) + (requirement '(user-processes)) + (modules '((shepherd service timer))) + (start #~(make-timer-constructor + #$(if (string? schedule) + #~(cron-string->calendar-event #$schedule) + schedule) + (command '(#$updatedb)) + #:wait-for-termination? #t)) + (stop #~(make-timer-destructor)) + (documentation + "Periodically update the system-wide file database that can be +queried by the 'locate' command.") + (actions (list shepherd-trigger-action))))))) (define file-database-service-type (service-type (name 'file-database) - (extensions (list (service-extension mcron-service-type - file-database-mcron-jobs))) + (extensions (list (service-extension shepherd-root-service-type + file-database-shepherd-services))) (description "Periodically update the file database used by the @command{locate} command, which lets you search for files by name. The database is created by running