From patchwork Sun Aug 6 21:07:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 15641 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 B984527BBEA; Sun, 6 Aug 2023 22:08:36 +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.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 AF19827BBE2 for ; Sun, 6 Aug 2023 22:08:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSkyq-0006ug-PX; Sun, 06 Aug 2023 17:08: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 1qSkyq-0006uS-2t for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:04 -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 1qSkyp-0001St-RK for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qSkyp-0005iO-M8 for guix-patches@gnu.org; Sun, 06 Aug 2023 17:08:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65119] [PATCH 2/8] services: dicod: Pre-build the GCIDE index. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 06 Aug 2023 21:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65119 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65119@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 65119-submit@debbugs.gnu.org id=B65119.169135608021914 (code B ref 65119); Sun, 06 Aug 2023 21:08:03 +0000 Received: (at 65119) by debbugs.gnu.org; 6 Aug 2023 21:08:00 +0000 Received: from localhost ([127.0.0.1]:60117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyl-0005hD-Fa for submit@debbugs.gnu.org; Sun, 06 Aug 2023 17:08:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSkyj-0005gi-B8 for 65119@debbugs.gnu.org; Sun, 06 Aug 2023 17:07:57 -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 1qSkye-0001LK-5L; Sun, 06 Aug 2023 17:07: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=s4WQB/tfmyS1mU3k9b5GTVQlS/7665GzIsiFRmxmjXQ=; b=FQO8bRCN/15jgvW6vXmM n0Bcmorbmm42Ur+mYo+ptB9fwFW5/Rz8ofyhI+ogSXpoLrR2vJDBpEz21Zkx27OaFWZ2l8rYJdjUk 5WJImPVgIRz5DiUtSK36G6TSq12gOVsUyasMAoQaZD2/vhGFMyz3BG+RkUy8wWp1cxeaW4duoCUG2 8IJwbZEyoCEGRgbqYqpmQ2roYhP0T44U4tKknRd+zbAs8JUs3KInqgWrk/33+YS1kLQVnRGXTOyGQ b8jtquu3gfLNtI5YoPllSuQwC2cHRck2t9qARxTkHDauLlkagzBUVjpAMCZaiLDY5CGqsO4EvGHJK VK1OYbm3qSqi7Q==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 6 Aug 2023 23:07:29 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 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/dict.scm (%dicod-gcide-index): New variable. (%dicod-database:gcide): Use it. (%dicod-activation): Remove. (dicod-shepherd-service): Remove reference to /var/run/dicod. (dicod-service-type): Remove ACTIVATION-SERVICE-TYPE extension. --- gnu/services/dict.scm | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index 7d48953ef1..f542921302 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -73,12 +73,24 @@ (define-record-type* (complex? dicod-database-complex? (default #f)) (options dicod-database-options (default '()))) +(define %dicod-gcide-index + ;; The GCIDE pre-built index. The Dico 'gcide' module can build it lazily; + ;; do it upfront so there's no need for a writable directory at run-time. + (computed-file "dicod-gcide-index" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (mkdir #$output) + (invoke #+(file-append dico "/libexec/idxgcide") + #+(file-append gcide "/share/gcide") + #$output))))) + (define %dicod-database:gcide (dicod-database (name "gcide") (handler "gcide") (options (list #~(string-append "dbdir=" #$gcide "/share/gcide") - "idxdir=/var/run/dicod")))) + #~(string-append "idxdir=" #$%dicod-gcide-index))))) (define %dicod-accounts (list (user-group @@ -137,14 +149,6 @@ (define (dicod-configuration-file config) (apply mixed-text-file "dicod.conf" (configuration->text config))) -(define %dicod-activation - #~(begin - (use-modules (guix build utils)) - (let ((user (getpwnam "dicod")) - (rundir "/var/run/dicod")) - (mkdir-p rundir) - (chown rundir (passwd:uid user) (passwd:gid user))))) - (define (dicod-shepherd-service config) (let* ((dicod.conf (dicod-configuration-file config)) (interfaces (dicod-configuration-interfaces config)) @@ -153,10 +157,6 @@ (define (dicod-shepherd-service config) "/bin/dicod") #:name "dicod" #:mappings (list (file-system-mapping - (source "/var/run/dicod") - (target source) - (writable? #t)) - (file-system-mapping (source "/dev/log") (target source)) (file-system-mapping @@ -187,8 +187,6 @@ (define dicod-service-type (extensions (list (service-extension account-service-type (const %dicod-accounts)) - (service-extension activation-service-type - (const %dicod-activation)) (service-extension shepherd-root-service-type dicod-shepherd-service))) (default-value (dicod-configuration))