Subject: [bug#54986] [PATCH v2 3/3 WIP] services: mpd: Support socket activation.

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 23 Apr 2022 20:36:19 +0200

Am Samstag, dem 23.04.2022 um 19:31 +0200 schrieb Maxime Devos:
> > +(define (shepherd-endpoint->sexp endpoint)
> > +  (match endpoint
> > +    (($ <shepherd-endpoint> address
> > +                            name style backlog socket-owner
> > socket-
> group
> > +                            socket-directory-permissions)
> > +     `(endpoint
> > +       ,(match (sockaddr:fam address)
> > +          ((? (cute = <> AF_INET) _)
> > +           `(make-socket-addr AF_INET
> > +                              ,(sockaddr:addr address)
> > +                              ,(sockaddr:port address)))
> 
> Liliana Marie Prikler schreef op za 23-04-2022 om 16:39 [+0200]:
> > +                 (list #$@(map shepherd-endpoint->sexp
> > +                               (mpd-configuration-shepherd-
> > endpoints config))) 
> 
> For hygiene reasons, should 'shepherd-endpoint->sexp' use @?
> 
>   `((@ (the module) endpoint)
>     ,(match [...]
>         ((@ [...] make-socket-addr (@ [...] AF_UNIX) ...)
>         ...))
> 
> That way, no assumptions are made on what modules are imported and it
> avoids hygiene problems like in
> 
>   ;; There are two ‘endpoints’ here: the ‘API endpoint’,
>   ;; and Shepherd endpoints.
>   #~(let ((endpoint "http://localhost:1234/api"))
>       (make-systemd-constructor
>          (list #$(file-append soft "/bin/ware")
>                "--endpoint" #$endpoint)
>          (list (shepherd-endpoint->sexp ...))))
Good point, that's should probably done for defensive programming. 
Note also that I'm missing half of the documentation still, so it won't
be pushed too soon, though.