lint: 'source' check no longer complains about unavailable mirrors.

Fixes a regression introduced in
50fc2384fe.

Previously, 'guix lint -c source coreutils' would complain if one of the
mirrors was unavailable.  This is no longer the case.

* guix/lint.scm (check-source)[warnings-for-uris]: Use 'filter-map'.
Remove 'append-map' call.
Use 'append-map' here so that we can meaningfull compare the length or
URIS and that of WARNINGS.
Use '=' to compare lengths.
This commit is contained in:
Ludovic Courtès 2019-07-20 01:13:46 +02:00
parent 571f6e7f4f
commit 848ae71ea7
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 8 additions and 8 deletions

View File

@ -742,21 +742,21 @@ descriptions maintained upstream."
"Emit a warning if PACKAGE has an invalid 'source' field, or if that "Emit a warning if PACKAGE has an invalid 'source' field, or if that
'source' is not reachable." 'source' is not reachable."
(define (warnings-for-uris uris) (define (warnings-for-uris uris)
(filter lint-warning? (filter-map (lambda (uri)
(map (match (validate-uri uri package 'source)
(lambda (uri) (#t #f)
(validate-uri uri package 'source)) ((? lint-warning? warning) warning)))
(append-map (cut maybe-expand-mirrors <> %mirrors) uris))
uris))))
(let ((origin (package-source package))) (let ((origin (package-source package)))
(if (and origin (if (and origin
(eqv? (origin-method origin) url-fetch)) (eqv? (origin-method origin) url-fetch))
(let* ((uris (map string->uri (origin-uris origin))) (let* ((uris (append-map (cut maybe-expand-mirrors <> %mirrors)
(map string->uri (origin-uris origin))))
(warnings (warnings-for-uris uris))) (warnings (warnings-for-uris uris)))
;; Just make sure that at least one of the URIs is valid. ;; Just make sure that at least one of the URIs is valid.
(if (eq? (length uris) (length warnings)) (if (= (length uris) (length warnings))
;; When everything fails, report all of WARNINGS, otherwise don't ;; When everything fails, report all of WARNINGS, otherwise don't
;; report anything. ;; report anything.
;; ;;