mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-07 17:24:57 +01:00
Fixed for upgradable
This commit is contained in:
parent
3b308d9c28
commit
23c8992032
3 changed files with 16 additions and 5 deletions
|
@ -222,7 +222,7 @@ class Packages(Configs):
|
||||||
|
|
||||||
repo_ver: str = BinQueries(package, self.repo).version()
|
repo_ver: str = BinQueries(package, self.repo).version()
|
||||||
help_text: str = f'Package: {package}-{repo_ver}'
|
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:
|
if self.mode == 'upgrade' and upgradable:
|
||||||
status: bool = True
|
status: bool = True
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Upgrade(Configs):
|
||||||
|
|
||||||
if inst_pkg_name in repo_packages:
|
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):
|
if not self.utils.is_option(self.flag_bin_repository, self.flags):
|
||||||
requires += Requires(inst_pkg_name).resolve()
|
requires += Requires(inst_pkg_name).resolve()
|
||||||
|
|
|
@ -13,6 +13,7 @@ from slpkg.configs import Configs
|
||||||
from slpkg.blacklist import Blacklist
|
from slpkg.blacklist import Blacklist
|
||||||
from slpkg.sbos.queries import SBoQueries
|
from slpkg.sbos.queries import SBoQueries
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
|
from slpkg.binaries.queries import BinQueries
|
||||||
|
|
||||||
|
|
||||||
class Utilities:
|
class Utilities:
|
||||||
|
@ -30,6 +31,7 @@ class Utilities:
|
||||||
self.endc: str = self.color['endc']
|
self.endc: str = self.color['endc']
|
||||||
self.red: str = self.color['red']
|
self.red: str = self.color['red']
|
||||||
self.bred: str = f'{self.bold}{self.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_packages: list = list(self.all_installed())
|
||||||
self.installed_package_names: list = list(self.all_installed_names())
|
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.strftime(f'[{self.cyan}%H:%M:%S{self.endc}]',
|
||||||
time.gmtime(elapsed_time)))
|
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. """
|
""" Checks if the package is installed and if it is upgradeable, returns true. """
|
||||||
installed_version: str = '0'
|
installed_version: str = '0'
|
||||||
installed = self.is_package_installed(package)
|
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]
|
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:
|
if not repo_build_tag:
|
||||||
repo_build_tag: str = ''
|
repo_build_tag: str = ''
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue