[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 01/10: service: Rename 'make-actions' to 'actions'.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 01/10: service: Rename 'make-actions' to 'actions'. |
Date: |
Thu, 27 Apr 2023 10:16:35 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit 9193e58288faf3dd23723e2c65bf0987792898e4
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Apr 27 10:03:17 2023 +0200
service: Rename 'make-actions' to 'actions'.
* modules/shepherd/service.scm (make-actions): Rename to...
(actions): ... this.
(make-actions): Define as a deprecated alias for 'make-actions'.
(<service>, service, root-service): Use 'actions'.
* modules/shepherd/service/monitoring.scm (monitoring-service):
Likewise.
* tests/basic.sh, tests/replacement.sh: Adjust accordingly.
* doc/shepherd.texi (Defining Services): Update accordingly.
---
doc/shepherd.texi | 8 ++++----
modules/shepherd/service.scm | 23 ++++++++++++++++-------
modules/shepherd/service/monitoring.scm | 2 +-
tests/basic.sh | 10 +++++-----
tests/replacement.sh | 4 ++--
5 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 16af4ae..d07c44e 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -636,7 +636,7 @@ procedure and its optional keyword arguments.
@defun service @var{provision} @
[#:requirement '()] [#:one-shot? #f] [#:transient? #f] @
[#:respawn? #f] [#:start (const #t)] [#:stop (const #f)] @
- [#:actions (make-actions)] @
+ [#:actions (actions)] @
[#:termination-handler default-service-termination-handler] @
[#:documentation #f]
@cindex canonical name of services
@@ -727,7 +727,7 @@ procedure, which respawns the service if applicable.
@cindex service actions
The additional actions that can be performed on the service when it is
running. A typical example for this is the @code{restart} action. The
-@code{make-actions} macro can be used to defined actions (see below).
+@code{actions} macro can be used to defined actions (see below).
@end table
@end defun
@@ -735,10 +735,10 @@ A special service that every other service implicitly
depends on is the
@code{root} (also known as @code{shepherd}) service. @xref{The root
Service}, for more information.
-Service actions are defined using the @code{make-actions} macro, as
+Service actions are defined using the @code{actions} macro, as
shown below.
-@defmac make-actions (name proc) @dots{}
+@defmac actions (name proc) @dots{}
Create a value for the @code{#:actions} parameter of @code{service}.
Each @var{name} is a symbol and each @var{proc} the corresponding
procedure that will be called to perform the action. A @var{proc} has
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 7b78336..2bcf149 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -124,7 +124,6 @@
check-for-dead-services
root-service
- make-actions
&service-error
service-error?
@@ -132,6 +131,8 @@
missing-service-error?
missing-service-name
+ actions
+
&unknown-action-error
unknown-action-error?
unknown-action-name
@@ -164,6 +165,7 @@
stop
action
action-list
+ make-actions
lookup-action
defines-action?
lookup-services))
@@ -184,17 +186,24 @@
;; Conveniently create a list of <action> objects containing the actions for a
;; <service> object.
-(define-syntax make-actions
+(define-syntax actions
(syntax-rules ()
((_ (name docstring proc) rest ...)
(cons (make-action 'name proc docstring)
- (make-actions rest ...)))
+ (actions rest ...)))
((_ (name proc) rest ...)
(cons (make-action 'name proc "[No documentation.]")
- (make-actions rest ...)))
+ (actions rest ...)))
((_)
'())))
+(define-syntax-rule (make-actions rest ...)
+ "Deprecated alias for @code{actions}."
+ (begin
+ (issue-deprecation-warning "The 'make-actions' macro is deprecated; \
+use 'actions' instead.")
+ (actions rest ...)))
+
;; Respawning CAR times in CDR seconds will disable the service.
;;
;; XXX: The terrible hack in (shepherd) using SIGALRM to work around
@@ -290,7 +299,7 @@ Log abnormal termination reported by @var{status}."
;; on this.
(actions #:init-keyword #:actions
#:getter service-actions
- #:init-form (make-actions))
+ #:init-form (actions))
;; Procedure called to notify that the process associated with this service
;; has terminated.
(handle-termination #:init-keyword #:handle-termination
@@ -314,7 +323,7 @@ Log abnormal termination reported by @var{status}."
(respawn? #f)
(start (lambda () #t))
(stop (lambda (running) #f))
- (actions (make-actions))
+ (actions (actions))
(termination-handler default-service-termination-handler)
(documentation (l10n "[No description].")))
"Return a new service with the given @var{provision}, a list of symbols
@@ -2644,7 +2653,7 @@ where prctl/PR_SET_CHILD_SUBREAPER is unsupported."
;; user-defined code without catching `quit', since they are
;; allowed to quit, while user-supplied code shouldn't be.
#:actions
- (make-actions
+ (actions
(help
"Show the help message for the 'root' service."
(lambda _
diff --git a/modules/shepherd/service/monitoring.scm
b/modules/shepherd/service/monitoring.scm
index cf812c9..8b11e89 100644
--- a/modules/shepherd/service/monitoring.scm
+++ b/modules/shepherd/service/monitoring.scm
@@ -82,7 +82,7 @@ every @var{period} seconds."
(put-message channel 'stop)
#f)
#:actions
- (make-actions
+ (actions
(period
"Set the logging period (in minutes) of the monitoring system."
(lambda (channel period)
diff --git a/tests/basic.sh b/tests/basic.sh
index 7a0d40a..04f37c4 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -55,11 +55,11 @@ cat > "$conf"<<EOF
#t)
#:stop (lambda _
(delete-file "$stamp-2"))
- #:actions (make-actions (hi "Say hi."
- (lambda _
- (display "start\n\nend\n")
- #t))
- (fail "Fail." (const #f)))
+ #:actions (actions (hi "Say hi."
+ (lambda _
+ (display "start\n\nend\n")
+ #t))
+ (fail "Fail." (const #f)))
#:respawn? #f)
(service
'(spawn-with-system)
diff --git a/tests/replacement.sh b/tests/replacement.sh
index ba8b2c9..21e3bc1 100644
--- a/tests/replacement.sh
+++ b/tests/replacement.sh
@@ -38,7 +38,7 @@ cat > "$conf"<<EOF
(service
'(test)
#:start (const #t)
- #:actions (make-actions
+ #:actions (actions
(say-hello (lambda _
(call-with-output-file "$stamp"
(lambda (port)
@@ -63,7 +63,7 @@ cat > "$rconf"<<EOF
(service
'(test)
#:start (const #t)
- #:actions (make-actions
+ #:actions (actions
(say-goodbye (lambda _
(call-with-output-file "$stamp"
(lambda (port)
- [shepherd] branch master updated (69f93a6 -> b79b9a3), Ludovic Courtès, 2023/04/27
- [shepherd] 04/10: doc: Clarify upfront what the config file does., Ludovic Courtès, 2023/04/27
- [shepherd] 02/10: service: 'register-services' now takes a list of services., Ludovic Courtès, 2023/04/27
- [shepherd] 03/10: tests: Update for new 'register-services' interface., Ludovic Courtès, 2023/04/27
- [shepherd] 07/10: service: 'shutdown-services' does not stop 'root'., Ludovic Courtès, 2023/04/27
- [shepherd] 01/10: service: Rename 'make-actions' to 'actions'.,
Ludovic Courtès <=
- [shepherd] 05/10: doc: Update user services example., Ludovic Courtès, 2023/04/27
- [shepherd] 06/10: herd: Add 'graph' action., Ludovic Courtès, 2023/04/27
- [shepherd] 08/10: service: Localize help message of the 'root' service., Ludovic Courtès, 2023/04/27
- [shepherd] 10/10: repl: Update calls to deprecated 'start'., Ludovic Courtès, 2023/04/27
- [shepherd] 09/10: herd: Use 'strftime' rather than 'date->string' for 'status' output., Ludovic Courtès, 2023/04/27