mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Updated for gpg
This commit is contained in:
parent
7b5a1983c6
commit
0c4c40781c
3 changed files with 14 additions and 3 deletions
|
@ -12,6 +12,7 @@ from slpkg.upgrade import Upgrade
|
||||||
from slpkg.views.views import View
|
from slpkg.views.views import View
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.dialog_box import DialogBox
|
from slpkg.dialog_box import DialogBox
|
||||||
|
from slpkg.gpg_verify import GPGVerify
|
||||||
from slpkg.downloader import Downloader
|
from slpkg.downloader import Downloader
|
||||||
from slpkg.views.asciibox import AsciiBox
|
from slpkg.views.asciibox import AsciiBox
|
||||||
from slpkg.repositories import Repositories
|
from slpkg.repositories import Repositories
|
||||||
|
@ -23,6 +24,7 @@ class Packages(Configs):
|
||||||
|
|
||||||
def __init__(self, repository: str, data: dict, packages: list, flags: list, mode: str):
|
def __init__(self, repository: str, data: dict, packages: list, flags: list, mode: str):
|
||||||
super(Configs, self).__init__()
|
super(Configs, self).__init__()
|
||||||
|
self.repository = repository
|
||||||
self.data: dict = data
|
self.data: dict = data
|
||||||
self.packages: list = packages
|
self.packages: list = packages
|
||||||
self.flags: list = flags
|
self.flags: list = flags
|
||||||
|
@ -37,6 +39,7 @@ class Packages(Configs):
|
||||||
self.check_md5 = Md5sum(flags)
|
self.check_md5 = Md5sum(flags)
|
||||||
self.download = Downloader(flags)
|
self.download = Downloader(flags)
|
||||||
self.ascii = AsciiBox()
|
self.ascii = AsciiBox()
|
||||||
|
self.gpg = GPGVerify()
|
||||||
|
|
||||||
self.dependencies: list = []
|
self.dependencies: list = []
|
||||||
self.install_order: list = []
|
self.install_order: list = []
|
||||||
|
@ -53,7 +56,6 @@ class Packages(Configs):
|
||||||
self.packages: list = self.utils.apply_package_pattern(data, packages)
|
self.packages: list = self.utils.apply_package_pattern(data, packages)
|
||||||
|
|
||||||
def execute(self) -> None:
|
def execute(self) -> None:
|
||||||
# self.creating_dependencies_list()
|
|
||||||
self.creating_dependencies_list()
|
self.creating_dependencies_list()
|
||||||
self.choose_package_dependencies()
|
self.choose_package_dependencies()
|
||||||
self.add_dependencies_to_install_order()
|
self.add_dependencies_to_install_order()
|
||||||
|
@ -97,6 +99,7 @@ class Packages(Configs):
|
||||||
|
|
||||||
def crating_the_package_urls_list(self) -> None:
|
def crating_the_package_urls_list(self) -> None:
|
||||||
packages: dict = {}
|
packages: dict = {}
|
||||||
|
asc_files: list = []
|
||||||
|
|
||||||
for pkg in self.install_order:
|
for pkg in self.install_order:
|
||||||
if self.continue_to_install(pkg):
|
if self.continue_to_install(pkg):
|
||||||
|
@ -104,8 +107,13 @@ class Packages(Configs):
|
||||||
mirror: str = self.data[pkg]['mirror']
|
mirror: str = self.data[pkg]['mirror']
|
||||||
location: str = self.data[pkg]['location']
|
location: str = self.data[pkg]['location']
|
||||||
url: list = [f'{mirror}{location}/{package}']
|
url: list = [f'{mirror}{location}/{package}']
|
||||||
|
asc_url: list = [f'{mirror}{location}/{package}.asc']
|
||||||
|
asc_file: Path = Path(self.tmp_slpkg, f'{package}.asc')
|
||||||
|
|
||||||
packages[pkg] = (url, self.tmp_slpkg)
|
packages[pkg] = (url, self.tmp_slpkg)
|
||||||
|
if self.gpg_verification:
|
||||||
|
packages[f'{pkg}.asc'] = (asc_url, self.tmp_slpkg)
|
||||||
|
asc_files.append(asc_file)
|
||||||
|
|
||||||
self.binary_packages.append(package)
|
self.binary_packages.append(package)
|
||||||
self.utils.remove_file_if_exists(self.tmp_slpkg, package)
|
self.utils.remove_file_if_exists(self.tmp_slpkg, package)
|
||||||
|
@ -114,6 +122,9 @@ class Packages(Configs):
|
||||||
self.view.skipping_packages(installed_package)
|
self.view.skipping_packages(installed_package)
|
||||||
|
|
||||||
self.download_the_binary_packages(packages)
|
self.download_the_binary_packages(packages)
|
||||||
|
if self.gpg_verification:
|
||||||
|
self.gpg.verify(asc_files)
|
||||||
|
print()
|
||||||
|
|
||||||
def download_the_binary_packages(self, packages: dict) -> None:
|
def download_the_binary_packages(self, packages: dict) -> None:
|
||||||
if packages:
|
if packages:
|
||||||
|
|
|
@ -32,7 +32,7 @@ class GPGVerify(Configs):
|
||||||
exit_code: int = process.returncode
|
exit_code: int = process.returncode
|
||||||
if i == 0:
|
if i == 0:
|
||||||
print(f'{self.bred}FAILED!{self.endc}')
|
print(f'{self.bred}FAILED!{self.endc}')
|
||||||
print(f"{'':>2}Error {process.returncode}: file '{file.name}' not found.")
|
print(f"{'':>2}Error {process.returncode}: {file.name}")
|
||||||
|
|
||||||
if exit_code == 0:
|
if exit_code == 0:
|
||||||
print(f'{self.yellow}{self.ascii.done}{self.endc}')
|
print(f'{self.yellow}{self.ascii.done}{self.endc}')
|
||||||
|
|
|
@ -99,7 +99,7 @@ class Slackbuilds(Configs):
|
||||||
self.install_order.extend(self.dependencies)
|
self.install_order.extend(self.dependencies)
|
||||||
|
|
||||||
def gpg_verifying(self):
|
def gpg_verifying(self):
|
||||||
if self.repository == self.repos.sbo_repo_name:
|
if self.gpg_verification and self.repository == self.repos.sbo_repo_name:
|
||||||
asc_files: list = []
|
asc_files: list = []
|
||||||
for file in self.slackbuilds + self.dependencies:
|
for file in self.slackbuilds + self.dependencies:
|
||||||
location: str = self.data[file]['location']
|
location: str = self.data[file]['location']
|
||||||
|
|
Loading…
Add table
Reference in a new issue