From patchwork Sat Mar 15 21:37:08 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: 40217 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 345E427BBEA; Sat, 15 Mar 2025 21:38:34 +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 856BD27BBE2 for ; Sat, 15 Mar 2025 21:38:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ttZCt-0004ir-GP; Sat, 15 Mar 2025 17:38:11 -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 1ttZCm-0004i3-8U for guix-patches@gnu.org; Sat, 15 Mar 2025 17:38: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 1ttZCl-0002hj-UH; Sat, 15 Mar 2025 17:38:03 -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=FfeSNCX34H322dFDzxetgcIGQ2v4iDzjZmbUHzviTHg=; b=qolz+RGpbtwUkD6/TmUkdPE0+kJ3zmhrU1NozX0kQteK/amPxwjTEFkGoOXLT+cG2SRSkEB75ruk5zi6P3JUKO8XcL8Kj0L7RFfooPt4Le4fbNmZmEGC4qiMI3fj/TNWgISSrolk/k98zqCjaOWqIPGlygXEwxrxALV6ABBtZjX6Dyh07GffxqXAeS0xBY+ntHI1keMjT68RdpWtgNBC4u9o6QC8/H8x5+f8XgCrP+Z2ZqDbY1K9BYrRXGp3kUS7PjmnmA35bNc57ccc/wQzCk64o4RUsbsN3SjrGmFHlQRS9m9wBzgWxgXRrChZuQO590CMSaK3DZZ2mXUFkMy01A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ttZCk-0004ND-T4; Sat, 15 Mar 2025 17:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77041] [PATCH 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, 15 Mar 2025 21: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.174207468116785 (code B ref 77041); Sat, 15 Mar 2025 21:38:02 +0000 Received: (at 77041) by debbugs.gnu.org; 15 Mar 2025 21:38:01 +0000 Received: from localhost ([127.0.0.1]:43814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttZCi-0004MZ-Mk for submit@debbugs.gnu.org; Sat, 15 Mar 2025 17:38:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53250) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttZCf-0004LN-Vg for 77041@debbugs.gnu.org; Sat, 15 Mar 2025 17:37:59 -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 1ttZCa-0002g2-LE; Sat, 15 Mar 2025 17:37:52 -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=FfeSNCX34H322dFDzxetgcIGQ2v4iDzjZmbUHzviTHg=; b=L6D8b74f1Gu7ZoQzJS0K EHZCI1P2C6+3+bl8Dgn5u3C1PVr4yCmTXIhH1Lkk6VSMEYTuqa+JSl6dbuWg0B39d3A5CmXrElizk a/rkWPPOVS/ANbczR0wlL8yLZHJ4sNqtWOwMV2zLwU+sxXDZNs9320ome0mLTRrCHe7EUtafyJFZL 9kYMqR4GEIvzWFgJnDFxwmcVC/SKld7TK3yg63ReFqa5+wL/iVorv+eCzyA5lY8EV6dS+VVbBsk4/ nuvqzWOXjZGbG9wKRpGxj2vTKPFqvHnvsi7DEY0MJHIZ/hONdhsLyGBIUNisujwf2t2gZmFZebItx 3Donzf9y1K7idw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 15 Mar 2025 22:37:08 +0100 Message-ID: <7e1843fdb5c8d0ebe4f3002ea7beb041f0622f5a.1742073920.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 d109877a32..ae7b08ad23 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27152,8 +27152,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