mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Updated for kernel version
This commit is contained in:
parent
55ed84b475
commit
9c7ff2172c
6 changed files with 21 additions and 4 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
- Added:
|
- Added:
|
||||||
* Added to support custom repositories
|
* Added to support custom repositories
|
||||||
|
* Added KERNEL_VERSION config to handle custom slackbuild version
|
||||||
|
|
||||||
### 5.0.5 - 12/04/2024
|
### 5.0.5 - 12/04/2024
|
||||||
- Added:
|
- Added:
|
||||||
|
|
|
@ -52,6 +52,12 @@ ASCII_CHARACTERS = true
|
||||||
# not work. Default is true. [true/false].
|
# not work. Default is true. [true/false].
|
||||||
ASK_QUESTION = true
|
ASK_QUESTION = true
|
||||||
|
|
||||||
|
# This config removes the kernel version from some slackbuilds custom
|
||||||
|
# version build, like nvidia-kernel and virtualbox-kernel slackbuild packages.
|
||||||
|
# It helps to compare install and repository versions.
|
||||||
|
# Default is true. [true/false].
|
||||||
|
KERNEL_VERSION = true
|
||||||
|
|
||||||
# Download sources in parallel. Default is false. [true/false]
|
# Download sources in parallel. Default is false. [true/false]
|
||||||
# Alternatively, you can use the option '--parallel'.
|
# Alternatively, you can use the option '--parallel'.
|
||||||
PARALLEL_DOWNLOADS = false
|
PARALLEL_DOWNLOADS = false
|
||||||
|
|
|
@ -81,6 +81,7 @@ class Configs:
|
||||||
os_arch: str = config['os_arch']
|
os_arch: str = config['os_arch']
|
||||||
download_only_path: Path = Path(config['download_only_path'])
|
download_only_path: Path = Path(config['download_only_path'])
|
||||||
ask_question: bool = config['ask_question']
|
ask_question: bool = config['ask_question']
|
||||||
|
kernel_version: str = config['kernel_version']
|
||||||
installpkg: str = config['installpkg']
|
installpkg: str = config['installpkg']
|
||||||
reinstall: str = config['reinstall']
|
reinstall: str = config['reinstall']
|
||||||
removepkg: str = config['removepkg']
|
removepkg: str = config['removepkg']
|
||||||
|
|
|
@ -38,7 +38,7 @@ class FormConfigs(Configs):
|
||||||
title: str = ' Configuration File '
|
title: str = ' Configuration File '
|
||||||
|
|
||||||
# Creating the elements for the dialog form.
|
# Creating the elements for the dialog form.
|
||||||
for i, (key, value) in enumerate(self.configs['CONFIGS'].items(), start=1):
|
for i, (key, value) in enumerate(self.configs['configs'].items(), start=1):
|
||||||
if value is True:
|
if value is True:
|
||||||
value: str = 'true'
|
value: str = 'true'
|
||||||
elif value is False:
|
elif value is False:
|
||||||
|
@ -76,6 +76,7 @@ class FormConfigs(Configs):
|
||||||
'SILENT_MODE',
|
'SILENT_MODE',
|
||||||
'ASCII_CHARACTERS',
|
'ASCII_CHARACTERS',
|
||||||
'ASK_QUESTION',
|
'ASK_QUESTION',
|
||||||
|
'KERNEL_VERSION',
|
||||||
'PARALLEL_DOWNLOADS',
|
'PARALLEL_DOWNLOADS',
|
||||||
'PROGRESS_BAR',
|
'PROGRESS_BAR',
|
||||||
'SPINNING_BAR',
|
'SPINNING_BAR',
|
||||||
|
@ -90,7 +91,7 @@ class FormConfigs(Configs):
|
||||||
]
|
]
|
||||||
values: list = ['true', 'false']
|
values: list = ['true', 'false']
|
||||||
|
|
||||||
for key, value in zip(self.configs['CONFIGS'].keys(), tags):
|
for key, value in zip(self.configs['configs'].keys(), tags):
|
||||||
|
|
||||||
if key in keys and value not in values:
|
if key in keys and value not in values:
|
||||||
self.dialogbox.msgbox(f"\nError: Value for '{key}', it must be 'true' or 'false.'\n",
|
self.dialogbox.msgbox(f"\nError: Value for '{key}', it must be 'true' or 'false.'\n",
|
||||||
|
@ -115,7 +116,7 @@ class FormConfigs(Configs):
|
||||||
|
|
||||||
with open(self.config_file, 'w') as patch_toml:
|
with open(self.config_file, 'w') as patch_toml:
|
||||||
for line in self.orig_configs:
|
for line in self.orig_configs:
|
||||||
for key, value in zip(self.configs['CONFIGS'].keys(), tags):
|
for key, value in zip(self.configs['configs'].keys(), tags):
|
||||||
|
|
||||||
if line.lstrip().startswith(f'{key} ='):
|
if line.lstrip().startswith(f'{key} ='):
|
||||||
line = f' {key} = "{value}"\n'
|
line = f' {key} = "{value}"\n'
|
||||||
|
@ -127,6 +128,7 @@ class FormConfigs(Configs):
|
||||||
'SILENT_MODE =',
|
'SILENT_MODE =',
|
||||||
'ASCII_CHARACTERS =',
|
'ASCII_CHARACTERS =',
|
||||||
'ASK_QUESTION =',
|
'ASK_QUESTION =',
|
||||||
|
'KERNEL_VERSION =',
|
||||||
'PARALLEL_DOWNLOADS =',
|
'PARALLEL_DOWNLOADS =',
|
||||||
'MAXIMUM_PARALLEL = ',
|
'MAXIMUM_PARALLEL = ',
|
||||||
'PROGRESS_BAR =',
|
'PROGRESS_BAR =',
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
import platform
|
||||||
|
from pathlib import Path
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
from packaging.version import parse, InvalidVersion
|
from packaging.version import parse, InvalidVersion
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
|
@ -31,6 +32,7 @@ class Upgrade(Configs):
|
||||||
self.installed_names: list = []
|
self.installed_names: list = []
|
||||||
self.installed_packages: list = []
|
self.installed_packages: list = []
|
||||||
|
|
||||||
|
self.kernel_ver: str = platform.uname()[2]
|
||||||
self.columns, self.rows = shutil.get_terminal_size()
|
self.columns, self.rows = shutil.get_terminal_size()
|
||||||
|
|
||||||
def load_installed_packages(self, repository: str) -> None:
|
def load_installed_packages(self, repository: str) -> None:
|
||||||
|
@ -89,7 +91,11 @@ class Upgrade(Configs):
|
||||||
if self.data.get(inst_name):
|
if self.data.get(inst_name):
|
||||||
repo_version: str = self.data[inst_name]['version']
|
repo_version: str = self.data[inst_name]['version']
|
||||||
repo_build: str = self.data[inst_name]['build']
|
repo_build: str = self.data[inst_name]['build']
|
||||||
|
|
||||||
inst_version: str = self.utils.split_package(installed)['version']
|
inst_version: str = self.utils.split_package(installed)['version']
|
||||||
|
if self.kernel_version and self.repository in [self.repos.sbo_repo_name, self.repos.ponce_repo_name]:
|
||||||
|
inst_version: str = inst_version.replace(f'_{self.kernel_ver}', '')
|
||||||
|
|
||||||
inst_build: str = self.utils.split_package(installed)['build']
|
inst_build: str = self.utils.split_package(installed)['build']
|
||||||
try:
|
try:
|
||||||
if parse(repo_version) > parse(inst_version):
|
if parse(repo_version) > parse(inst_version):
|
||||||
|
|
|
@ -42,6 +42,7 @@ class TestConfigs(unittest.TestCase):
|
||||||
self.assertEqual('-c mirror --parallel=100 --only-newer --delete', self.configs.lftp_mirror_options)
|
self.assertEqual('-c mirror --parallel=100 --only-newer --delete', self.configs.lftp_mirror_options)
|
||||||
self.assertEqual(True, self.configs.ascii_characters)
|
self.assertEqual(True, self.configs.ascii_characters)
|
||||||
self.assertEqual(True, self.configs.ask_question)
|
self.assertEqual(True, self.configs.ask_question)
|
||||||
|
self.assertEqual(True, self.configs.kernel_version)
|
||||||
self.assertEqual(False, self.configs.parallel_downloads)
|
self.assertEqual(False, self.configs.parallel_downloads)
|
||||||
self.assertEqual(5, self.configs.maximum_parallel)
|
self.assertEqual(5, self.configs.maximum_parallel)
|
||||||
self.assertEqual(True, self.configs.progress_bar)
|
self.assertEqual(True, self.configs.progress_bar)
|
||||||
|
|
Loading…
Reference in a new issue