mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Added option --no-silent
This commit is contained in:
parent
6f5a9b0e12
commit
1ac0994a62
8 changed files with 34 additions and 17 deletions
|
@ -2,6 +2,8 @@
|
|||
Updated:
|
||||
- Download first all the slackbuilds
|
||||
- Rename view_mode to silent_mode
|
||||
Added:
|
||||
- Option --no-silent
|
||||
|
||||
4.4.9 - 13/01/2023
|
||||
Updated:
|
||||
|
|
|
@ -87,6 +87,7 @@ Usage
|
|||
--skip-installed Skip installed packages.
|
||||
--full-reverse Full reverse dependency.
|
||||
--search Search packages from the repository.
|
||||
--no-silent Disable silent mode.
|
||||
|
||||
-h, --help Show this message and exit.
|
||||
-v, --version Print version and exit.
|
||||
|
|
|
@ -32,12 +32,12 @@ class Download:
|
|||
location = SBoQueries(sbo).location()
|
||||
url = f'{self.configs.sbo_repo_url}/{location}/{file}'
|
||||
|
||||
down_sbo = Downloader(self.configs.download_only, url)
|
||||
down_sbo = Downloader(self.configs.download_only, url, self.flags)
|
||||
down_sbo.download()
|
||||
|
||||
sources = SBoQueries(sbo).sources()
|
||||
for source in sources:
|
||||
down_source = Downloader(self.configs.download_only, source)
|
||||
down_source = Downloader(self.configs.download_only, source, self.flags)
|
||||
down_source.download()
|
||||
|
||||
elapsed_time = time.time() - start
|
||||
|
|
|
@ -13,9 +13,11 @@ from slpkg.progress_bar import ProgressBar
|
|||
class Downloader:
|
||||
""" Wget downloader. """
|
||||
|
||||
def __init__(self, path: Union[str, Path], url: str):
|
||||
def __init__(self, path: Union[str, Path], url: str, flags: list):
|
||||
self.path = path
|
||||
self.url = url
|
||||
self.flags = flags
|
||||
self.flag_no_silent = '--no-silent'
|
||||
self.filename = url.split('/')[-1]
|
||||
self.configs = Configs
|
||||
self.colors = self.configs.colour
|
||||
|
@ -50,7 +52,8 @@ class Downloader:
|
|||
|
||||
def download(self):
|
||||
""" Starting multiprocessing download process. """
|
||||
if self.configs.silent_mode:
|
||||
if self.configs.silent_mode and self.flag_no_silent not in self.flags:
|
||||
|
||||
done = f' {self.byellow} Done{self.endc}'
|
||||
self.stderr = subprocess.DEVNULL
|
||||
self.stdout = subprocess.DEVNULL
|
||||
|
|
|
@ -50,6 +50,7 @@ class Argparse:
|
|||
self.flag_skip_installed = '--skip-installed'
|
||||
self.flag_full_reverse = '--full-reverse'
|
||||
self.flag_search = '--search'
|
||||
self.flag_no_silent = '--no-silent'
|
||||
|
||||
self.is_dialog_enabled()
|
||||
|
||||
|
@ -59,7 +60,8 @@ class Argparse:
|
|||
self.flag_reinstall,
|
||||
self.flag_skip_installed,
|
||||
self.flag_full_reverse,
|
||||
self.flag_search]
|
||||
self.flag_search,
|
||||
self.flag_no_silent]
|
||||
|
||||
self.remove_flags()
|
||||
|
||||
|
@ -78,7 +80,7 @@ class Argparse:
|
|||
"in the '/etc/slpkg/' folder.\n")
|
||||
|
||||
def check_for_flags(self, command):
|
||||
""" Check for correct flag. """
|
||||
""" Check for correct flags. """
|
||||
|
||||
commands = {
|
||||
'--help': [],
|
||||
|
@ -88,7 +90,8 @@ class Argparse:
|
|||
self.flag_yes,
|
||||
self.flag_jobs,
|
||||
self.flag_resolve_off,
|
||||
self.flag_reinstall
|
||||
self.flag_reinstall,
|
||||
self.flag_no_silent
|
||||
],
|
||||
'check-updates': [],
|
||||
'configs': [],
|
||||
|
@ -98,7 +101,8 @@ class Argparse:
|
|||
self.flag_yes,
|
||||
self.flag_jobs,
|
||||
self.flag_resolve_off,
|
||||
self.flag_search
|
||||
self.flag_search,
|
||||
self.flag_no_silent
|
||||
],
|
||||
'install': [
|
||||
self.flag_yes,
|
||||
|
@ -106,16 +110,19 @@ class Argparse:
|
|||
self.flag_resolve_off,
|
||||
self.flag_reinstall,
|
||||
self.flag_skip_installed,
|
||||
self.flag_search
|
||||
self.flag_search,
|
||||
self.flag_no_silent
|
||||
],
|
||||
'download': [
|
||||
self.flag_yes,
|
||||
self.flag_search
|
||||
self.flag_search,
|
||||
self.flag_no_silent
|
||||
],
|
||||
'remove': [
|
||||
self.flag_yes,
|
||||
self.flag_resolve_off,
|
||||
self.flag_search
|
||||
self.flag_search,
|
||||
self.flag_no_silent
|
||||
],
|
||||
'find': [self.flag_search],
|
||||
'view': [self.flag_search],
|
||||
|
|
|
@ -34,6 +34,7 @@ class RemovePackages:
|
|||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.flag_resolve_off = '--resolve-off'
|
||||
self.flag_no_silent = '--no-silent'
|
||||
self.output = 0
|
||||
self.remove_pkg = None
|
||||
self.stderr = None
|
||||
|
@ -83,7 +84,8 @@ class RemovePackages:
|
|||
|
||||
def multi_process(self, command, package):
|
||||
""" Starting multiprocessing remove process. """
|
||||
if self.configs.silent_mode:
|
||||
if self.configs.silent_mode and self.flag_no_silent not in self.flags:
|
||||
|
||||
done = f' {self.byellow} Done{self.endc}'
|
||||
message = f'{self.red}Remove{self.endc}'
|
||||
self.stderr = subprocess.DEVNULL
|
||||
|
|
|
@ -55,6 +55,7 @@ class Slackbuilds:
|
|||
self.flag_skip_installed = '--skip-installed'
|
||||
self.flag_resolve_off = '--resolve-off'
|
||||
self.flag_jobs = '--jobs'
|
||||
self.flag_no_silent = '--no-silent'
|
||||
|
||||
def execute(self):
|
||||
""" Starting build or install the slackbuilds. """
|
||||
|
@ -138,7 +139,7 @@ class Slackbuilds:
|
|||
location = SBoQueries(sbo).location()
|
||||
url = f'{self.configs.sbo_repo_url}/{location}/{file}'
|
||||
|
||||
down_sbo = Downloader(self.configs.tmp_slpkg, url)
|
||||
down_sbo = Downloader(self.configs.tmp_slpkg, url, self.flags)
|
||||
down_sbo.download()
|
||||
|
||||
self.utils.untar_archive(self.configs.tmp_slpkg, file, self.configs.build_path)
|
||||
|
@ -262,7 +263,7 @@ class Slackbuilds:
|
|||
checksums = SBoQueries(name).checksum()
|
||||
|
||||
for source, checksum in zip(sources, checksums):
|
||||
down_source = Downloader(path, source)
|
||||
down_source = Downloader(path, source, self.flags)
|
||||
down_source.download()
|
||||
|
||||
md5sum = Md5sum(self.flags)
|
||||
|
@ -270,7 +271,8 @@ class Slackbuilds:
|
|||
|
||||
def multi_process(self, command, filename, message):
|
||||
""" Starting multiprocessing install/upgrade process. """
|
||||
if self.configs.silent_mode:
|
||||
if self.configs.silent_mode and self.flag_no_silent not in self.flags:
|
||||
|
||||
done = f' {self.byellow} Done{self.endc}'
|
||||
self.stderr = subprocess.DEVNULL
|
||||
self.stdout = subprocess.DEVNULL
|
||||
|
|
|
@ -26,7 +26,7 @@ class Usage:
|
|||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-f, find, -w, view, -s, search, -e, dependees] <packages>\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-t, tracking] <packages>\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search, --no-silent]\n'
|
||||
" \nIf you need more information please try 'slpkg --help'.")
|
||||
|
||||
print(args)
|
||||
|
@ -62,6 +62,7 @@ class Usage:
|
|||
f' {self.yellow}--skip-installed{self.endc} Skip installed packages.\n'
|
||||
f' {self.yellow}--full-reverse{self.endc} Full reverse dependency.\n'
|
||||
f' {self.yellow}--search{self.endc} Search packages from the repository.\n'
|
||||
f' {self.yellow}--no-silent{self.endc} Disable silent mode.\n'
|
||||
'\n -h, --help Show this message and exit.\n'
|
||||
' -v, --version Print version and exit.\n'
|
||||
'\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n'
|
||||
|
@ -81,4 +82,3 @@ class Usage:
|
|||
f"please use: \n{self.yellow}'{', '.join(flags)}'{self.endc}")
|
||||
|
||||
raise SystemExit(f"{self.red}Error:{self.endc} Got an unexpected extra option.")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue