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".
This commit is contained in:
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))))))) (upstream-source-version source)))))))
(#f (#f
(when warn? (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,9 +245,9 @@ correspond to the same version."
(define (lookup-updater package updaters) (define (lookup-updater package updaters)
"Return an updater among UPDATERS that matches PACKAGE, or #f if none of "Return an updater among UPDATERS that matches PACKAGE, or #f if none of
them matches." them matches."
(any (match-lambda (find (match-lambda
(($ <upstream-updater> name description pred latest) (($ <upstream-updater> name description pred latest)
(and (pred package) latest))) (pred package)))
updaters)) updaters))
(define (package-latest-release package updaters) (define (package-latest-release package updaters)
@ -255,8 +255,8 @@ them matches."
none of UPDATERS matches PACKAGE. It is the caller's responsibility to ensure none of UPDATERS matches PACKAGE. It is the caller's responsibility to ensure
that the returned source is newer than the current one." that the returned source is newer than the current one."
(match (lookup-updater package updaters) (match (lookup-updater package updaters)
((? procedure? latest-release) ((? upstream-updater? updater)
(latest-release package)) ((upstream-updater-latest updater) package))
(_ #f))) (_ #f)))
(define (package-latest-release* package updaters) (define (package-latest-release* package updaters)