lint: source: Stop as soon as a valid URL is found.

This restores the behavior of 'guix lint' prior to commit
50fc2384fe.

* guix/lint.scm (check-source)[warnings-for-uris]: Rewrite to stop as
soon as one of URIS is valid.
This commit is contained in:
Ludovic Courtès 2019-07-20 01:30:29 +02:00
parent 6dc28adf72
commit 674b9df37d
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 12 additions and 5 deletions

View File

@ -740,11 +740,18 @@ 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-map (lambda (uri) (let loop ((uris uris)
(warnings '()))
(match uris
(()
(reverse warnings))
((uri rest ...)
(match (validate-uri uri package 'source) (match (validate-uri uri package 'source)
(#t #f) (#t
((? lint-warning? warning) warning))) ;; We found a working URL, so stop right away.
uris)) '())
((? lint-warning? warning)
(loop rest (cons warning warnings))))))))
(let ((origin (package-source package))) (let ((origin (package-source package)))
(if (and origin (if (and origin