Message ID | 20211008050310.407d6b23@tachikoma.lepiller.eu |
---|---|
State | Accepted |
Headers | show |
Series | [bug#51091] guix: opam: Do not fail when refreshing. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
On Fri, Oct 08 2021, Julien Lepiller wrote: > Hi Guix! > > the attached patch prevents early failures in "guix refresh -t opam". > It will now simply continue when it encounters a package that is not in > the opam repository. > From f6260b762dd78772e0d90d96dd92d22346a09007 Mon Sep 17 00:00:00 2001 > From: Julien Lepiller <julien@lepiller.eu> > Date: Fri, 8 Oct 2021 04:58:27 +0200 > Subject: [PATCH] guix: opam: Do not fail when refreshing. > > 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?
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’.
From f6260b762dd78772e0d90d96dd92d22346a09007 Mon Sep 17 00:00:00 2001 From: Julien Lepiller <julien@lepiller.eu> Date: Fri, 8 Oct 2021 04:58:27 +0200 Subject: [PATCH] guix: opam: Do not fail when refreshing. 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 + (lambda _ + (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))))) + (const #f))) (define %opam-updater (upstream-updater -- 2.33.0