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.upgrade = Upgrade(repository, data)
|
||||
self.view_message = ViewMessage(flags, repository, data)
|
||||
self.check_md5 = Md5sum(flags)
|
||||
|
||||
self.dependencies: list = []
|
||||
self.install_order: list = []
|
||||
|
@ -141,11 +142,10 @@ class Packages(Configs):
|
|||
return False
|
||||
|
||||
def checksum_binary_packages(self) -> None:
|
||||
md5 = Md5sum(self.flags)
|
||||
for package in self.binary_packages:
|
||||
name: str = self.utils.split_package(Path(package).stem)['name']
|
||||
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:
|
||||
for package in self.binary_packages:
|
||||
|
|
|
@ -18,31 +18,29 @@ class Md5sum:
|
|||
""" Checksum the sources. """
|
||||
|
||||
def __init__(self, flags: list):
|
||||
self.flags: list = flags
|
||||
|
||||
self.ascii = AsciiBox()
|
||||
self.errors = Errors()
|
||||
self.utils = Utilities()
|
||||
self.view = ViewMessage(flags)
|
||||
|
||||
logging.basicConfig(filename=LoggingConfig.log_file,
|
||||
filemode=LoggingConfig.filemode,
|
||||
encoding=LoggingConfig.encoding,
|
||||
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. """
|
||||
source_file = unquote(source)
|
||||
filename = source_file.split('/')[-1]
|
||||
source_path = Path(path, filename)
|
||||
|
||||
md5 = self.read_file(source_path)
|
||||
file_check = hashlib.md5(md5).hexdigest()
|
||||
file_check: str = hashlib.md5(md5).hexdigest()
|
||||
checksum = "".join(checksum)
|
||||
|
||||
if file_check != checksum:
|
||||
self.ascii.draw_checksum_error_box(filename, checksum, file_check)
|
||||
view = ViewMessage(self.flags)
|
||||
view.question()
|
||||
self.view.question()
|
||||
|
||||
def read_file(self, filename: Union[str, Path]) -> bytes:
|
||||
""" Reads the file. """
|
||||
|
|
|
@ -44,6 +44,7 @@ class Slackbuilds(Configs):
|
|||
self.logs_deps = LoggingDeps(repository, data)
|
||||
self.upgrade = Upgrade(repository, data)
|
||||
self.view_message = ViewMessage(flags, repository, data)
|
||||
self.check_md5 = Md5sum(self.flags)
|
||||
|
||||
self.sources: dict = {}
|
||||
self.install_order: list = []
|
||||
|
@ -186,8 +187,7 @@ class Slackbuilds(Configs):
|
|||
sources: list = self.data[sbo]['download'].split()
|
||||
|
||||
for source, checksum in zip(sources, checksums):
|
||||
md5sum = Md5sum(self.flags)
|
||||
md5sum.check(path, source, checksum)
|
||||
self.check_md5.md5sum(path, source, checksum)
|
||||
|
||||
def build_and_install_the_slackbuilds(self) -> None:
|
||||
for sbo in self.install_order:
|
||||
|
|
Loading…
Reference in a new issue