mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
gnu-maintenance: Optimize `gnu-package?'.
* guix/gnu-maintenance.scm (gnu-package?): Capture a memoizing version of `gnu-package?'.
This commit is contained in:
parent
d55a99fed3
commit
65b96a0c10
1 changed files with 10 additions and 9 deletions
|
@ -210,16 +210,17 @@ (define (find-packages regexp)
|
|||
|
||||
(define gnu-package?
|
||||
(memoize
|
||||
(lambda (package)
|
||||
"Return true if PACKAGE is a GNU package. This procedure may access the
|
||||
(let ((official-gnu-packages (memoize official-gnu-packages)))
|
||||
(lambda (package)
|
||||
"Return true if PACKAGE is a GNU package. This procedure may access the
|
||||
network to check in GNU's database."
|
||||
;; TODO: Find a way to determine that a package is non-GNU without going
|
||||
;; through the network.
|
||||
(let ((url (and=> (package-source package) origin-uri))
|
||||
(name (package-name package)))
|
||||
(or (and (string? url) (string-prefix? "mirror://gnu" url))
|
||||
(and (member name (map gnu-package-name (official-gnu-packages)))
|
||||
#t))))))
|
||||
;; TODO: Find a way to determine that a package is non-GNU without going
|
||||
;; through the network.
|
||||
(let ((url (and=> (package-source package) origin-uri))
|
||||
(name (package-name package)))
|
||||
(or (and (string? url) (string-prefix? "mirror://gnu" url))
|
||||
(and (member name (map gnu-package-name (official-gnu-packages)))
|
||||
#t)))))))
|
||||
|
||||
|
||||
;;;
|
||||
|
|
Loading…
Reference in a new issue