Fixed upgradeable packages

This commit is contained in:
Dimitris Zlatanidis 2023-02-27 20:47:49 +02:00
parent 5c3432feed
commit 59a78874aa
4 changed files with 13 additions and 7 deletions

View file

@ -123,7 +123,7 @@ class Slackbuilds(Configs):
def is_for_skipped(self, sbo):
""" Condition to check if slackbuild is for skipped. """
return (not self.utils.is_installed(sbo, self.file_pattern) or
self.utils.is_repo_version_bigger(sbo, self.file_pattern) or
self.utils.is_package_upgradeable(sbo, self.file_pattern) or
self.mode == 'build' or self.utils.is_option(self.flag_reinstall, self.flags))
def download_slackbuilds(self):
@ -331,9 +331,15 @@ class Slackbuilds(Configs):
for package in dependencies:
status = False
repo_ver = SBoQueries(package).version()
self.utils.is_repo_version_bigger(package, self.file_pattern)
self.utils.is_package_upgradeable(package, self.file_pattern)
if self.utils.is_repo_version_bigger(package, self.file_pattern):
if self.mode == 'upgrade' and self.utils.is_package_upgradeable(package, self.file_pattern):
status = True
if self.mode == 'install' and not self.utils.is_installed(package, self.file_pattern):
status = True
if self.mode == 'install' and self.utils.is_package_upgradeable(package, self.file_pattern):
status = True
choices += [(package, repo_ver, status)]

View file

@ -29,7 +29,7 @@ class Upgrade(Configs, Utilities):
if inst_pkg_name not in black and inst_pkg_name in repo_packages:
if self.is_repo_version_bigger(inst_pkg_name, self.file_pattern):
if self.is_package_upgradeable(inst_pkg_name, self.file_pattern):
requires += Requires(inst_pkg_name).resolve()
upgrade.append(inst_pkg_name)

View file

@ -90,7 +90,7 @@ class Utilities:
time.strftime(f'[{self.cyan}%H:%M:%S{self.endc}]',
time.gmtime(elapsed_time)))
def is_repo_version_bigger(self, package: str, file_pattern: str) -> bool:
def is_package_upgradeable(self, package: str, file_pattern: str) -> bool:
""" Compare two versions. """
installed = self.is_installed(package, file_pattern)
if installed:

View file

@ -192,8 +192,8 @@ class ViewMessage(Configs):
install += 1
elif installed and self.utils.is_option(self.flag_reinstall, self.flags):
upgrade += 1
elif (installed and self.utils.is_repo_version_bigger(sbo, self.file_pattern) and
self.utils.is_option(self.flag_reinstall, self.flags)):
elif (installed and self.utils.is_package_upgradeable(sbo, self.file_pattern) and
self.utils.is_option(self.flag_reinstall, self.flags)):
upgrade += 1
elif installed and option == 'remove':
remove += 1