mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-19 10:27:07 +01:00
Updated for naming
This commit is contained in:
parent
f691a69a21
commit
e242261270
3 changed files with 8 additions and 10 deletions
|
@ -35,6 +35,7 @@ class Packages(Configs):
|
||||||
self.logs_deps = LoggingDeps(repository, data)
|
self.logs_deps = LoggingDeps(repository, data)
|
||||||
self.upgrade = Upgrade(repository, data)
|
self.upgrade = Upgrade(repository, data)
|
||||||
self.view_message = ViewMessage(flags, repository, data)
|
self.view_message = ViewMessage(flags, repository, data)
|
||||||
|
self.check_md5 = Md5sum(flags)
|
||||||
|
|
||||||
self.dependencies: list = []
|
self.dependencies: list = []
|
||||||
self.install_order: list = []
|
self.install_order: list = []
|
||||||
|
@ -141,11 +142,10 @@ class Packages(Configs):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def checksum_binary_packages(self) -> None:
|
def checksum_binary_packages(self) -> None:
|
||||||
md5 = Md5sum(self.flags)
|
|
||||||
for package in self.binary_packages:
|
for package in self.binary_packages:
|
||||||
name: str = self.utils.split_package(Path(package).stem)['name']
|
name: str = self.utils.split_package(Path(package).stem)['name']
|
||||||
pkg_checksum: str = self.data[name]['checksum']
|
pkg_checksum: str = self.data[name]['checksum']
|
||||||
md5.check(self.tmp_slpkg, package, pkg_checksum)
|
self.check_md5.md5sum(self.tmp_slpkg, package, pkg_checksum)
|
||||||
|
|
||||||
def install_packages(self) -> None:
|
def install_packages(self) -> None:
|
||||||
for package in self.binary_packages:
|
for package in self.binary_packages:
|
||||||
|
|
|
@ -18,31 +18,29 @@ class Md5sum:
|
||||||
""" Checksum the sources. """
|
""" Checksum the sources. """
|
||||||
|
|
||||||
def __init__(self, flags: list):
|
def __init__(self, flags: list):
|
||||||
self.flags: list = flags
|
|
||||||
|
|
||||||
self.ascii = AsciiBox()
|
self.ascii = AsciiBox()
|
||||||
self.errors = Errors()
|
self.errors = Errors()
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
|
self.view = ViewMessage(flags)
|
||||||
|
|
||||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||||
filemode=LoggingConfig.filemode,
|
filemode=LoggingConfig.filemode,
|
||||||
encoding=LoggingConfig.encoding,
|
encoding=LoggingConfig.encoding,
|
||||||
level=LoggingConfig.level)
|
level=LoggingConfig.level)
|
||||||
|
|
||||||
def check(self, path: Union[str, Path], source: str, checksum: str) -> None:
|
def md5sum(self, path: Union[str, Path], source: str, checksum: str) -> None:
|
||||||
""" Checksum the source. """
|
""" Checksum the source. """
|
||||||
source_file = unquote(source)
|
source_file = unquote(source)
|
||||||
filename = source_file.split('/')[-1]
|
filename = source_file.split('/')[-1]
|
||||||
source_path = Path(path, filename)
|
source_path = Path(path, filename)
|
||||||
|
|
||||||
md5 = self.read_file(source_path)
|
md5 = self.read_file(source_path)
|
||||||
file_check = hashlib.md5(md5).hexdigest()
|
file_check: str = hashlib.md5(md5).hexdigest()
|
||||||
checksum = "".join(checksum)
|
checksum = "".join(checksum)
|
||||||
|
|
||||||
if file_check != checksum:
|
if file_check != checksum:
|
||||||
self.ascii.draw_checksum_error_box(filename, checksum, file_check)
|
self.ascii.draw_checksum_error_box(filename, checksum, file_check)
|
||||||
view = ViewMessage(self.flags)
|
self.view.question()
|
||||||
view.question()
|
|
||||||
|
|
||||||
def read_file(self, filename: Union[str, Path]) -> bytes:
|
def read_file(self, filename: Union[str, Path]) -> bytes:
|
||||||
""" Reads the file. """
|
""" Reads the file. """
|
||||||
|
|
|
@ -44,6 +44,7 @@ class Slackbuilds(Configs):
|
||||||
self.logs_deps = LoggingDeps(repository, data)
|
self.logs_deps = LoggingDeps(repository, data)
|
||||||
self.upgrade = Upgrade(repository, data)
|
self.upgrade = Upgrade(repository, data)
|
||||||
self.view_message = ViewMessage(flags, repository, data)
|
self.view_message = ViewMessage(flags, repository, data)
|
||||||
|
self.check_md5 = Md5sum(self.flags)
|
||||||
|
|
||||||
self.sources: dict = {}
|
self.sources: dict = {}
|
||||||
self.install_order: list = []
|
self.install_order: list = []
|
||||||
|
@ -186,8 +187,7 @@ class Slackbuilds(Configs):
|
||||||
sources: list = self.data[sbo]['download'].split()
|
sources: list = self.data[sbo]['download'].split()
|
||||||
|
|
||||||
for source, checksum in zip(sources, checksums):
|
for source, checksum in zip(sources, checksums):
|
||||||
md5sum = Md5sum(self.flags)
|
self.check_md5.md5sum(path, source, checksum)
|
||||||
md5sum.check(path, source, checksum)
|
|
||||||
|
|
||||||
def build_and_install_the_slackbuilds(self) -> None:
|
def build_and_install_the_slackbuilds(self) -> None:
|
||||||
for sbo in self.install_order:
|
for sbo in self.install_order:
|
||||||
|
|
Loading…
Reference in a new issue