Fixed for compare packages

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-05-11 12:05:19 +03:00
parent a52e929f01
commit c2cdf84c43
2 changed files with 16 additions and 10 deletions

View file

@ -1,5 +1,10 @@
## slpkg - ChangeLog ## slpkg - ChangeLog
### 5.0.9 - 11/05/2024
- Bugfixes:
* Fixes the compare version with the upgrade command
### 5.0.8 - 10/05/2024 ### 5.0.8 - 10/05/2024
- Added: - Added:

View file

@ -123,18 +123,19 @@ class Upgrade(Configs): # pylint: disable=[R0902]
if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build): if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build):
return True return True
except InvalidVersion as err: except InvalidVersion as 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) 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
return False return False
def _write_log_file(self, installed: str, name: str, err: InvalidVersion) -> None: def _write_log_file(self, installed: str, name: str, err: InvalidVersion) -> None: