diff --git a/slpkg/init.py b/slpkg/init.py index 72fcbe02..f24ddaa2 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -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 "" diff --git a/slpkg/main.py b/slpkg/main.py index 90db640f..f0fd2f91 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -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")