Added config for missing

This commit is contained in:
Dimitris Zlatanidis 2024-05-10 23:19:08 +03:00
parent d1c2560782
commit 8c33df29af
5 changed files with 27 additions and 16 deletions

View file

@ -1,6 +1,6 @@
# This is the general configuration file of slpkg: # This is the general configuration file of slpkg:
# /etc/slpkg/slpkg.toml # /etc/slpkg/slpkg.toml
# Updated: 08/05/2024, Version: 5.0.8 # Updated: 10/05/2024, Version: 5.0.8
[CONFIGS] [CONFIGS]
@ -33,6 +33,10 @@ CHECKSUM_MD5 = true
# Default is true. [true/false] # Default is true. [true/false]
DIALOG = true DIALOG = true
# View missing dependencies as main packages from the repository.
# Default is true. [true/false]
VIEW_MISSING_DEPS = true
# Choose ascii printable characters. # Choose ascii printable characters.
# If true, it uses the extended characters, otherwise the basic ones. # If true, it uses the extended characters, otherwise the basic ones.
# Default is true. [true/false]. # Default is true. [true/false].

View file

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

View file

@ -82,6 +82,7 @@ class FormConfigs(Configs):
keys: list = [ keys: list = [
'COLORS', 'COLORS',
'DIALOG', 'DIALOG',
'VIEW_MISSING_DEPS',
'SILENT_MODE', 'SILENT_MODE',
'ASCII_CHARACTERS', 'ASCII_CHARACTERS',
'ASK_QUESTION', 'ASK_QUESTION',
@ -134,6 +135,7 @@ class FormConfigs(Configs):
('COLORS =', ('COLORS =',
'DIALOG =', 'DIALOG =',
'VIEW_MISSING_DEPS =',
'SILENT_MODE =', 'SILENT_MODE =',
'ASCII_CHARACTERS =', 'ASCII_CHARACTERS =',
'ASK_QUESTION =', 'ASK_QUESTION =',

View file

@ -146,6 +146,7 @@ class Tracking(Configs): # pylint: disable=[R0902]
self.package_requires: list = list(Requires(self.data, package, self.flags).resolve()) self.package_requires: list = list(Requires(self.data, package, self.flags).resolve())
if self.package_requires: if self.package_requires:
if self.view_missing_deps:
requires: list = self.data[package]['requires'] requires: list = self.data[package]['requires']
for req in requires: for req in requires:
if req not in self.data: if req not in self.data:

View file

@ -334,6 +334,7 @@ class View(Configs): # pylint: disable=[R0902]
def missing_dependencies(self, packages: list) -> None: def missing_dependencies(self, packages: list) -> None:
""" View for missing dependencies. """ View for missing dependencies.
""" """
if self.view_missing_deps:
missing_deps: dict = {} missing_deps: dict = {}
for package in packages: for package in packages:
requires: list = self.data[package]['requires'] requires: list = self.data[package]['requires']
@ -343,6 +344,7 @@ class View(Configs): # pylint: disable=[R0902]
if missing_deps: if missing_deps:
print('\nPackages with missing dependencies:') print('\nPackages with missing dependencies:')
for pkg, deps in missing_deps.items(): for pkg, deps in missing_deps.items():
if deps and deps != ['']:
print(f"> {self.cyan}{pkg}{self.endc}: Requires " print(f"> {self.cyan}{pkg}{self.endc}: Requires "
f"({len(deps)}) -> {self.red}{', '.join(deps)}{self.endc}") f"({len(deps)}) -> {self.red}{', '.join(deps)}{self.endc}")