mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Fix for invalid compare versions
This commit is contained in:
parent
e0b835de12
commit
b15137098b
2 changed files with 12 additions and 13 deletions
|
@ -1,6 +1,6 @@
|
|||
## slpkg - ChangeLog
|
||||
|
||||
### 5.0.4 - 02/04/2024
|
||||
### 5.0.4 - 03/04/2024
|
||||
- Updated:
|
||||
* Updated to ignore blacklist installed packages
|
||||
* Updated progress bar spinners
|
||||
|
@ -8,6 +8,9 @@
|
|||
- Removed:
|
||||
* python3-progress dependency
|
||||
|
||||
- Bugfixes:
|
||||
* Fixed compare invalid packages version
|
||||
|
||||
### 5.0.3 - 01/04/2024
|
||||
- Updated:
|
||||
* Updated for slpkg_new-configs and (D)iff command (Thanks to Marav)
|
||||
|
|
|
@ -63,15 +63,6 @@ class Upgrade(Configs):
|
|||
if name not in self.installed_names:
|
||||
yield name
|
||||
|
||||
# def is_package_upgradeable(self, installed: str) -> bool:
|
||||
# """ Returns True for upgradeable packages. """
|
||||
# name: str = self.utils.split_package(installed)['name']
|
||||
# if self.data.get(name):
|
||||
# repo_package: str = self.data[name]['package']
|
||||
#
|
||||
# if installed != repo_package[:-4]:
|
||||
# return True
|
||||
|
||||
def is_package_upgradeable(self, installed: str) -> bool:
|
||||
""" Returns True for upgradeable packages. """
|
||||
inst_name: str = self.utils.split_package(installed)['name']
|
||||
|
@ -87,13 +78,18 @@ class Upgrade(Configs):
|
|||
if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build):
|
||||
return True
|
||||
except InvalidVersion as err:
|
||||
# Different options to compare packages.
|
||||
repo_package: str = self.data[inst_name]['package']
|
||||
if installed != repo_package[:-4]:
|
||||
if repo_version > inst_version: # Try to compare the strings.
|
||||
return True
|
||||
elif installed == repo_package[:-4]:
|
||||
elif repo_version == inst_version and int(repo_build) > int(inst_build):
|
||||
return True
|
||||
elif installed != repo_package[:-4]: # Add the package if a new one on the repository.
|
||||
return True
|
||||
elif installed == repo_package[:-4]: # Not new packages in the repository.
|
||||
return False
|
||||
self._write_log_file(installed, inst_name, err)
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def _write_log_file(self, installed: str, name: str, err: InvalidVersion) -> None:
|
||||
|
|
Loading…
Reference in a new issue