summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-01-06 18:22:21 +0100
committerLudovic Courtès <ludo@gnu.org>2021-01-07 12:08:40 +0100
commitb793718cb482a2d2c9fb3de1c90baaf388a0eef5 (patch)
tree1474971b043167d8d092174a61b3c634a500e11b
parent8d3184c5bcf1a590f59a701f0484ab5cec673188 (diff)
downloadguix-b793718cb482a2d2c9fb3de1c90baaf388a0eef5.tar.gz
import: elpa: Updater gracefully handles missing upstream data.
Fixes a crash with:

  guix refresh emacs-exwm-no-x-toolkit

* guix/import/elpa.scm (latest-release): Return #f when
'elpa-package-info' returns #f.
-rw-r--r--guix/import/elpa.scm33
1 files changed, 19 insertions, 14 deletions
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 1d586acab6..c0dc5acf51 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
-;;; Copyright © 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -419,19 +419,24 @@ type '<elpa-package>'."
         (string-drop (package-name package) 6)
         (package-name package)))
 
-  (let* ((repo    'gnu)
-         (info    (elpa-package-info name repo))
-         (version (match info
-                    ((name raw-version . _)
-                     (elpa-version->string raw-version))))
-         (url     (match info
-                    ((_ raw-version reqs synopsis kind . rest)
-                     (package-source-url kind name version repo)))))
-    (upstream-source
-     (package (package-name package))
-     (version version)
-     (urls (list url))
-     (signature-urls (list (string-append url ".sig"))))))
+  (define repo 'gnu)
+
+  (match (elpa-package-info name repo)
+    (#f
+     ;; No info, perhaps because PACKAGE is not truly an ELPA package.
+     #f)
+    (info
+     (let* ((version (match info
+                       ((name raw-version . _)
+                        (elpa-version->string raw-version))))
+            (url     (match info
+                       ((_ raw-version reqs synopsis kind . rest)
+                        (package-source-url kind name version repo)))))
+       (upstream-source
+        (package (package-name package))
+        (version version)
+        (urls (list url))
+        (signature-urls (list (string-append url ".sig"))))))))
 
 (define package-from-gnu.org?
   (url-predicate (lambda (url)