guix-patches
[Top][All Lists]
Advanced

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

[bug#53828] [PATCH] guix: opam: Allow importing local files.


From: Xinglu Chen
Subject: [bug#53828] [PATCH] guix: opam: Allow importing local files.
Date: Wed, 09 Feb 2022 14:34:25 +0100

Hi,

Julien schrieb am Montag der 07. Februar 2022 um 09:46 +01:

>>> +(define (opam->guix-source url-dict)
>>> +  (let ((source-url (and url-dict
>>> +                         (or (metadata-ref url-dict "src")
>>> +                             (metadata-ref url-dict "archive")))))
>>> +    (if source-url
>>> +        (call-with-temporary-output-file
>>> +          (lambda (temp port)
>>> +            (and (url-fetch source-url temp)
>>> +                 `(origin
>>> +                    (method url-fetch)
>>> +                    (uri ,source-url)
>>> +                    (sha256 (base32 ,(guix-hash-url temp)))))))
>>> +        'no-source-information)))
>>
>>I would use ‘and-let*’ instead of ‘let’, and drop the ‘if’ form.
>
> That would return #f and make the ocher and-let* in opam->guix-package
> fail.

Right, I missed the ‘and-let*’ in ‘opam->guix-package’.  However, seeing
as the ‘source’ variable is only used in the body of the ‘and-let*’, I
think it would make sense to not even bind the result of
‘opam->guix-source’ to any variable, instead using it directly in the
‘package’ form.

  `(package
     …
     (source ,source)
     …)

becomes

  `(package
     …
     (source ,(opam->guix-source (metadata-ref opam-content "url")))
     …)

WDYT?

Attachment: signature.asc
Description: PGP signature


reply via email to

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