Moved configs

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-05-08 18:33:02 +03:00
parent 6c06230491
commit 1b3bcf96ba
8 changed files with 27 additions and 29 deletions

View file

@ -1,5 +1,10 @@
## slpkg - ChangeLog
### 5.0.8 - 08/05/2024
- Updated:
* Moved configs NEW_PACKAGES and REMOVE_PACKAGES to the repositories.toml file
### 5.0.7 - 07/05/2024
- Fixed:

View file

@ -1,6 +1,6 @@
# This is the general repositories configuration file of slpkg:
# /etc/slpkg/repositories.toml
# Updated: 01/05/2024, Version: 5.0.7
# Updated: 08/05/2024, Version: 5.0.8
# Set 'true' or 'false' to enable or disable the repository you want.
# You can use a mirror not included in this file.
@ -28,11 +28,21 @@
# https://repo.greeklug.gr/data/pub/linux/salix/x86_64/slackware-15.0/extra/
# https://repo.greeklug.gr/data/pub/linux/salix/x86_64/slackware-15.0/patches/
[DEFAULT]
# This is the DEFAULT REPOSITORY.
# You can change it with one that you see below.
# Make sure you have enabled it before.
[DEFAULT]
REPO = "sbo"
REPOSITORY = "sbo"
[NEW_PACKAGES]
# Configure the repositories that you want new packages to be added
# when upgrading installed packages. Example ["slack", "gnome"].
REPOSITORIES = []
[REMOVE_PACKAGES]
# Configure the repositories that you want to remove installed packages
# that no longer exist in the repository. Example ["slack", "gnome"].
REPOSITORIES = []
[SBO]
ENABLE = true

View file

@ -1,6 +1,6 @@
# This is the general configuration file of slpkg:
# /etc/slpkg/slpkg.toml
# Updated: 15/04/2024, Version: 5.0.6
# Updated: 08/05/2024, Version: 5.0.8
[CONFIGS]
@ -33,16 +33,6 @@ CHECKSUM_MD5 = true
# Default is true. [true/false]
DIALOG = true
# This config is ONLY for -current users and slack repository,
# using with the upgrade command. Adds new packages to install
# added by Patrick. Default is false. [true/false]
NEW_PACKAGES = false
# This config is also ONLY for -current users and slack repository,
# using with the upgrade command. Removes packages that no longer exist
# in the repository. Default is false. [true/false]
REMOVED_PACKAGES = false
# Choose ascii printable characters.
# If true, it uses the extended characters, otherwise the basic ones.
# Default is true. [true/false].

View file

@ -44,8 +44,6 @@ class Configs: # pylint: disable=[R0902]
gpg_verification: bool = False
checksum_md5: bool = True
dialog: bool = True
new_packages: bool = False
removed_packages: bool = False
downloader: str = 'wget'
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
curl_options: str = ''
@ -91,8 +89,6 @@ class Configs: # pylint: disable=[R0902]
gpg_verification: bool = config['gpg_verification']
checksum_md5: bool = config['checksum_md5']
dialog: bool = config['dialog']
new_packages: bool = config['new_packages']
removed_packages: bool = config['removed_packages']
downloader: str = config['downloader']
wget_options: str = config['wget_options']
curl_options: str = config['curl_options']

View file

@ -94,9 +94,7 @@ class FormConfigs(Configs):
'URLLIB_RETRIES',
'URLLIB_REDIRECT',
'GPG_VERIFICATION',
'CHECKSUM_MD5',
'NEW_PACKAGES',
'REMOVED_PACKAGES'
'CHECKSUM_MD5'
]
values: list = ['true', 'false']
@ -150,9 +148,7 @@ class FormConfigs(Configs):
'URLLIB_REDIRECT =',
'URLLIB_TIMEOUT =',
'GPG_VERIFICATION =',
'CHECKSUM_MD5 =',
'NEW_PACKAGES =',
'REMOVED_PACKAGES =')
'CHECKSUM_MD5 =')
):
line: str = line.replace('"', '')

View file

@ -171,7 +171,10 @@ class Repositories: # pylint: disable=[R0902]
repos_config = utils.convert_dict_keys_to_lower(repos_config)
default_repository: str = repos_config['default']['repo'].lower()
default_repository: str = repos_config['default']['repository'].lower()
new_packages = repos_config['new_packages']['repositories']
remove_packages = repos_config['remove_packages']['repositories']
sbo_repo: bool = repos_config['sbo']['enable']
sbo_repo_mirror: str = repos_config['sbo']['mirror']

View file

@ -85,11 +85,11 @@ class Upgrade(Configs): # pylint: disable=[R0902]
if self.is_package_upgradeable(inst.name):
yield name
if self.removed_packages:
if self.repository in self.repos.remove_packages:
if name not in self.data.keys():
yield name + '_Removed.'
if self.new_packages:
if self.repository in self.repos.new_packages:
for name in self.data.keys():
# if not self.utils.is_package_installed(name):
if name not in self.installed_names:

View file

@ -38,8 +38,6 @@ class TestConfigs(unittest.TestCase):
self.assertEqual(False, self.configs.gpg_verification)
self.assertEqual(True, self.configs.checksum_md5)
self.assertEqual(True, self.configs.dialog)
self.assertEqual(False, self.configs.new_packages)
self.assertEqual(False, self.configs.removed_packages)
self.assertEqual('wget', self.configs.downloader)
self.assertEqual('-c -q --progress=bar:force:noscroll --show-progress', self.configs.wget_options)
self.assertEqual('', self.configs.curl_options)