summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-20 01:30:29 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-20 01:32:18 +0200
commit674b9df37da90ec6536e0ea7a5ab36785b732ae5 (patch)
tree0677dc55ed80ae939a7ded440545a932516a0e61
parent6dc28adf7285a170798a79a2f4ce3c35c1c611c2 (diff)
downloadguix-674b9df37da90ec6536e0ea7a5ab36785b732ae5.tar.gz
lint: source: Stop as soon as a valid URL is found.
This restores the behavior of 'guix lint' prior to commit
50fc2384feb3bb2677d074f8f0deb5ae3c56b4d8.

* guix/lint.scm (check-source)[warnings-for-uris]: Rewrite to stop as
soon as one of URIS is valid.
-rw-r--r--guix/lint.scm17
1 files changed, 12 insertions, 5 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 1d097b1682..7a2bf5a347 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -740,11 +740,18 @@ descriptions maintained upstream."
   "Emit a warning if PACKAGE has an invalid 'source' field, or if that
 'source' is not reachable."
   (define (warnings-for-uris uris)
-    (filter-map (lambda (uri)
-                  (match (validate-uri uri package 'source)
-                    (#t #f)
-                    ((? lint-warning? warning) warning)))
-                uris))
+    (let loop ((uris uris)
+               (warnings '()))
+      (match uris
+        (()
+         (reverse warnings))
+        ((uri rest ...)
+         (match (validate-uri uri package 'source)
+           (#t
+            ;; We found a working URL, so stop right away.
+            '())
+           ((? lint-warning? warning)
+            (loop rest (cons warning warnings))))))))
 
   (let ((origin (package-source package)))
     (if (and origin