From b46cfce4929980269bd65bf615d0ce3f924d7836 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 21:42:11 +0200 Subject: [PATCH 01/17] Updated for code --- slpkg/slackbuild.py | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 3ee33732..8fdb76fe 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -103,36 +103,6 @@ class Slackbuilds: self.install_order.extend(self.dependencies) - def choose_dependencies(self, dependencies: list): - """ Choose packages for install. """ - height = 10 - width = 70 - list_height = 0 - choices = [] - title = ' Choose dependencies you want to install ' - - for package in dependencies: - status = True - repo_ver = SBoQueries(package).version() - installed = self.utils.is_installed(package) - - if installed: - status = False - - choices += [(package, repo_ver, status)] - - text = f'There are {len(choices)} dependencies:' - - code, tags = self.dialog.checklist(text, title, height, width, - list_height, choices, dependencies) - - if not code: - return dependencies - - os.system('clear') - - return tags - def creating_main_for_build(self): """ List with the main slackbuilds. """ [self.install_order.append(main) for main in self.sbos.keys() if main not in self.install_order] @@ -336,3 +306,33 @@ class Slackbuilds: """ Stop the process and print the error message. """ if self.output != 0: raise SystemExit(f"\n{self.red}FAILED {self.output}:{self.endc} {self.process_message}.\n") + + def choose_dependencies(self, dependencies: list): + """ Choose packages for install. """ + height = 10 + width = 70 + list_height = 0 + choices = [] + title = ' Choose dependencies you want to install ' + + for package in dependencies: + status = True + repo_ver = SBoQueries(package).version() + installed = self.utils.is_installed(package) + + if installed: + status = False + + choices += [(package, repo_ver, status)] + + text = f'There are {len(choices)} dependencies:' + + code, tags = self.dialog.checklist(text, title, height, width, + list_height, choices, dependencies) + + if not code: + return dependencies + + os.system('clear') + + return tags From 7d156e7a2a2618f10eee1e4c60e90554b290abfb Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 21:59:27 +0200 Subject: [PATCH 02/17] Updated for blacklist --- slpkg/utilities.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index a4f5173f..b2412631 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -39,9 +39,13 @@ class Utilities: def all_installed(self): """ Return all installed SBo packages from /val/log/packages folder. """ + installed = [] pattern = f'*{self.configs.sbo_repo_tag}' var_log_packages = Path(self.configs.log_packages) - installed = [file.name for file in var_log_packages.glob(pattern)] + + for file in var_log_packages.glob(pattern): + if self.split_installed_pkg(file.name) not in self.black.get(): + installed.append(file.name) return installed From 2f2aad3c5cc3893637f8073c63acd687ee05f35d Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:08:01 +0200 Subject: [PATCH 03/17] Updated for self method --- slpkg/utilities.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index b2412631..803e1072 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -25,16 +25,14 @@ class Utilities: def is_installed(self, name: str) -> str: """ Returns the installed package name. """ - pattern = f'*{self.configs.sbo_repo_tag}' + installed = self.all_installed() - var_log_packages = Path(self.configs.log_packages) - packages = [file.name for file in var_log_packages.glob(pattern)] - - for package in packages: + for package in installed: pkg = self.split_installed_pkg(package)[0] - if pkg == name and pkg not in self.black.get(): + if pkg == name: return package + return '' def all_installed(self): From 0ebbf650c22ce568559c566c40903351cec84db9 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:10:19 +0200 Subject: [PATCH 04/17] Updated for typing --- slpkg/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 803e1072..b9451c6b 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -92,7 +92,7 @@ class Utilities: time.strftime(f'[{self.cyan}%H:%M:%S{self.endc}]', time.gmtime(elapsed_time))) - def is_repo_version_bigger(self, package): + def is_repo_version_bigger(self, package: str) -> bool: """ Compare two versions. """ installed = self.is_installed(package) if installed: From 4408aaa719b241dfe149ba754cd875c89fb44c9e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:11:03 +0200 Subject: [PATCH 05/17] Updated for typing --- slpkg/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/utilities.py b/slpkg/utilities.py index b9451c6b..838f3023 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -35,7 +35,7 @@ class Utilities: return '' - def all_installed(self): + def all_installed(self) -> list: """ Return all installed SBo packages from /val/log/packages folder. """ installed = [] pattern = f'*{self.configs.sbo_repo_tag}' From f3c55e127cb6491069354397789b613df025ed4d Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:13:42 +0200 Subject: [PATCH 06/17] Updated code style --- slpkg/slackbuild.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 8fdb76fe..f72be4ba 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -29,9 +29,17 @@ class Slackbuilds: self.slackbuilds = slackbuilds self.flags = flags self.mode = mode + self.install_order = [] + self.dependencies = [] + self.sbos = {} + self.output = 0 + self.stderr = None + self.stdout = None + self.process_message = None self.session = Session self.utils = Utilities() self.dialog = DialogBox() + self.progress = ProgressBar() self.view_message = ViewMessage(self.flags) self.configs = Configs self.colors = self.configs.colour @@ -43,18 +51,10 @@ class Slackbuilds: self.endc = self.color['endc'] self.byellow = f'{self.bold}{self.yellow}' self.bred = f'{self.bold}{self.red}' - self.install_order = [] - self.dependencies = [] - self.sbos = {} - self.progress = ProgressBar() self.flag_reinstall = '--reinstall' self.flag_skip_installed = '--skip-installed' self.flag_resolve_off = '--resolve-off' self.flag_jobs = '--jobs' - self.process_message = None - self.output = 0 - self.stderr = None - self.stdout = None def execute(self): """ Starting build or install the slackbuilds. """ From 0df7dcda11035fb85ea0f431e84827b3825f1035 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:34:14 +0200 Subject: [PATCH 07/17] Updated for wget options --- configs/slpkg.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configs/slpkg.toml b/configs/slpkg.toml index cf2966dc..0b3b85ef 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -53,9 +53,11 @@ # Wget downloader options. # -c, --continue: resume getting a partially-downloaded file. - # -N, --timestamping: don't re-retrieve files unless newer + # -N, --timestamping: don't re-retrieve files unless newer. + # -q, Turn off Wget's output. + # --show-progress, Force wget to display the progress bar in any verbosity. # than local. - wget_options = "-c -N" + wget_options = "-c -N -q --show-progress" # This effect how you see the download and # how the packages build and install. From 1a4cb17f2a65da0cc7853c9a826608e95cfe721d Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:35:05 +0200 Subject: [PATCH 08/17] Updated for wget options --- slpkg/configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/configs.py b/slpkg/configs.py index e27d9f1f..2d746911 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -66,7 +66,7 @@ class Configs: dialog: str = True # Wget options - wget_options = '-c -N' + wget_options = '-c -N -q --show-progress' # Choose the view mode view_mode: str = 'new' From ad35eaf128453cb40d6cc420b43a18c29a14fdbe Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 22:46:35 +0200 Subject: [PATCH 09/17] Updated for way to install --- ChangeLog.txt | 4 ++++ slpkg/slackbuild.py | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 480bff4b..594d116d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.5.0 - 14/01/2023 +Updated: +- Download first all the slackbuilds + 4.4.9 - 13/01/2023 Updated: - Color highlight for installed packages diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index f72be4ba..7ca13065 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -68,7 +68,8 @@ class Slackbuilds: self.view_before_build() start = time.time() - self.download_slackbuilds_and_build() + self.download_slackbuilds() + self.build_and_install() elapsed_time = time.time() - start self.utils.finished_time(elapsed_time) @@ -118,8 +119,8 @@ class Slackbuilds: self.view_message.question() - def download_slackbuilds_and_build(self): - """ Downloads files and sources and starting the build. """ + def download_slackbuilds(self): + """ Downloads files and sources. """ for sbo in self.install_order: package = self.utils.is_installed(sbo) @@ -145,6 +146,15 @@ class Slackbuilds: sources = SBoQueries(sbo).sources() self.download_sources(sbo, sources) + def build_and_install(self): + """ Build the slackbuilds and install. """ + for sbo in self.install_order: + + package = self.utils.is_installed(sbo) + + if (not package or self.utils.is_repo_version_bigger(sbo) or + self.mode == 'build' or self.flag_reinstall in self.flags): + self.build_the_script(self.configs.build_path, sbo) if not self.mode == 'build': From e2a64852ab907a5e7e266a03f4eea04238f81ebe Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 14 Jan 2023 23:10:39 +0200 Subject: [PATCH 10/17] Merge condition --- slpkg/slackbuild.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 7ca13065..4fe08e68 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -119,14 +119,16 @@ class Slackbuilds: self.view_message.question() + def is_for_skipped(self, sbo): + """ Condition to check if slackbuild is for skipped. """ + return (not self.utils.is_installed(sbo) or self.utils.is_repo_version_bigger(sbo) or + self.mode == 'build' or self.flag_reinstall in self.flags) + def download_slackbuilds(self): """ Downloads files and sources. """ for sbo in self.install_order: - package = self.utils.is_installed(sbo) - - if (not package or self.utils.is_repo_version_bigger(sbo) or - self.mode == 'build' or self.flag_reinstall in self.flags): + if self.is_for_skipped(sbo): file = f'{sbo}{self.configs.sbo_tar_suffix}' @@ -150,10 +152,7 @@ class Slackbuilds: """ Build the slackbuilds and install. """ for sbo in self.install_order: - package = self.utils.is_installed(sbo) - - if (not package or self.utils.is_repo_version_bigger(sbo) or - self.mode == 'build' or self.flag_reinstall in self.flags): + if self.is_for_skipped(sbo): self.build_the_script(self.configs.build_path, sbo) @@ -165,6 +164,7 @@ class Slackbuilds: if self.flag_resolve_off not in self.flags: self.logging_installed_dependencies(sbo) else: + package = self.utils.is_installed(sbo) version = self.utils.split_installed_pkg(package)[1] self.view_message.view_skipping_packages(sbo, version) From b87862c5ea9e6d3380e3de6c3fc9fb3b5fdef150 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 15 Jan 2023 10:09:04 +0200 Subject: [PATCH 11/17] Fixed ValueError: max() arg is an empty sequence --- slpkg/slackbuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 4fe08e68..ecc41ce5 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -226,7 +226,7 @@ class Slackbuilds: installation. """ version = SBoQueries(name).version() - pattern = f'{name}-{version}-*{self.configs.sbo_repo_tag}*' + pattern = f'{name}-{version}*{self.configs.sbo_repo_tag}*' tmp = Path(self.configs.tmp_path) packages = [file.name for file in tmp.glob(pattern)] From a4fe0f7938ebafafc5989bee7b880c9bfb80706e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 15 Jan 2023 12:29:30 +0200 Subject: [PATCH 12/17] Renamed to silent_mode --- ChangeLog.txt | 1 + configs/slpkg.toml | 4 ++-- slpkg/configs.py | 4 ++-- slpkg/downloader.py | 2 +- slpkg/form_configs.py | 2 +- slpkg/remove_packages.py | 2 +- slpkg/slackbuild.py | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 594d116d..adcdb52e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,7 @@ 4.5.0 - 14/01/2023 Updated: - Download first all the slackbuilds +- Rename view_mode to silent_mode 4.4.9 - 13/01/2023 Updated: diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 0b3b85ef..fb966c1a 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -61,5 +61,5 @@ # This effect how you see the download and # how the packages build and install. - # Choose the view mode. Default is new. [new/old] - view_mode = "new" \ No newline at end of file + # Choose the view mode. Default is new. [true/false] + silent_mode = true \ No newline at end of file diff --git a/slpkg/configs.py b/slpkg/configs.py index 2d746911..5918ab9e 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -69,7 +69,7 @@ class Configs: wget_options = '-c -N -q --show-progress' # Choose the view mode - view_mode: str = 'new' + silent_mode: str = True load = LoadConfigs() configs = load.file(etc_path, prog_name) @@ -111,7 +111,7 @@ class Configs: wget_options: str = config['wget_options'] # Choose the view mode - view_mode: str = config['view_mode'] + silent_mode: str = config['silent_mode'] except KeyError as error: raise SystemExit(f"\nKeyError: {error}: in the configuration file " "'/etc/slpkg/slpkg.toml'\n") diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 31445b3f..b9c8c5c9 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -50,7 +50,7 @@ class Downloader: def download(self): """ Starting multiprocessing download process. """ - if self.configs.view_mode == 'new': + if self.configs.silent_mode: done = f' {self.byellow} Done{self.endc}' self.stderr = subprocess.DEVNULL self.stdout = subprocess.DEVNULL diff --git a/slpkg/form_configs.py b/slpkg/form_configs.py index 07b40210..39ddd273 100644 --- a/slpkg/form_configs.py +++ b/slpkg/form_configs.py @@ -83,6 +83,6 @@ class FormConfigs: for key, value in zip(configs['configs'].keys(), tags): if line.lstrip().startswith(key): line = f' {key} = "{value}"\n' - if line.lstrip().startswith(('colors =', 'dialog =')): + if line.lstrip().startswith(('colors =', 'dialog =', 'silent_mode =')): line = line.replace('"', '') patch_toml.write(line) diff --git a/slpkg/remove_packages.py b/slpkg/remove_packages.py index 84c8d277..ea363a27 100644 --- a/slpkg/remove_packages.py +++ b/slpkg/remove_packages.py @@ -83,7 +83,7 @@ class RemovePackages: def multi_process(self, command, package): """ Starting multiprocessing remove process. """ - if self.configs.view_mode == 'new': + if self.configs.silent_mode: done = f' {self.byellow} Done{self.endc}' message = f'{self.red}Remove{self.endc}' self.stderr = subprocess.DEVNULL diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index ecc41ce5..58e74f9c 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -270,7 +270,7 @@ class Slackbuilds: def multi_process(self, command, filename, message): """ Starting multiprocessing install/upgrade process. """ - if self.configs.view_mode == 'new': + if self.configs.silent_mode: done = f' {self.byellow} Done{self.endc}' self.stderr = subprocess.DEVNULL self.stdout = subprocess.DEVNULL From 6f5a9b0e123903c0ad717b1cdeb00f9c852f5605 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 15 Jan 2023 12:31:06 +0200 Subject: [PATCH 13/17] Fixed about configs --- slpkg/form_configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/form_configs.py b/slpkg/form_configs.py index 39ddd273..467d3519 100644 --- a/slpkg/form_configs.py +++ b/slpkg/form_configs.py @@ -65,7 +65,7 @@ class FormConfigs: def check_configs(self, configs: dict, tags: list) -> bool: """ Check for true of false values. """ for key, value in zip(configs['configs'].keys(), tags): - if key in ['colors', 'dialog'] and value not in ['true', 'false']: + if key in ['colors', 'dialog', 'silent_mode'] and value not in ['true', 'false']: self.dialog.msgbox(f"\nError value for {key}. It must be 'true' or 'false'\n", height=7, width=60) return False return True From 1ac0994a622aa67059d57467c75552604e230918 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 15 Jan 2023 17:54:09 +0200 Subject: [PATCH 14/17] Added option --no-silent --- ChangeLog.txt | 2 ++ README.rst | 1 + slpkg/download_only.py | 4 ++-- slpkg/downloader.py | 7 +++++-- slpkg/main.py | 21 ++++++++++++++------- slpkg/remove_packages.py | 4 +++- slpkg/slackbuild.py | 8 +++++--- slpkg/views/cli_menu.py | 4 ++-- 8 files changed, 34 insertions(+), 17 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index adcdb52e..7a4ccbf7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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: diff --git a/README.rst b/README.rst index 092c87f4..178c985c 100644 --- a/README.rst +++ b/README.rst @@ -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. diff --git a/slpkg/download_only.py b/slpkg/download_only.py index 15740d29..eaee19ab 100644 --- a/slpkg/download_only.py +++ b/slpkg/download_only.py @@ -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 diff --git a/slpkg/downloader.py b/slpkg/downloader.py index b9c8c5c9..7b96d6c2 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -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 diff --git a/slpkg/main.py b/slpkg/main.py index 22794584..16364fa6 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -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], diff --git a/slpkg/remove_packages.py b/slpkg/remove_packages.py index ea363a27..0e60c8b6 100644 --- a/slpkg/remove_packages.py +++ b/slpkg/remove_packages.py @@ -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 diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 58e74f9c..675ce287 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -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 diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 13fe06d6..ba5ffdf6 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -26,7 +26,7 @@ class Usage: f' slpkg [{self.cyan}COMMAND{self.endc}] [-f, find, -w, view, -s, search, -e, dependees] \n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-t, tracking] \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.") - From 125124f7f97c5a326ecdff3e47f7c3cf7b99d616 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 15 Jan 2023 18:09:20 +0200 Subject: [PATCH 15/17] Updated for no silent mode --- man/slpkg-fr.1 | 19 ++++++++++++------- man/slpkg.1 | 19 ++++++++++++------- slpkg/main.py | 5 ++++- slpkg/update_repository.py | 4 ++-- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/man/slpkg-fr.1 b/man/slpkg-fr.1 index 48993aa7..cbd8c2de 100644 --- a/man/slpkg-fr.1 +++ b/man/slpkg-fr.1 @@ -1,4 +1,4 @@ -.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.4.7" dslackw +.TH slpkg 1 "Orestiada, Grèce" "slpkg 4.5.0" dslackw .SH NOM .P .B slpkg - [OPTIONS] [COMMANDE] . @@ -17,12 +17,12 @@ Il calcule automatiquement \fBles dépendances\fP et détermine comment doit se Il utilise également les instructions de \fBSlackware Linux\fP pour l'installation, la mise à jour ou la suppression des paquets. .SH COMMANDES .P -.B update --yes +.B update --yes, --no-silent .RS Met à jour la liste des paquets et la base de données. .RE .P -.B upgrade --yes, --jobs, --resolve-off, --reinstall +.B upgrade --yes, --jobs, --resolve-off, --reinstall, --no-silent .RS Met à niveau tous les paquets installés si une version plus récente existe dans le référentiel. .RE @@ -47,22 +47,22 @@ Nettoie les journaux de suivi de dépendances. \fBAttention\fP, après cette pro Supprime tous les scripts et sources des SlackBuilds téléchargés. .RE .P -.B -b, build --yes, --jobs, --resolve-off, --search +.B -b, build --yes, --jobs, --resolve-off, --search, --no-silent .RS Construit les scripts des Slackbuilds et les ajoute au répertoire \fB/tmp\fP. .RE .P -.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search +.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search, --no-silent .RS Construit et installe les paquets dans l'ordre adéquat et enregistre également les paquets avec les dépendances à utiliser pour la suppression. .RE .P -.B -d, download --yes, --search +.B -d, download --yes, --search, --no-silent .RS Télécharger les scripts et les sources des SlackBuilds sans les construire ni les installer. .RE .P -.B -r, remove --yes, resolve-off, --search +.B -r, remove --yes, resolve-off, --search, --no-silent .RS Supprime les paquets avec leurs dépendances s'ils ont été installés avec la méthode \fB'slpkg install'\fP. Slpkg examine la configuration \fB'sbo_repo_tag'\fP pour trouver les paquets à supprimer. @@ -134,6 +134,11 @@ Active l'utilitaire de dialogue pour rechercher des paquets dans le référentie Essayez par exemple : \fB`slpkg install python3 --search`\fP ou \fB`slpkg download python3 --search`\fP et ainsi de suite. .RE .P +--no-silent +.RS +Désactivez le mode silencieux s'il est activé dans le fichier de configuration. +.RE +.P -h | --help .RS Affiche l'aide. diff --git a/man/slpkg.1 b/man/slpkg.1 index 82e346c3..765fb1bf 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -1,4 +1,4 @@ -.TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.7" dslackw +.TH slpkg 1 "Orestiada, Greece" "slpkg 4.5.0" dslackw .SH NAME .P .B slpkg - [OPTIONS] [COMMAND] @@ -17,12 +17,12 @@ Slpkg works in accordance with the standards of the organization SlackBuilds.org Also uses the Slackware Linux instructions for installation, upgrading or removing packages. .SH COMMANDS .P -.B update --yes +.B update --yes, --no-silent .RS Updates the package list and the database. .RE .P -.B upgrade --yes, --jobs, --resolve-off, --reinstall +.B upgrade --yes, --jobs, --resolve-off, --reinstall, --no-silent .RS Upgrade all the installed packages if the newer version exists in the repository. .RE @@ -47,22 +47,22 @@ Cleans dependencies log tracking. After that procedure you should remove depende Deletes all the downloaded SlackBuilds scripts and sources. .RE .P -.B -b, build --yes, --jobs, --resolve-off, --search +.B -b, build --yes, --jobs, --resolve-off, --search, --no-silent .RS Builds the Slackbuilds scripts and adds them to the /tmp directory. .RE .P -.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search +.B -i, install --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --search, --no-silent .RS Builds and installs the packages in the correct order and also logs the packages with dependencies to use for removal. .RE .P -.B -d, download --yes, --search +.B -d, download --yes, --search, --no-silent .RS Download the SlackBuilds scripts and the sources without building or installing it. .RE .P -.B -r, remove --yes, resolve-off, --search +.B -r, remove --yes, resolve-off, --search, --no-silent .RS Removes packages with dependencies if the packages was installed with 'slpkg install' method. Slpkg looks at the 'sbo_repo_tag' configuration to find packages for removal. @@ -134,6 +134,11 @@ Enable the dialog utility to search packages from the repository. Example try: `slpkg install python3 --search` or `slpkg download python3 --search` and etc. .RE .P +--no-silent +.RS +Disable silent mode if it is enabled in the configuration file. +.RE +.P -h | --help .RS Show help information and exit. diff --git a/slpkg/main.py b/slpkg/main.py index 16364fa6..9690cc3d 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -85,7 +85,10 @@ class Argparse: commands = { '--help': [], '--version': [], - 'update': [self.flag_yes], + 'update': [ + self.flag_yes, + self.flag_no_silent + ], 'upgrade': [ self.flag_yes, self.flag_jobs, diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 2b677407..3e80a237 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -40,10 +40,10 @@ class UpdateRepository: slackbuilds_txt = f'{self.configs.sbo_repo_url}/{self.configs.sbo_txt}' changelog_txt = f'{self.configs.sbo_repo_url}/{self.configs.sbo_chglog_txt}' - down_slackbuilds = Downloader(self.configs.sbo_repo_path, slackbuilds_txt) + down_slackbuilds = Downloader(self.configs.sbo_repo_path, slackbuilds_txt, self.flags) down_slackbuilds.download() - down_changelog = Downloader(self.configs.sbo_repo_path, changelog_txt) + down_changelog = Downloader(self.configs.sbo_repo_path, changelog_txt, self.flags) down_changelog.download() data = CreateData() From 83a2cdcce44e88363b70704e0d670cb9917b3b84 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 15 Jan 2023 19:41:13 +0200 Subject: [PATCH 16/17] Updated for version 4.5.0 --- README.rst | 4 ++-- setup.cfg | 2 +- slpkg/views/version.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 178c985c..2f51d6db 100644 --- a/README.rst +++ b/README.rst @@ -31,8 +31,8 @@ Install from the official third-party `SBo repository Date: Sun, 15 Jan 2023 19:49:34 +0200 Subject: [PATCH 17/17] Updated comments --- configs/slpkg.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/slpkg.toml b/configs/slpkg.toml index fb966c1a..5c29b540 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -59,7 +59,7 @@ # than local. wget_options = "-c -N -q --show-progress" - # This effect how you see the download and - # how the packages build and install. - # Choose the view mode. Default is new. [true/false] + # If silent mode is true, + # do not print the commands as they are executed. + # Default is true. [true/false] silent_mode = true \ No newline at end of file