diff --git a/ChangeLog.txt b/ChangeLog.txt index 41428279..299e013b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,15 +1,15 @@ ## slpkg - ChangeLog -### 5.1.0 - 04/06/2024 +### 5.1.0 - 06/06/2024 - Added: * Added PACKAGE_METHOD config to choose the upgrade method + * Added DOWNGRADE_PACKAGES config to allow to downgrade packages (Thanks to marav) - Updated: * Updated message for invalid package version * Updated upgrade.log file to json format * Separation of the process bar with progress bar - * Updated to check downgrade packages (Thanks to marav) ### 5.0.9 - 23/05/2024 diff --git a/configs/slpkg.toml b/configs/slpkg.toml index b93f7043..0c73689c 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -1,6 +1,6 @@ # This is the general configuration file of slpkg: # /etc/slpkg/slpkg.toml -# Updated: 01/06/2024, Version: 5.1.0 +# Updated: 06/06/2024, Version: 5.1.0 [CONFIGS] @@ -48,6 +48,11 @@ VIEW_MISSING_DEPS = true # is newer than the repository package. Default is false. [true/false] PACKAGE_METHOD = false +# This setting allows you to downgrade packages. +# It works if the package method it is false. +# Default is false. [true/false] +DOWNGRADE_PACKAGES = false + # Delete downloaded sources after build or install packages. # Default is false. [true/false] DELETE_SOURCES = false diff --git a/slpkg/configs.py b/slpkg/configs.py index 804b1c81..ee0b06ad 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -47,6 +47,7 @@ class Configs: # pylint: disable=[R0902] dialog: bool = True view_missing_deps: bool = True package_method: bool = False + downgrade_packages: bool = False delete_sources: bool = False downloader: str = 'wget' wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress' @@ -96,6 +97,7 @@ class Configs: # pylint: disable=[R0902] dialog: bool = config['dialog'] view_missing_deps: bool = config['view_missing_deps'] package_method: bool = config['package_method'] + downgrade_packages: bool = config['downgrade_packages'] delete_sources: bool = config['delete_sources'] downloader: str = config['downloader'] wget_options: str = config['wget_options'] diff --git a/slpkg/dialog_configs.py b/slpkg/dialog_configs.py index 98b0b13c..72768dbe 100644 --- a/slpkg/dialog_configs.py +++ b/slpkg/dialog_configs.py @@ -33,7 +33,7 @@ class FormConfigs(Configs): """Read and write the configuration file.""" self.is_dialog_enabled() elements: list = [] - height: int = 7 + height: int = 0 width: int = 0 form_height: int = 0 text: str = f'Edit the configuration file: {self.config_file}' @@ -77,6 +77,7 @@ class FormConfigs(Configs): 'DIALOG', 'VIEW_MISSING_DEPS', 'PACKAGE_METHOD', + 'DOWNGRADE_PACKAGES', 'DELETE_SOURCES', 'SILENT_MODE', 'ASCII_CHARACTERS', @@ -130,6 +131,7 @@ class FormConfigs(Configs): 'DIALOG =', 'VIEW_MISSING_DEPS =', 'PACKAGE_METHOD =', + 'DOWNGRADE_PACKAGES =', 'DELETE_SOURCES =', 'SILENT_MODE =', 'ASCII_CHARACTERS =', diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index 7983acfd..1925a8e6 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -129,7 +129,7 @@ class Upgrade(Configs): # pylint: disable=[R0902] if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build): return True - if parse(repo_version) < parse(inst_version): + if self.downgrade_packages and (parse(repo_version) < parse(inst_version)): return True except InvalidVersion as err: if repo_version > inst_version: # Try to compare the strings. diff --git a/tests/test_configs.py b/tests/test_configs.py index 3a3855f5..72d10f33 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -38,6 +38,7 @@ class TestConfigs(unittest.TestCase): self.assertEqual(True, self.configs.dialog) self.assertEqual(True, self.configs.view_missing_deps) self.assertEqual(False, self.configs.package_method) + self.assertEqual(False, self.configs.downgrade_packages) self.assertEqual(False, self.configs.delete_sources) self.assertEqual('wget', self.configs.downloader) self.assertEqual('-c -q --progress=bar:force:noscroll --show-progress', self.configs.wget_options)