summaryrefslogtreecommitdiff
path: root/guix/import/launchpad.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-07-03 22:48:04 +0200
committerLudovic Courtès <ludo@gnu.org>2020-07-03 23:53:31 +0200
commitf54cbc0e1b84a5b3785d3b4734600387dde82be9 (patch)
tree779daded7c593c31f9f68f950de166716fbdec14 /guix/import/launchpad.scm
parent00290e7365aed9b34603bfb3cd6e8a4bdc1e7259 (diff)
import: Do not assume that 'package-source' returns an origin.
* guix/gnu-maintenance.scm (gnu-package?): Check whether 'package-source' returns an origin. * guix/import/github.scm (updated-github-url): Likewise. * guix/import/launchpad.scm (updated-launchpad-url): Likewise.
Diffstat (limited to 'guix/import/launchpad.scm')
-rw-r--r--guix/import/launchpad.scm21
1 files changed, 11 insertions, 10 deletions
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index 1a15f28077..c7375837c7 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -57,16 +57,17 @@ false if none is recognized"
"/" new-version "/+download/" repo "-" new-version ext))
(#t #f))))) ; Some URLs are not recognised.
- (let ((source-uri (and=> (package-source old-package) origin-uri))
- (fetch-method (and=> (package-source old-package) origin-method)))
- (cond
- ((eq? fetch-method download:url-fetch)
- (match source-uri
- ((? string?)
- (updated-url source-uri))
- ((source-uri ...)
- (find updated-url source-uri))))
- (else #f))))
+ (match (package-source old-package)
+ ((? origin? origin)
+ (let ((source-uri (origin-uri origin))
+ (fetch-method (origin-method origin)))
+ (and (eq? fetch-method download:url-fetch)
+ (match source-uri
+ ((? string?)
+ (updated-url source-uri))
+ ((source-uri ...)
+ (find updated-url source-uri))))))
+ (_ #f)))
(define (launchpad-package? package)
"Return true if PACKAGE is a package from Launchpad, else false."