Split known? into a couple of functions

This commit is contained in:
Tom Willemse 2014-03-01 20:00:02 +01:00
parent d5f38b4f6d
commit e72c093057

View file

@ -58,14 +58,21 @@ Displays version and some copyright information."
(display "under the terms of the GNU General Public License.") (newline) (display "under the terms of the GNU General Public License.") (newline)
(display "For more information about these matters, see the file named COPYING.") (newline)) (display "For more information about these matters, see the file named COPYING.") (newline))
(define (registered? repo)
"Check if REPO has been registered."
(or (member repo repositories same-repository?)
(member (realpath (if (string? repo)
repo
(repo-location repo)))
repositories same-repository?)))
(define (valid-repo? repo)
"Check if REPO is or could be made usable as a repository."
(or (repository? repo) (string? repo)))
(define (known? repo) (define (known? repo)
"Do we know REPO?" "Do we know REPO?"
(and (or (repository? repo) (string? repo)) (and (valid-repo? repo) (registered? repo)))
(or (member repo repositories same-repository?)
(member (realpath (if (string? repo)
repo
(repo-location repo)))
repositories same-repository?))))
(define (save-repositories-list) (define (save-repositories-list)
"Save the list of repositories." "Save the list of repositories."