aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-08-31 15:16:36 +0200
committerLudovic Courtès <ludo@gnu.org>2016-08-31 15:44:20 +0200
commit6673bddc9ae8f8835a8676cfb3ca0f5b9eb29405 (patch)
tree58f47d6955322fec81bad710c70d6b293e6d1ae7
parentf20a7b869668b46a011d22e4c1dcb68f855a1c62 (diff)
downloadguix-6673bddc9ae8f8835a8676cfb3ca0f5b9eb29405.tar
guix-6673bddc9ae8f8835a8676cfb3ca0f5b9eb29405.tar.gz
services: shepherd: Parameterize 'shepherd-service-back-edges'.
* gnu/services/shepherd.scm (shepherd-service-back-edges): Add #:provision and #:requirement parameter. Honor them.
-rw-r--r--gnu/services/shepherd.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 3cfca8574e..426b0e7290 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -268,11 +268,17 @@ procedure that takes a service and returns the list of symbols it provides."
((_ . service) service)
(#f #f)))))
-(define (shepherd-service-back-edges services)
+(define* (shepherd-service-back-edges services
+ #:key
+ (provision shepherd-service-provision)
+ (requirement shepherd-service-requirement))
"Return a procedure that, when given a <shepherd-service> from SERVICES,
-returns the list of <shepherd-service> that depend on it."
+returns the list of <shepherd-service> that depend on it.
+
+Use PROVISION and REQUIREMENT as one-argument procedures that return the
+symbols provided/required by a service."
(define provision->service
- (shepherd-service-lookup-procedure services))
+ (shepherd-service-lookup-procedure services provision))
(define edges
(fold (lambda (service edges)
@@ -280,7 +286,7 @@ returns the list of <shepherd-service> that depend on it."
(vhash-consq (provision->service requirement) service
edges))
edges
- (shepherd-service-requirement service)))
+ (requirement service)))
vlist-null
services))