gnu-maintenance: 'gnu-package?' ignores invalid URLs.
authorLudovic Courtès <ludo@gnu.org>
Fri, 27 Jan 2017 22:40:04 +0000 (23:40 +0100)
committerLudovic Courtès <ludo@gnu.org>
Fri, 27 Jan 2017 23:38:20 +0000 (00:38 +0100)
* guix/gnu-maintenance.scm (gnu-package?)[gnu-home-page?]: Add '>>'
threading macro and use it.

guix/gnu-maintenance.scm

index 8a37ce5..9c94992 100644 (file)
@@ -187,11 +187,17 @@ network to check in GNU's database."
                   'non-gnu)))))
 
        (define (gnu-home-page? package)
-         (and=> (package-home-page package)
-                (lambda (url)
-                  (and=> (uri-host (string->uri url))
-                         (lambda (host)
-                           (member host '("www.gnu.org" "gnu.org")))))))
+         (letrec-syntax ((>> (syntax-rules ()
+                               ((_ value proc)
+                                (and=> value proc))
+                               ((_ value proc rest ...)
+                                (and=> value
+                                       (lambda (next)
+                                         (>> (proc next) rest ...)))))))
+           (>> package package-home-page
+               string->uri uri-host
+               (lambda (host)
+                 (member host '("www.gnu.org" "gnu.org"))))))
 
        (or (gnu-home-page? package)
            (let ((url  (and=> (package-source package) origin-uri))