[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/12: import: elpa: Improve error message reporting.
From: |
Federico Beffa |
Subject: |
03/12: import: elpa: Improve error message reporting. |
Date: |
Sat, 01 Aug 2015 10:39:18 +0000 |
beffa pushed a commit to branch master
in repository guix.
commit 6544aba5fc43c5e8f3ce558d02354cdde9a68ce9
Author: Federico Beffa <address@hidden>
Date: Wed Jul 22 15:26:12 2015 +0200
import: elpa: Improve error message reporting.
* guix/import/elpa.scm (filter-dependencies): Fix bug.
(call-with-downloaded-file): Add optional parameter 'error-thunk'.
(fetch-package-description): Use it.
---
guix/import/elpa.scm | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 3b3dc1f..b3a3a96 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -52,7 +52,7 @@ past were distributed separately from Emacs."
(define (filter-dependencies names)
"Remove the package names included with Emacs from the list of
NAMES (strings)."
- (filter emacs-standard-library? names))
+ (filter (compose not emacs-standard-library?) names))
(define (elpa-name->package-name name)
"Given the NAME of an Emacs package, return the corresponding Guix name."
@@ -77,14 +77,17 @@ NAMES (strings)."
(call-with-downloaded-file url read)
(leave (_ "~A: currently not supported~%") repo))))
-(define (call-with-downloaded-file url proc)
+(define* (call-with-downloaded-file url proc #:optional (error-thunk #f))
"Fetch URL, store the content in a temporary file and call PROC with that
-file. Returns the value returned by PROC."
+file. Returns the value returned by PROC. On error call ERROR-THUNK and
+return its value or leave if it's false."
(call-with-temporary-output-file
(lambda (temp port)
(or (and (url-fetch url temp)
(call-with-input-file temp proc))
- (error "download failed" url)))))
+ (if error-thunk
+ (error-thunk)
+ (leave (_ "~A: download failed~%") url))))))
(define (is-elpa-package? name elpa-pkg-spec)
"Return true if the string NAME corresponds to the name of the package
@@ -158,8 +161,9 @@ include VERSION."
(define (fetch-package-description kind name repo)
"Fetch the description of package NAME of type KIND from REPO."
- (let ((url (full-url repo name "-readme.txt")))
- (call-with-downloaded-file url read-string)))
+ (let ((url (full-url repo name "-readme.txt"))
+ (error-thunk (lambda () "No description available.")))
+ (call-with-downloaded-file url read-string error-thunk)))
(define* (fetch-elpa-package name #:optional (repo 'gnu))
"Fetch package NAME from REPO."
- branch master updated (8fd857f -> 48dbeef), Federico Beffa, 2015/08/01
- 03/12: import: elpa: Improve error message reporting.,
Federico Beffa <=
- 05/12: gnu: Add emacs-s., Federico Beffa, 2015/08/01
- 01/12: gnu: Add fastcap., Federico Beffa, 2015/08/01
- 04/12: gnu: Add emacs-dash., Federico Beffa, 2015/08/01
- 06/12: build: emacs: Fix bug and improvement robustness., Federico Beffa, 2015/08/01
- 02/12: gnu: Add fasthenry., Federico Beffa, 2015/08/01
- 08/12: gnu: Add python-mistune., Federico Beffa, 2015/08/01
- 07/12: gnu: Add emacs-f., Federico Beffa, 2015/08/01
- 09/12: gnu: Add python-ptyprocess., Federico Beffa, 2015/08/01
- 12/12: gnu: Add emacs-ob-ipython., Federico Beffa, 2015/08/01
- 10/12: gnu: Add python-terminado., Federico Beffa, 2015/08/01