all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH 2/2] import: Add stackage importer and updater.
Date: Thu, 09 Feb 2017 23:48:23 +0100	[thread overview]
Message-ID: <87inojaslk.fsf@gnu.org> (raw)
In-Reply-To: <CAKrPhPNS+HjmGb7_Rz8Axnc0ZB0103NMkA3ingTwhadfRgbjNg@mail.gmail.com> (Federico Beffa's message of "Thu, 9 Feb 2017 19:39:15 +0100")

Federico Beffa <beffa@ieee.org> skribis:

> On Wed, Feb 8, 2017 at 4:30 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> Hello Federico,
>>
>> Federico Beffa <beffa@ieee.org> skribis:
>
>> [...]
>
>>> +    (if name-version
>>> +        (hackage->guix-package name-version
>>> +                               #:include-test-dependencies?
>>> +                               include-test-dependencies?)
>>> +        (begin
>>> +          (format (current-error-port)
>>> +                  "guix import stackage: package not found: ~a~%" package-name)
>>> +          #f))))
>>
>> The ‘if’ is unnecessary here: (guix scripts import) produces an error
>> message when an importer returns something other than a ‘package’ sexp.
>
> I've implemented all suggested changes apart from this one for two reasons:
>
> * If the package is not included in an LTS release then the procedure
> generating name-version returns #f. If I remove the 'if' then
> hackage->guix-package will be called with a boolean instead of a
> string as the first parameter and that will throw an exception.
>
> * Here we can give a more accurate error message: we can say that the
> package was not found in the LTS release, while, by returning, the
> error would be "failed to download cabal file" which is somewhat
> misleading.

Good points!

In that case it’s better to either use ‘warning’ from (guix ui), but
that may not be appropriate here because this module is not supposed to
contain UI code, or to use:

  (raise (condition
            (&message
             (message (format #f (_ "~a: Stackage package not found")
                                 package-name)))))

That way, error messages are always reported in a consistent manner.

Ludo’.

      reply	other threads:[~2017-02-09 22:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07  7:36 [PATCH 2/2] import: Add stackage importer and updater Federico Beffa
2017-02-08 13:19 ` Federico Beffa
2017-02-08 15:30 ` Ludovic Courtès
2017-02-09 18:39   ` Federico Beffa
2017-02-09 22:48     ` Ludovic Courtès [this message]

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=87inojaslk.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=beffa@ieee.org \
    --cc=guix-devel@gnu.org \
    /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.