all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xinglu Chen <public@yoctocell.xyz>
To: Julien Lepiller <julien@lepiller.eu>, 53828@debbugs.gnu.org
Subject: [bug#53828] [PATCH] guix: opam: Allow importing local files.
Date: Wed, 09 Feb 2022 14:34:25 +0100	[thread overview]
Message-ID: <87tud8w4da.fsf@yoctocell.xyz> (raw)
In-Reply-To: <E7325AF8-C9EE-4A89-9AE5-390CBD49ABAA@lepiller.eu>

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

  reply	other threads:[~2022-02-09 13:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06 21:41 [bug#53828] [PATCH] guix: opam: Allow importing local files Julien Lepiller
2022-02-06 21:58 ` Maxime Devos
2022-02-07  8:27 ` Xinglu Chen
2022-02-07  8:46   ` Julien Lepiller
2022-02-09 13:34     ` Xinglu Chen [this message]
2022-06-12  6:31 ` [bug#53828] [PATCH v2] import: " Julien Lepiller
2022-06-12  6:37   ` Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tud8w4da.fsf@yoctocell.xyz \
    --to=public@yoctocell.xyz \
    --cc=53828@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.