gnu-maintenance: Avoid network access in 'gnu-package?'.
* guix/gnu-maintenance.scm (gnu-package?): Add 'mirror-type' procedure. Resort to 'official-gnu-packages' only when 'mirror-type' returns #f.
This commit is contained in:
parent
0423b7847b
commit
187eb5f643
|
@ -167,13 +167,22 @@
|
||||||
(lambda (package)
|
(lambda (package)
|
||||||
"Return true if PACKAGE is a GNU package. This procedure may access the
|
"Return true if PACKAGE is a GNU package. This procedure may access the
|
||||||
network to check in GNU's database."
|
network to check in GNU's database."
|
||||||
;; TODO: Find a way to determine that a package is non-GNU without going
|
(define (mirror-type url)
|
||||||
;; through the network.
|
(let ((uri (string->uri url)))
|
||||||
|
(and (eq? (uri-scheme uri) 'mirror)
|
||||||
|
(if (member (uri-host uri) '("gnu" "gnupg" "gcc"))
|
||||||
|
'gnu
|
||||||
|
'non-gnu))))
|
||||||
|
|
||||||
(let ((url (and=> (package-source package) origin-uri))
|
(let ((url (and=> (package-source package) origin-uri))
|
||||||
(name (package-name package)))
|
(name (package-name package)))
|
||||||
(or (and (string? url) (string-prefix? "mirror://gnu" url))
|
(case (and url (mirror-type url))
|
||||||
|
((gnu) #t)
|
||||||
|
((non-gnu) #f)
|
||||||
|
(else
|
||||||
|
;; Last resort: resort to the network.
|
||||||
(and (member name (map gnu-package-name (official-gnu-packages)))
|
(and (member name (map gnu-package-name (official-gnu-packages)))
|
||||||
#t)))))))
|
#t))))))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Reference in New Issue