unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Xinglu Chen <public@yoctocell.xyz>
Cc: Julien Lepiller <julien@lepiller.eu>, 51091@debbugs.gnu.org
Subject: [bug#51091] [PATCH] guix: opam: Do not fail when refreshing.
Date: Thu, 14 Oct 2021 15:01:18 +0200	[thread overview]
Message-ID: <871r4nrc9t.fsf_-_@gnu.org> (raw)
In-Reply-To: <87y272lepg.fsf@yoctocell.xyz> (Xinglu Chen's message of "Sat, 09 Oct 2021 11:39:23 +0200")

Hi,

Xinglu Chen <public@yoctocell.xyz> skribis:

> On Fri, Oct 08 2021, Julien Lepiller wrote:

[...]

>> Because we throw an error when a package is not in the opam repository,
>> the updater would crash when encountering a package that is not in opam
>> but uses the ocaml-build-system, such as opam itself.  This catches the
>> error and continues without updating said package, and lets us update
>> the rest of the packages.
>>
>> * guix/import/opam.scm (latest-release): Catch errors and do not crash.
>> ---
>>  guix/import/opam.scm | 23 +++++++++++++----------
>>  1 file changed, 13 insertions(+), 10 deletions(-)
>>
>> diff --git a/guix/import/opam.scm b/guix/import/opam.scm
>> index fe13d29f03..8ff1a3ae63 100644
>> --- a/guix/import/opam.scm
>> +++ b/guix/import/opam.scm
>> @@ -409,16 +409,19 @@ package in OPAM."
>>  
>>  (define (latest-release package)
>>    "Return an <upstream-source> for the latest release of PACKAGE."
>> -  (and-let* ((opam-name (guix-package->opam-name package))
>> -             (opam-file (opam-fetch opam-name))
>> -             (version (assoc-ref opam-file "version"))
>> -             (opam-content (assoc-ref opam-file "metadata"))
>> -             (url-dict (metadata-ref opam-content "url"))
>> -             (source-url (metadata-ref url-dict "src")))
>> -    (upstream-source
>> -      (package (package-name package))
>> -      (version version)
>> -      (urls (list source-url)))))
>> +  (catch #t
>
> Using (catch #t ...) is generally not a good idea.  Maybe ‘opam-fetch’ should
> raise a ‘opam-fetch’ condition, and then we would only catch those
> conditions?

Agreed, it’s best to catch the most specific exception, around the most
narrow bits of code, so unexpected errors that denote bugs are properly
reported.

Nitpick: in the commit log, the subject line should start with
“import: opam:”.  :-)

Thanks,
Ludo’.




  reply	other threads:[~2021-10-14 13:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  3:03 [bug#51091] [PATCH] guix: opam: Do not fail when refreshing Julien Lepiller
2021-10-09  9:39 ` Xinglu Chen
2021-10-14 13:01   ` Ludovic Courtès [this message]
2021-10-16  2:10     ` [bug#51091] [PATCH v2] " Julien Lepiller
2021-10-18  8:39       ` Ludovic Courtès
2021-11-19  1:16         ` [bug#51091] [PATCH v3] " Julien Lepiller
2021-11-19  1:43           ` zimoun
2021-11-19  9:16           ` Ludovic Courtès
2021-11-19  9:40             ` zimoun
2021-11-19 11:19             ` Julien Lepiller
2021-11-19 11:30               ` zimoun

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=871r4nrc9t.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=51091@debbugs.gnu.org \
    --cc=julien@lepiller.eu \
    --cc=public@yoctocell.xyz \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).