From 3b1ec35e6790b156035a42dff69f47af02842ff4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 11 May 2024 21:23:51 +0300 Subject: [PATCH] Added inform message Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 ++-- slpkg/upgrade.py | 14 ++++++-------- slpkg/views/views.py | 3 +++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 79942537..e8fa41cb 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,8 +2,8 @@ ### 5.0.9 - 11/05/2024 -- Bugfixes: - * Fixes the compare version with the upgrade command +- Added: + * Inform message for invalid package version with the upgrade command ### 5.0.8 - 10/05/2024 diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index b31d6c9c..764464ce 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -39,6 +39,8 @@ class Upgrade(Configs): # pylint: disable=[R0902] self.kernel_ver: str = platform.uname()[2] self.columns, self.rows = shutil.get_terminal_size() + self.check_run: bool = False + def load_installed_packages(self, repository: str) -> None: """Summary @@ -123,17 +125,11 @@ class Upgrade(Configs): # pylint: disable=[R0902] if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build): return True except InvalidVersion as err: - self._write_log_file(installed, inst_name, err) - # Different options to compare packages. - repo_package: str = self.data[inst_name]['package'] if repo_version > inst_version: # Try to compare the strings. return True if repo_version == inst_version and int(repo_build) > int(inst_build): return True - if installed != repo_package[:-4]: # Add the package if a new one on the repository. - return True - if installed == repo_package[:-4]: # Not new packages in the repository. - return False + self._write_log_file(installed, inst_name, err) return False @@ -149,11 +145,13 @@ class Upgrade(Configs): # pylint: disable=[R0902] with self.upgrade_log_file.open('a', encoding='utf-8') as log: log.write(f"Installed: {installed}, " f"Repository: {self.data[name]['package']}, " - f"Error: {err}\n") + f"Error: {err}, " + f"Repo: {self.repository}\n") def check_packages(self) -> None: """ Checks only which packages are upgradeable. """ + self.check_run: bool = True repo_data: dict = {} found_packages: dict = {} diff --git a/slpkg/views/views.py b/slpkg/views/views.py index ad8ec4e5..fd3979d9 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -105,6 +105,9 @@ class View(Configs): # pylint: disable=[R0902] self.set_summary_for_install_and_upgrade(self.sum_install, self.sum_upgrade, self.sum_size_comp, self.sum_size_uncomp) print(self.summary_message) + if mode == 'upgrade' and self.upgrade_log_file.is_file(): + print(f'{self.red}{self.ascii.failed} Some packages failed, ' + f'check the /var/log/slpkg/upgrade.log file.{self.endc}') def download_packages(self, packages: list, directory: Path) -> None: """ View packages for download method.