From patchwork Fri Jan 5 10:59:32 2024 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: 58371 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 73A3C27BBE9; Fri, 5 Jan 2024 11:01:41 +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.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED 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 6CFC527BBE2 for ; Fri, 5 Jan 2024 11:01:40 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLhwn-00053O-3t; Fri, 05 Jan 2024 06:01:05 -0500 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 1rLhwh-0004xD-I1 for guix-patches@gnu.org; Fri, 05 Jan 2024 06:00:59 -0500 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 1rLhwh-00055g-8j for guix-patches@gnu.org; Fri, 05 Jan 2024 06:00:59 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLhwl-0004Ej-Eu for guix-patches@gnu.org; Fri, 05 Jan 2024 06:01:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68258] [PATCH 5/7] services: shepherd: Use the 0.10.x GOOPS-less interface. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 11:01:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68258 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68258@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68258-submit@debbugs.gnu.org id=B68258.170445241210210 (code B ref 68258); Fri, 05 Jan 2024 11:01:03 +0000 Received: (at 68258) by debbugs.gnu.org; 5 Jan 2024 11:00:12 +0000 Received: from localhost ([127.0.0.1]:56475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLhvv-0002dR-KH for submit@debbugs.gnu.org; Fri, 05 Jan 2024 06:00:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLhvq-0002GS-Ci for 68258@debbugs.gnu.org; Fri, 05 Jan 2024 06:00:07 -0500 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 1rLhvg-0004gu-Rp; Fri, 05 Jan 2024 05:59:56 -0500 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=qTorgKTfZnBv2huM+HKuw8xi27FcXGE4BNOAgWLL1hc=; b=Bn8kw2HcFy2B49hYlLPT I60to2PJIY/pzBndjGN/1JnEwItIG9mhH0pSOLSUalebDm3z7nII1FhS9dsm4+/c4LfpZAJZC99Eo mN3yySy6SSEQHY9Oq0CKU0NXwu5gSXRp8BkCSrgoSYrrNZ6DOODvaKekbKWwYPHtMeyQdR265PVfe nh+fUDVS2vfTLB4tY6xc9hiXrJlp3XhX0OyynHvvfXH30oMqRzHrTXihhzaMMO66W/M5rPNX0viIL kgu3JWahgWns26JDKntdpZ/9nr7m19bEl4S1mwHp5bP5Zam8fWT+8S2biMKBCbjyH5Ax0UeE31o2l w2M4sVgCYTOzEw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 5 Jan 2024 11:59:32 +0100 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/shepherd.scm (%default-modules): Remove (oop goops). (shepherd-service-file): Use (service …) instead of (make …). Use ‘actions’ instead of ‘make-actions’. (scm->go): Remove use of (oop goops). (shepherd-configuration-file): Pass ‘register-services’ a list. Use ‘start-in-the-background’ unconditionally. Change-Id: I0ad1ba32e339c56ee31e59f160b53d3581277d97 --- gnu/services/shepherd.scm | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 8e122f1aab..5ebac129ce 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -183,7 +183,6 @@ (define %default-imported-modules (define %default-modules ;; Default set of modules visible in a service's file. `((shepherd service) - (oop goops) ((guix build utils) #:hide (delete)) (guix build syscalls))) @@ -300,10 +299,10 @@ (define (shepherd-service-file service) #~(begin (use-modules #$@(shepherd-service-modules service)) - (make - #:docstring '#$(shepherd-service-documentation service) - #:provides '#$(shepherd-service-provision service) - #:requires '#$(shepherd-service-requirement service) + (service + '#$(shepherd-service-provision service) + #:documentation '#$(shepherd-service-documentation service) + #:requirement '#$(shepherd-service-requirement service) ;; The 'one-shot?' slot is new in Shepherd 0.6.0. ;; Older versions ignore it. @@ -313,7 +312,7 @@ (define (shepherd-service-file service) #:start #$(shepherd-service-start service) #:stop #$(shepherd-service-stop service) #:actions - (make-actions + (actions #$@(map (match-lambda (($ name proc doc) #~(#$name #$doc #$proc))) @@ -338,7 +337,6 @@ (define (scm->go file shepherd) ;; Do the same as the Shepherd's 'load-in-user-module'. (let ((env (make-fresh-user-module))) - (module-use! env (resolve-interface '(oop goops))) (module-use! env (resolve-interface '(shepherd service))) (with-target #$(or target #~%host-type) (lambda _ @@ -401,25 +399,17 @@ (define (shepherd-configuration-file services shepherd) ;; than a kernel panic. (call-with-error-handling (lambda () - (apply register-services - (parameterize ((current-warning-port - (%make-void-port "w"))) - (map load-compiled '#$(map scm->go files)))))) + (register-services + (parameterize ((current-warning-port + (%make-void-port "w"))) + (map load-compiled '#$(map scm->go files)))))) (format #t "starting services...~%") (let ((services-to-start '#$(append-map shepherd-service-provision (filter shepherd-service-auto-start? services)))) - (if (defined? 'start-in-the-background) - (start-in-the-background services-to-start) - (for-each (lambda (service) ;pre-0.9.0 compatibility - (guard (c ((service-error? c) - (format (current-error-port) - "failed to start service '~a'~%" - service))) - (start service))) - services-to-start)) + (start-in-the-background services-to-start) ;; Hang up stdin. At this point, we assume that 'start' methods ;; that required user interaction on the console (e.g.,