From c47870e706941afb292705da3f9c02baa84f4ea1 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 31 Mar 2024 20:06:17 +0300 Subject: [PATCH] Updated for ticked on/off #181 --- ChangeLog.txt | 1 + slpkg/binaries/install.py | 9 ++++++--- slpkg/sbos/slackbuild.py | 9 ++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index aed53273..f7fc2c07 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ - Updated: * Updated for coding style * Updated tomli import for -current version + * Updated for "ticked on/off" packages if they are already up-to-date #181 - Bugfixes: * Check for custom upgrade packages (Thanks to Marav) diff --git a/slpkg/binaries/install.py b/slpkg/binaries/install.py index 96655c73..b2349235 100644 --- a/slpkg/binaries/install.py +++ b/slpkg/binaries/install.py @@ -7,6 +7,7 @@ import json from pathlib import Path from collections import OrderedDict +from slpkg.upgrade import Upgrade from slpkg.configs import Configs from slpkg.checksum import Md5sum from slpkg.views.views import View @@ -35,6 +36,7 @@ class Packages(Configs): self.view = View(flags, repository, data) self.check_md5 = Md5sum(flags) self.download = Downloader(flags) + self.upgrade = Upgrade(repository, data) self.ascii = AsciiBox() self.gpg = GPGVerify() @@ -179,7 +181,7 @@ class Packages(Configs): def set_progress_message(self) -> None: if self.mode == 'upgrade' or self.option_for_reinstall: - self.progress_message: str = f'{self.cyan}Upgrading{self.endc}' + self.progress_message: str = f'{self.violet}Upgrading{self.endc}' def choose_package_dependencies(self) -> None: if self.dependencies and self.dialog: @@ -194,14 +196,15 @@ class Packages(Configs): repo_ver: str = self.data[package]['version'] help_text: str = f'Package: {package} {repo_ver}' installed: str = self.utils.is_package_installed(package) + upgradeable: bool = self.upgrade.is_package_upgradeable(installed) if installed: status: bool = False - if self.option_for_reinstall: + if self.mode == 'upgrade' and upgradeable: status: bool = True - if self.mode == 'upgrade': + if self.option_for_reinstall: status: bool = True choices.extend([(package, repo_ver, status, help_text)]) diff --git a/slpkg/sbos/slackbuild.py b/slpkg/sbos/slackbuild.py index b3abd24a..fdb4f721 100644 --- a/slpkg/sbos/slackbuild.py +++ b/slpkg/sbos/slackbuild.py @@ -9,6 +9,7 @@ import shutil from pathlib import Path from collections import OrderedDict +from slpkg.upgrade import Upgrade from slpkg.checksum import Md5sum from slpkg.configs import Configs from slpkg.views.views import View @@ -41,6 +42,7 @@ class Slackbuilds(Configs): self.view = View(flags, repository, data) self.check_md5 = Md5sum(flags) self.download = Downloader(flags) + self.upgrade = Upgrade(repository, data) self.gpg = GPGVerify() self.sources: dict = {} @@ -247,7 +249,7 @@ class Slackbuilds(Configs): def set_progress_message(self) -> None: if self.mode == 'upgrade' or self.option_for_reinstall: - self.progress_message: str = f'{self.cyan}Upgrading{self.endc}' + self.progress_message: str = f'{self.violet}Upgrading{self.endc}' def set_makeflags(self) -> None: os.environ['MAKEFLAGS'] = f'-j {self.makeflags}' @@ -266,14 +268,15 @@ class Slackbuilds(Configs): description: str = self.data[package]['description'] help_text: str = f'Description: {description}' installed: str = self.utils.is_package_installed(package) + upgradeable: bool = self.upgrade.is_package_upgradeable(installed) if installed: status: bool = False - if self.option_for_reinstall: + if self.mode == 'upgrade' and upgradeable: status: bool = True - if self.mode == 'upgrade': + if self.option_for_reinstall: status: bool = True choices.extend(