diff --git a/slpkg/binaries/install.py b/slpkg/binaries/install.py index cf1b4b82..b9cde77e 100644 --- a/slpkg/binaries/install.py +++ b/slpkg/binaries/install.py @@ -222,7 +222,7 @@ class Packages(Configs): repo_ver: str = BinQueries(package, self.repo).version() help_text: str = f'Package: {package}-{repo_ver}' - upgradable: str = self.utils.is_package_upgradeable(package) + upgradable: str = self.utils.is_package_upgradeable(package, self.flags, self.repo) if self.mode == 'upgrade' and upgradable: status: bool = True diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index df76faa6..de3665a7 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -36,7 +36,7 @@ class Upgrade(Configs): if inst_pkg_name in repo_packages: - if self.utils.is_package_upgradeable(inst_pkg_name): + if self.utils.is_package_upgradeable(inst_pkg_name, self.flags, self.repo): if not self.utils.is_option(self.flag_bin_repository, self.flags): requires += Requires(inst_pkg_name).resolve() diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 321fb731..989db245 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -13,6 +13,7 @@ from slpkg.configs import Configs from slpkg.blacklist import Blacklist from slpkg.sbos.queries import SBoQueries from slpkg.repositories import Repositories +from slpkg.binaries.queries import BinQueries class Utilities: @@ -30,6 +31,7 @@ class Utilities: self.endc: str = self.color['endc'] self.red: str = self.color['red'] self.bred: str = f'{self.bold}{self.red}' + self.flag_bin_repository: list = ['-B=', '--bin-repo='] self.installed_packages: list = list(self.all_installed()) self.installed_package_names: list = list(self.all_installed_names()) @@ -109,14 +111,23 @@ class Utilities: time.strftime(f'[{self.cyan}%H:%M:%S{self.endc}]', time.gmtime(elapsed_time))) - def is_package_upgradeable(self, package: str) -> Any: + def is_package_upgradeable(self, package: str, flags=None, repo='*') -> Any: """ Checks if the package is installed and if it is upgradeable, returns true. """ installed_version: str = '0' installed = self.is_package_installed(package) - repository_version = str(SBoQueries(package).version()) - repo_build_tag: str = self.read_sbo_build_tag(package) inst_build_tag: str = self.split_binary_pkg(installed)[3] + if flags is None: + flags: list = [] + + if self.is_option(self.flag_bin_repository, flags): + repository_version = BinQueries(package, repo).version() + repo_package: str = BinQueries(package, repo).package_bin() + repo_build_tag: str = self.split_binary_pkg(repo_package)[3] + else: + repository_version = SBoQueries(package).version() + repo_build_tag: str = self.read_sbo_build_tag(package) + if not repo_build_tag: repo_build_tag: str = ''