refresh: Distinguish between "no updater" and "failing updater".

Previously, something like "guix refresh texmacs" would report "no
updater".  Now, it reports that the 'gnu-ftp' updater failed to list
releases.

* guix/upstream.scm (lookup-updater): Use 'find' instead of 'any' to
return the <upstream-updater>.
(package-latest-release): Adjust accordingly.
* guix/scripts/refresh.scm (check-for-package-update): When
'package-latest-release' returns #f, distinguish between "no updater"
and "failing updater".
master
Ludovic Courtès 2019-09-09 10:33:42 +02:00
parent 36eef80d45
commit 7c101c4c17
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 16 additions and 8 deletions

View File

@ -368,8 +368,16 @@ the latest known version of ~a (~a)~%")
(upstream-source-version source)))))))
(#f
(when warn?
(warn-no-updater package)))))
;; Distinguish between "no updater" and "failing updater."
(match (lookup-updater package updaters)
((? upstream-updater? updater)
(warning (package-location package)
(G_ "'~a' updater failed to determine available \
releases for ~a~%")
(upstream-updater-name updater)
(package-name package)))
(#f
(warn-no-updater package)))))))
;;;

View File

@ -245,18 +245,18 @@ correspond to the same version."
(define (lookup-updater package updaters)
"Return an updater among UPDATERS that matches PACKAGE, or #f if none of
them matches."
(any (match-lambda
(($ <upstream-updater> name description pred latest)
(and (pred package) latest)))
updaters))
(find (match-lambda
(($ <upstream-updater> name description pred latest)
(pred package)))
updaters))
(define (package-latest-release package updaters)
"Return an upstream source to update PACKAGE, a <package> object, or #f if
none of UPDATERS matches PACKAGE. It is the caller's responsibility to ensure
that the returned source is newer than the current one."
(match (lookup-updater package updaters)
((? procedure? latest-release)
(latest-release package))
((? upstream-updater? updater)
((upstream-updater-latest updater) package))
(_ #f)))
(define (package-latest-release* package updaters)