Updated for repo

This commit is contained in:
Dimitris Zlatanidis 2023-03-27 20:07:59 +03:00
parent 79281f5798
commit 1fd81dc78b
4 changed files with 14 additions and 10 deletions

View file

@ -49,7 +49,7 @@ class Packages(Configs):
self.flag_no_silent: list = ['-n', '--no-silent']
def execute(self) -> None:
self.view_message.install_packages(self.packages, self.mode)
self.view_message.install_packages(self.packages, self.mode, repo=self.repo)
self.view_message.question()
start: float = time.time()

View file

@ -50,7 +50,9 @@ class BinQueries(Configs):
def repository(self) -> str:
""" Return the repository name fo the package. """
repository: tuple = self.session.query(
BinariesTable.repo).filter(BinariesTable.name == self.name).first()
BinariesTable.repo).filter(
BinariesTable.name == self.name).where(
BinariesTable.repo.in_(self.bin_repo)) .first()
if repository:
return repository[0]

View file

@ -295,7 +295,8 @@ class Argparse(Configs):
and not self.utils.is_option([self.flag_binary, self.flag_short_binary], self.flags)):
self.usage.help_minimal(f"{self.prog_name}: invalid options '{', '.join(self.flags)}'")
if self.binary_repo and self.binary_repo not in self.repos.binaries_repositories_dict.keys():
if (self.binary_repo and self.binary_repo not in self.repos.binaries_repositories_dict.keys()
and self.binary_repo != '*'):
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
def invalid_options(self) -> None:

View file

@ -43,15 +43,16 @@ class ViewMessage(Configs):
self.flag_yes: list = ['-y', '--yes']
self.flag_binary: list = ['-B', '--binary']
def view_packages(self, package: str, mode: str) -> None:
def view_packages(self, package: str, mode: str, repo=None) -> None:
""" Printing the main packages. """
size: str = ''
color: str = self.red
if self.utils.is_option(self.flag_binary, self.flags):
version: str = BinQueries(package).version()
size: str = BinQueries(package).size_comp()
repo: str = BinQueries(package).repository()
version: str = BinQueries(package, repo).version()
size: str = BinQueries(package, repo).size_comp()
if repo is None:
repo = BinQueries(package, repo).repository()
else:
version: str = SBoQueries(package).version()
repo: str = SBoQueries('').repo_name()
@ -89,7 +90,7 @@ class ViewMessage(Configs):
self.summary(slackbuilds, dependencies, option='build')
def install_packages(self, packages: list, mode: str, dependencies=None) -> None:
def install_packages(self, packages: list, mode: str, dependencies=None, repo=None) -> None:
""" View packages for install. """
if dependencies is None:
dependencies = []
@ -101,14 +102,14 @@ class ViewMessage(Configs):
self.ascii.draw_package_title_box('The following packages will be installed or upgraded:', title)
for pkg in packages:
self.view_packages(pkg, mode=mode)
self.view_packages(pkg, mode, repo)
if dependencies:
self.ascii.draw_middle_line()
self.ascii.draw_dependency_line()
for pkg in dependencies:
self.view_packages(pkg, mode=mode)
self.view_packages(pkg, mode, repo)
self.summary(packages, dependencies, option=mode)