unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51091] [PATCH] guix: opam: Do not fail when refreshing.
@ 2021-10-08  3:03 Julien Lepiller
  2021-10-09  9:39 ` Xinglu Chen
  0 siblings, 1 reply; 11+ messages in thread
From: Julien Lepiller @ 2021-10-08  3:03 UTC (permalink / raw)
  To: 51091

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

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.

[-- Attachment #2: 0001-guix-opam-Do-not-fail-when-refreshing.patch --]
[-- Type: text/x-patch, Size: 2069 bytes --]

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-19 11:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).