diff --git a/ChangeLog.txt b/ChangeLog.txt index 3a9bcdc1..e7cc57b9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -19,6 +19,7 @@ - Added: * Check for upgrade packages using the option --check * MAKEFLAGS config to specify the number of jobs + * Support GPG verification - Bugfixes: * Double view message when update repositories diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 42136680..57a18ccf 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -1,6 +1,6 @@ # This is the general configuration file of slpkg: # /etc/slpkg/slpkg.toml -# Updated: 11/02/2024, Version: 5.0.0 +# Updated: 20/03/2024, Version: 5.0.0 [CONFIGS] @@ -21,6 +21,10 @@ COLORS = true # Specify the number of jobs to run concurrently. Default is '-j4'. MAKEFLAGS = "-j4" +# Set for GPG verification. Default is 'false'. +# If you set true, you should update the repositories for GPG-KEY import. +GPG_VERIFICATION = false + # Dialog is a program that will let you present a variety of questions or # display messages using dialog boxes from a shell script. # Default is true. [true/false] @@ -109,9 +113,6 @@ LFTP_GET_OPTIONS = "-c get -e" # Lftp mirror options are used to synchronize with the SBo and Ponce repositories # or for the local repositories. LFTP_MIRROR_OPTIONS = "-c mirror --parallel=100 --only-newer --delete" -# Addition extra option for lftp command to exclude some not useful files -# from SBo and ponce repositories. -LFTP_EXCLUDE = "-X SLACKBUILDS.TXT.gz -X CHECKSUMS.md5.asc -X 'TAGS.txt*' -X '*.tar.gz*'" # Python urllib3 settings used for checking between two changelog files. # Timeouts allow you to control how long (in seconds) requests are allowed diff --git a/slpkg/configs.py b/slpkg/configs.py index dea0c93f..ea190519 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -35,13 +35,13 @@ class Configs: removepkg: str = 'removepkg' colors: bool = True makeflags: str = '-j4' + gpg_verification: bool = False dialog: bool = True downloader: str = 'wget' wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress' curl_options: str = '' lftp_get_options: str = '-c get -e' - lftp_mirror_options: str = '-c mirror --parallel=100 --only-newer' - lftp_exclude: str = "-X SLACKBUILDS.TXT.gz -X CHECKSUMS.md5.asc -X 'TAGS.txt*' -X '*.tar.gz*'" + lftp_mirror_options: str = '-c mirror --parallel=100 --only-newer --delete' silent_mode: bool = True ascii_characters: bool = True ask_question: bool = True @@ -79,13 +79,13 @@ class Configs: removepkg: str = config['REMOVEPKG'] colors: bool = config['COLORS'] makeflags: str = config['MAKEFLAGS'] + gpg_verification: bool = config['GPG_VERIFICATION'] dialog: str = config['DIALOG'] downloader: str = config['DOWNLOADER'] wget_options: str = config['WGET_OPTIONS'] curl_options: str = config['CURL_OPTIONS'] lftp_get_options: str = config['LFTP_GET_OPTIONS'] lftp_mirror_options: str = config['LFTP_MIRROR_OPTIONS'] - lftp_exclude: str = config['LFTP_EXCLUDE'] silent_mode: bool = config['SILENT_MODE'] ascii_characters: bool = config['ASCII_CHARACTERS'] file_list_suffix: str = config['FILE_LIST_SUFFIX'] diff --git a/slpkg/gpg_verify.py b/slpkg/gpg_verify.py new file mode 100644 index 00000000..63915d7d --- /dev/null +++ b/slpkg/gpg_verify.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import subprocess + +from slpkg.configs import Configs +from slpkg.views.asciibox import AsciiBox +from slpkg.views.views import View + + +class GPGVerify(Configs): + + def __init__(self): + super(Configs, self).__init__() + self.ascii = AsciiBox() + self.view = View() + + def verify(self, asc_files: list) -> None: + if self.gpg_verification: + verify_message: str = '\rVerify files with GPG ... ' + gpg_command: str = 'gpg --verify' + print(verify_message, end='') + + exit_code: int = 0 + for i, file in enumerate(asc_files): + process = subprocess.Popen(f'{gpg_command} {file}', shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, text=True) + + process.wait() + + if process.returncode != 0: + exit_code: int = process.returncode + if i == 0: + print(f'{self.bred}FAILED!{self.endc}') + print(f"{'':>2}Error {process.returncode}: file '{file.name}' not found.") + + if exit_code == 0: + print(f'{self.yellow}{self.ascii.done}{self.endc}') + elif exit_code != 0 and self.dialog: + self.view.question() diff --git a/slpkg/install_data.py b/slpkg/install_data.py index 5ed4cc05..4865d7d2 100644 --- a/slpkg/install_data.py +++ b/slpkg/install_data.py @@ -9,6 +9,7 @@ from slpkg.configs import Configs from slpkg.utilities import Utilities from slpkg.views.asciibox import AsciiBox from slpkg.repositories import Repositories +from slpkg.multi_process import MultiProcess class InstallData(Configs): @@ -18,6 +19,13 @@ class InstallData(Configs): self.utils = Utilities() self.repos = Repositories() self.ascii = AsciiBox() + self.multi_process = MultiProcess() + + def _import_GPG_KEY(self, mirror: str, gpg_key='GPG-KEY') -> None: + if self.gpg_verification: + gpg_command: str = 'gpg --quiet --fetch-key' + GPG_KEY: str = f'{mirror}{gpg_key}' + self.multi_process.process(f'{gpg_command} {GPG_KEY}') def write_last_update(self, changelog_file: Path, repo: str) -> None: """ Reads the first date of the changelog file.""" @@ -46,8 +54,11 @@ class InstallData(Configs): Returns: None. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.sbo_repo_name}{self.endc}'... ", + print(f"Updating the database for '{self.cyan}{self.repos.sbo_repo_name}{self.endc}'... ", end='', flush=True) + + self._import_GPG_KEY(mirror='https://www.slackbuilds.org/') + data: dict = {} cache: list = [] sbo_tags: list = [ @@ -122,7 +133,7 @@ class InstallData(Configs): Returns: None. """ - print(f"\nUpdating the database for '{self.cyan}{self.repos.ponce_repo_name}{self.endc}'... ", + print(f"Updating the database for '{self.cyan}{self.repos.ponce_repo_name}{self.endc}'... ", end='', flush=True) data: dict = {} cache: list = [] @@ -202,6 +213,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slack_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slack_repo_mirror[0] + if self.repos.slack_repo_local[0].startswith('file'): + mirror: str = self.repos.slack_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + data: dict = {} checksums_dict: dict = {} build: str = '' @@ -220,10 +237,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slack_repo_mirror[0] - if self.repos.slack_repo_local[0].startswith('file'): - mirror: str = self.repos.slack_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -297,6 +310,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slack_extra_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slack_extra_repo_mirror[0] + if self.repos.slack_extra_repo_local[0].startswith('file'): + mirror: str = self.repos.slack_extra_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -315,10 +334,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slack_extra_repo_mirror[0] - if self.repos.slack_extra_repo_local[0].startswith('file'): - mirror: str = self.repos.slack_extra_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -392,6 +407,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slack_patches_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slack_patches_repo_mirror[0] + if self.repos.slack_patches_repo_local[0].startswith('file'): + mirror: str = self.repos.slack_patches_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -410,10 +431,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slack_patches_repo_mirror[0] - if self.repos.slack_patches_repo_local[0].startswith('file'): - mirror: str = self.repos.slack_patches_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -487,6 +504,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.alien_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = ''.join(self.repos.alien_repo_mirror) + if self.repos.alien_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.alien_repo_local) + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -504,10 +527,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = ''.join(self.repos.alien_repo_mirror) - if self.repos.alien_repo_local[0].startswith('file'): - mirror: str = ''.join(self.repos.alien_repo_local) - for line in checksums_md5: line = line.strip() @@ -587,6 +606,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.multilib_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = ''.join(self.repos.multilib_repo_mirror) + if self.repos.multilib_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.multilib_repo_local) + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -604,10 +629,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = ''.join(self.repos.multilib_repo_mirror) - if self.repos.multilib_repo_local[0].startswith('file'): - mirror: str = ''.join(self.repos.multilib_repo_local) - for line in checksums_md5: line = line.strip() @@ -682,6 +703,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.restricted_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = ''.join(self.repos.restricted_repo_mirror) + if self.repos.restricted_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.restricted_repo_local) + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -699,10 +726,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = ''.join(self.repos.restricted_repo_mirror) - if self.repos.restricted_repo_local[0].startswith('file'): - mirror: str = ''.join(self.repos.restricted_repo_local) - for line in checksums_md5: line = line.strip() @@ -777,6 +800,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.gnome_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.gnome_repo_mirror[0] + if self.repos.gnome_repo_local[0].startswith('file'): + mirror: str = self.repos.gnome_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -795,10 +824,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.gnome_repo_mirror[0] - if self.repos.gnome_repo_local[0].startswith('file'): - mirror: str = self.repos.gnome_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -873,6 +898,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.msb_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = ''.join(self.repos.msb_repo_mirror) + if self.repos.msb_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.msb_repo_local) + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -890,10 +921,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = ''.join(self.repos.msb_repo_mirror) - if self.repos.msb_repo_local[0].startswith('file'): - mirror: str = ''.join(self.repos.msb_repo_local) - for line in checksums_md5: line = line.strip() @@ -968,6 +995,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.csb_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = ''.join(self.repos.csb_repo_mirror) + if self.repos.csb_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.csb_repo_local) + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -985,10 +1018,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = ''.join(self.repos.csb_repo_mirror) - if self.repos.csb_repo_local[0].startswith('file'): - mirror: str = ''.join(self.repos.csb_repo_local) - for line in checksums_md5: line = line.strip() @@ -1063,6 +1092,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.conraid_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.conraid_repo_mirror[0] + if self.repos.conraid_repo_local[0].startswith('file'): + mirror: str = self.repos.conraid_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1081,10 +1116,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.conraid_repo_mirror[0] - if self.repos.conraid_repo_local[0].startswith('file'): - mirror: str = self.repos.conraid_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1159,6 +1190,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slackdce_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slackdce_repo_mirror[0] + if self.repos.slackdce_repo_local[0].startswith('file'): + mirror: str = self.repos.slackdce_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1176,10 +1213,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slackdce_repo_mirror[0] - if self.repos.slackdce_repo_local[0].startswith('file'): - mirror: str = self.repos.slackdce_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1259,6 +1292,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slackonly_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slackonly_repo_mirror[0] + if self.repos.slackonly_repo_local[0].startswith('file'): + mirror: str = self.repos.slackonly_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1276,10 +1315,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slackonly_repo_mirror[0] - if self.repos.slackonly_repo_local[0].startswith('file'): - mirror: str = self.repos.slackonly_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1359,6 +1394,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.salixos_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.salixos_repo_mirror[0] + if self.repos.salixos_repo_local[0].startswith('file'): + mirror: str = self.repos.salixos_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1376,10 +1417,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.salixos_repo_mirror[0] - if self.repos.salixos_repo_local[0].startswith('file'): - mirror: str = self.repos.salixos_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1467,6 +1504,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.salixos_extra_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.salixos_extra_repo_mirror[0] + if self.repos.salixos_extra_repo_local[0].startswith('file'): + mirror: str = self.repos.salixos_extra_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1484,10 +1527,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.salixos_extra_repo_mirror[0] - if self.repos.salixos_extra_repo_local[0].startswith('file'): - mirror: str = self.repos.salixos_extra_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1575,6 +1614,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.salixos_patches_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.salixos_patches_repo_mirror[0] + if self.repos.salixos_patches_repo_local[0].startswith('file'): + mirror: str = self.repos.salixos_patches_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1594,10 +1639,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.salixos_patches_repo_mirror[0] - if self.repos.salixos_patches_repo_local[0].startswith('file'): - mirror: str = self.repos.salixos_patches_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1686,6 +1727,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slackel_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slackel_repo_mirror[0] + if self.repos.slackel_repo_local[0].startswith('file'): + mirror: str = self.repos.slackel_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1703,10 +1750,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slackel_repo_mirror[0] - if self.repos.slackel_repo_local[0].startswith('file'): - mirror: str = self.repos.slackel_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1794,6 +1837,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.slint_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = self.repos.slint_repo_mirror[0] + if self.repos.slint_repo_local[0].startswith('file'): + mirror: str = self.repos.slint_repo_local[0] + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1811,10 +1860,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = self.repos.slint_repo_mirror[0] - if self.repos.slint_repo_local[0].startswith('file'): - mirror: str = self.repos.slint_repo_local[0] - for line in checksums_md5: line = line.strip() @@ -1902,6 +1947,12 @@ class InstallData(Configs): print(f"\nUpdating the database for '{self.cyan}{self.repos.pprkut_repo_name}{self.endc}'... ", end='', flush=True) + mirror: str = ''.join(self.repos.pprkut_repo_mirror) + if self.repos.pprkut_repo_local[0].startswith('file'): + mirror: str = ''.join(self.repos.pprkut_repo_local) + + self._import_GPG_KEY(mirror=mirror) + checksums_dict: dict = {} data: dict = {} build: str = '' @@ -1919,10 +1970,6 @@ class InstallData(Configs): packages_txt: list = self.utils.read_text_file(path_packages) checksums_md5: list = self.utils.read_text_file(path_checksums) - mirror: str = ''.join(self.repos.pprkut_repo_mirror) - if self.repos.pprkut_repo_local[0].startswith('file'): - mirror: str = ''.join(self.repos.pprkut_repo_local) - for line in checksums_md5: line = line.strip() diff --git a/slpkg/multi_process.py b/slpkg/multi_process.py index b83a5014..5e8ff8c7 100644 --- a/slpkg/multi_process.py +++ b/slpkg/multi_process.py @@ -14,7 +14,7 @@ from slpkg.progress_bar import ProgressBar class MultiProcess(Configs): - def __init__(self, flags: list): + def __init__(self, flags=None): super(Configs, self).__init__() self.utils = Utilities() @@ -26,8 +26,9 @@ class MultiProcess(Configs): self.head_message: str = f'Timestamp: {self.timestamp}' self.bottom_message: str = 'EOF - End of log file' - self.option_for_silent: bool = self.utils.is_option( - ('-n', '--silent'), flags) + if flags is not None: + self.option_for_silent: bool = self.utils.is_option( + ('-n', '--silent'), flags) def run(self, command: str, filename: str, progress_message: str) -> None: """ Starting a multiprocessing process. diff --git a/slpkg/sbos/sbo_generate.py b/slpkg/sbos/sbo_generate.py index 265a8790..fa021af7 100644 --- a/slpkg/sbos/sbo_generate.py +++ b/slpkg/sbos/sbo_generate.py @@ -5,6 +5,7 @@ from pathlib import Path from slpkg.configs import Configs from slpkg.views.asciibox import AsciiBox + class SBoGenerate(Configs): """ Generating the SLACKBUILDS.TXT file. """ diff --git a/slpkg/sbos/slackbuild.py b/slpkg/sbos/slackbuild.py index 9484b368..cb753c15 100644 --- a/slpkg/sbos/slackbuild.py +++ b/slpkg/sbos/slackbuild.py @@ -14,6 +14,7 @@ from slpkg.configs import Configs from slpkg.views.views import View from slpkg.utilities import Utilities from slpkg.dialog_box import DialogBox +from slpkg.gpg_verify import GPGVerify from slpkg.downloader import Downloader from slpkg.error_messages import Errors from slpkg.views.asciibox import AsciiBox @@ -42,6 +43,7 @@ class Slackbuilds(Configs): self.view = View(flags, repository, data) self.check_md5 = Md5sum(flags) self.download = Downloader(flags) + self.gpg = GPGVerify() self.sources: dict = {} self.install_order: list = [] @@ -65,6 +67,7 @@ class Slackbuilds(Configs): def execute(self) -> None: self.creating_dependencies_list() + self.gpg_verifying() self.choose_package_dependencies() self.add_dependencies_to_install_order() self.clean_the_main_slackbuilds() @@ -95,6 +98,16 @@ class Slackbuilds(Configs): def add_dependencies_to_install_order(self) -> None: self.install_order.extend(self.dependencies) + def gpg_verifying(self): + if self.repository == self.repos.sbo_repo_name: + asc_files: list = [] + for file in self.slackbuilds + self.dependencies: + location: str = self.data[file]['location'] + asc_file: Path = Path(self.repos.repositories_path, self.repos.sbo_repo_name, + location, f'{file}.tar.gz.asca') + asc_files.append(Path(asc_file)) + self.gpg.verify(asc_files) + def clean_the_main_slackbuilds(self) -> None: for dep in self.dependencies: if dep in self.slackbuilds: diff --git a/slpkg/update_repositories.py b/slpkg/update_repositories.py index 757d0e1a..95bbe958 100644 --- a/slpkg/update_repositories.py +++ b/slpkg/update_repositories.py @@ -579,7 +579,7 @@ class UpdateRepositories(Configs): self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds) self.utils.remove_file_if_exists(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog) - lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.lftp_exclude} ' + lftp_command: str = (f'lftp {self.lftp_mirror_options} ' f'{self.repos.ponce_repo_mirror[0]} {self.repos.ponce_repo_path}') self.multi_process.process(lftp_command) @@ -595,7 +595,7 @@ class UpdateRepositories(Configs): self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds) self.utils.remove_file_if_exists(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog) - lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.lftp_exclude} ' + lftp_command: str = (f'lftp {self.lftp_mirror_options} ' f'{self.repos.sbo_repo_mirror[0]} {self.repos.sbo_repo_path}') self.multi_process.process(lftp_command)