guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is "append" the activation service's "compose" procedure?


From: Chris Marusich
Subject: Re: Why is "append" the activation service's "compose" procedure?
Date: Thu, 29 Mar 2018 09:32:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> Chris Marusich <address@hidden> skribis:
>
>> The fold-services procedure always applies the "compose" procedure to a
>> single list.  So why does the activation-service-type use the append
>> procedure as its "compose" procedure?  Wouldn't it more accurately
>> reflect our intent if we used the identity procedure instead?
>
> Yes, you’re right here as well.  :-)
>
> ‘boot-service-type’ has the same problem.
>
> Can you fix both?

I've done this in commit 7874e9e047219cce5ae339e57cd76f158bc19f63.

By the way, I noticed that the cups-service-type also uses "append" as
its "compose" procedure.  I think this is suspicious.  The comment in
the code says:

    ;; Extensions consist of lists of packages (representing CUPS
    ;; drivers, etc) that we just concatenate.
    (compose append)

However, that doesn't seem to be what's going on in the "extend"
procedure that follows it:

    ;; Add extension packages by augmenting the cups-configuration
    ;; 'extensions' field.
    (extend
     (lambda (config extensions)
       (cond
        ((cups-configuration? config)
         (cups-configuration
          (inherit config)
          (extensions
           (append (cups-configuration-extensions config)
                   extensions))))
        (else
         (opaque-cups-configuration
          (inherit config)
          (extensions
           (append (opaque-cups-configuration-extensions config)
                   extensions)))))))

Since there are no examples of extensions of the cups-service-type in
the Guix source tree, I'm not really sure what the intended behavior is.
If the "compute" procedure of any <service-extension> object that
extends the cups-service-type is intended to return a single package,
then my guess is that the "compose" procedure above should really be
identity, not append, in order to more accurately reveal the intent.
However, if the "compute" procedure is intended to return a list of
packages, then my guess is that the cups-service-type may not be
functioning as intended, and to fix it we will need to change the
"compose" procedure to concatenate.

Can someone who is familiar with the cups-service-type clarify what the
"compute" procedure of an extension of the cups-service-type is actually
supposed to return?  I've CC'd Andy, who originally added the
cups-service-type, in the hope that he might respond.

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]