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,10 +146,11 @@ 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:
requires: list = self.data[package]['requires'] if self.view_missing_deps:
for req in requires: requires: list = self.data[package]['requires']
if req not in self.data: for req in requires:
self.package_requires.append(req) if req not in self.data:
self.package_requires.append(req)
self.require_length: int = max(len(name) for name in self.package_requires) self.require_length: int = max(len(name) for name in self.package_requires)
def view_summary_of_tracking(self, package: str) -> None: def view_summary_of_tracking(self, package: str) -> None:

View file

@ -334,17 +334,19 @@ 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.
""" """
missing_deps: dict = {} if self.view_missing_deps:
for package in packages: missing_deps: dict = {}
requires: list = self.data[package]['requires'] for package in packages:
for req in requires: requires: list = self.data[package]['requires']
if req not in self.data: for req in requires:
missing_deps[package] = [req for req in requires if req not in self.data] if req not in self.data:
if missing_deps: missing_deps[package] = [req for req in requires if req not in self.data]
print('\nPackages with missing dependencies:') if missing_deps:
for pkg, deps in missing_deps.items(): print('\nPackages with missing dependencies:')
print(f"> {self.cyan}{pkg}{self.endc}: Requires " for pkg, deps in missing_deps.items():
f"({len(deps)}) -> {self.red}{', '.join(deps)}{self.endc}") if deps and deps != ['']:
print(f"> {self.cyan}{pkg}{self.endc}: Requires "
f"({len(deps)}) -> {self.red}{', '.join(deps)}{self.endc}")
def question(self, message: str = 'Do you want to continue?') -> None: def question(self, message: str = 'Do you want to continue?') -> None:
""" View a question. """ View a question.