diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-05-10 15:07:00 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-05-10 15:07:00 +0200 |
commit | fe3e603d14ef55b94d3763619f8c06751fa37ca9 (patch) | |
tree | 0d06d9282751b3da6b63dd8ba8d3bcb44a1bf68d | |
parent | e31ff8b8d0a165b3f403a1269455fa38220821e6 (diff) | |
download | guix-fe3e603d14ef55b94d3763619f8c06751fa37ca9.tar.gz |
refresh: Gracefully handle failure to download a tarball.
* guix/scripts/refresh.scm (guix-refresh): When updating a source file, gracefully handle the case where TARBALL is #f. Reported by Nikita Karetnikov <nikita@karetnikov.org>.
-rw-r--r-- | guix/scripts/refresh.scm | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 69e5114e00..37de3b628d 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -160,13 +160,21 @@ update would trigger a complete rebuild." 'version) (package-location package)))) (when version - (format (current-error-port) - (_ "~a: ~a: updating from version ~a to version ~a...~%") - (location->string loc) (package-name package) - (package-version package) version) - (let ((hash (call-with-input-file tarball - (compose sha256 get-bytevector-all)))) - (update-package-source package version hash))))) + (if (and=> tarball file-exists?) + (begin + (format (current-error-port) + (_ "~a: ~a: updating from version ~a to version ~a...~%") + (location->string loc) + (package-name package) + (package-version package) version) + (let ((hash (call-with-input-file tarball + (compose sha256 + get-bytevector-all)))) + (update-package-source package version + hash))) + (warning (_ "~a: version ~a could not be \ +downloaded and authenticated; not updating") + (package-name package) version))))) packages)) (for-each (lambda (package) (match (false-if-exception (package-update-path package)) |