Added inform message

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-05-11 21:23:51 +03:00
parent a9ed89901e
commit 3b1ec35e67
3 changed files with 11 additions and 10 deletions

View file

@ -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

View file

@ -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 = {}

View file

@ -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.