Updated for methods

This commit is contained in:
Dimitris Zlatanidis 2023-05-07 17:01:36 +03:00
parent d9a84f81e8
commit 0e55075031

View file

@ -30,22 +30,31 @@ class SearchPackage(Configs):
f'packages that contains \'{", ".join([p for p in self.packages])}\':\n')
if self.repository == '*':
self.search_to_enabled_repositories()
self.search_to_all_repositories()
else:
self.search_for_packages()
self.search_to_the_repository()
self.summary_of_searching()
def search_to_enabled_repositories(self):
def search_to_all_repositories(self):
for repo, value in self.repos.repositories.items():
if value[0]: # Check if the repository is enabled
if self.utils.is_binary_repo(repo):
self.search_into_binary_repositories(repo)
data: dict = BinQueries(repo).repository_data()
self.search_for_the_packages(data, repo)
else:
self.search_into_slackbuild_repositories(repo)
data: dict = SBoQueries(repo).repository_data()
self.search_for_the_packages(data, repo)
def search_into_binary_repositories(self, repo):
data: dict = BinQueries(repo).repository_data()
def search_to_the_repository(self):
if self.is_binary:
data: dict = BinQueries(self.repository).repository_data()
self.search_for_the_packages(data, self.repository)
else:
data: dict = SBoQueries(self.repository).repository_data()
self.search_for_the_packages(data, self.repository)
def search_for_the_packages(self, data, repo):
for package in self.packages:
for name, data_pkg in data.items():
@ -53,21 +62,6 @@ class SearchPackage(Configs):
self.matching += 1
self.data_dict[self.matching] = (repo, name, data_pkg[0])
def search_into_slackbuild_repositories(self, repo):
data: dict = SBoQueries(repo).repository_data()
for package in self.packages:
for name, data_pkg in data.items():
if package in name or package == '*':
self.matching += 1
self.data_dict[self.matching] = (repo, name, data_pkg[2])
def search_for_packages(self):
if self.is_binary:
self.search_into_binary_repositories(self.repository)
else:
self.search_into_slackbuild_repositories(self.repository)
def summary_of_searching(self):
if self.matching:
for pkg, item in self.data_dict.items():