Fix check if repositories exists

This commit is contained in:
Dimitris Zlatanidis 2017-02-06 12:52:53 +02:00
parent fa8c839e22
commit 0b69e2ade8
2 changed files with 13 additions and 12 deletions

View file

@ -671,19 +671,18 @@ class Update(object):
raise SystemExit()
def check_exists_repositories():
def check_exists_repositories(repo):
"""Checking if repositories exists by PACKAGES.TXT file
"""
for repo in _meta_.repositories:
pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
if check_for_local_repos(repo) is True:
pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
if check_for_local_repos(repo) is True:
pkg_list = "PACKAGES.TXT"
continue
if not os.path.isfile("{0}{1}{2}".format(
_meta_.lib_path, repo, "_repo/{0}".format(pkg_list))):
return repo
return ""
if not os.path.isfile("{0}{1}{2}".format(
_meta_.lib_path, repo, "_repo/{0}".format(pkg_list))):
return repo
return ""

View file

@ -86,7 +86,9 @@ class ArgParse(object):
]
# checking if repositories exists
repo = check_exists_repositories()
enabled_repos = _meta_.repositories
if len(self.args) > 1:
repo = check_exists_repositories(args[1])
if len(self.args) > 1 and self.args[0] in [
"-c", "--check",
"-l", "--list",
@ -96,7 +98,7 @@ class ArgParse(object):
"-p", "--desc",
"-F", "--FIND",
"-f", "--find"
] and self.args[1] == repo:
] and self.args[1] == repo and repo in enabled_repos:
print("\n Please update packages lists. Run 'slpkg update'.\n" +
" This command should be used to synchronize packages\n" +
" lists from the repositories are enabled.\n")