Updated for slackbuild

This commit is contained in:
Dimitris Zlatanidis 2023-05-07 23:54:15 +03:00
parent 544f5ec764
commit 82d039d512

View file

@ -82,7 +82,6 @@ class Slackbuilds(Configs):
level=LoggingConfig.level) level=LoggingConfig.level)
def execute(self) -> None: def execute(self) -> None:
""" Starting build or install the slackbuilds. """
self.creating_dependencies_list() self.creating_dependencies_list()
self.remove_duplicate_slackbuilds_from_dependencies() self.remove_duplicate_slackbuilds_from_dependencies()
self.add_dependencies_slackbuilds_to_install_list() self.add_dependencies_slackbuilds_to_install_list()
@ -98,7 +97,6 @@ class Slackbuilds(Configs):
self.utils.finished_time(elapsed_time) self.utils.finished_time(elapsed_time)
def creating_dependencies_list(self) -> None: def creating_dependencies_list(self) -> None:
""" Dictionary with the main slackbuilds and dependencies. """
if not self.option_for_resolve_off: if not self.option_for_resolve_off:
for sbo in self.slackbuilds: for sbo in self.slackbuilds:
deps: list = Requires(self.data, sbo).resolve() deps: list = Requires(self.data, sbo).resolve()
@ -120,7 +118,6 @@ class Slackbuilds(Configs):
self.install_order.extend(self.dependencies) self.install_order.extend(self.dependencies)
def clean_the_main_slackbuilds(self) -> None: def clean_the_main_slackbuilds(self) -> None:
""" Clean up the main packages if they were selected for dependencies. """
for dep in self.dependencies: for dep in self.dependencies:
if dep in self.slackbuilds: if dep in self.slackbuilds:
self.slackbuilds.remove(dep) self.slackbuilds.remove(dep)
@ -129,7 +126,6 @@ class Slackbuilds(Configs):
self.install_order.extend(self.slackbuilds) self.install_order.extend(self.slackbuilds)
def view_slackbuilds_before_build(self) -> None: def view_slackbuilds_before_build(self) -> None:
""" View slackbuilds before proceed. """
if self.mode == 'build': if self.mode == 'build':
self.view_message.build_packages(self.slackbuilds, self.dependencies) self.view_message.build_packages(self.slackbuilds, self.dependencies)
else: else:
@ -157,7 +153,6 @@ class Slackbuilds(Configs):
return False return False
def prepare_slackbuilds_for_build(self) -> None: def prepare_slackbuilds_for_build(self) -> None:
""" Downloads files and sources. """
sources: dict = {} sources: dict = {}
for sbo in self.install_order: for sbo in self.install_order:
@ -180,6 +175,9 @@ class Slackbuilds(Configs):
else: else:
sources[sbo] = self.data[sbo][3].split() sources[sbo] = self.data[sbo][3].split()
self.download_the_sources(sources)
def download_the_sources(self, sources):
if sources: if sources:
for pkg, sbo_sources in sources.items(): for pkg, sbo_sources in sources.items():
down_urls = Downloader(Path(self.build_path, pkg), sbo_sources, self.flags) down_urls = Downloader(Path(self.build_path, pkg), sbo_sources, self.flags)
@ -189,7 +187,6 @@ class Slackbuilds(Configs):
self.checksum_downloaded_sources() self.checksum_downloaded_sources()
def checksum_downloaded_sources(self) -> None: def checksum_downloaded_sources(self) -> None:
""" Checking the correct checksums. """
for sbo in self.install_order: for sbo in self.install_order:
path = Path(self.build_path, sbo) path = Path(self.build_path, sbo)
@ -205,7 +202,6 @@ class Slackbuilds(Configs):
md5sum.check(path, source, checksum) md5sum.check(path, source, checksum)
def build_and_install_the_slackbuilds(self) -> None: def build_and_install_the_slackbuilds(self) -> None:
""" Build the slackbuilds and install. """
for sbo in self.install_order: for sbo in self.install_order:
if self.continue_build_or_install(sbo): if self.continue_build_or_install(sbo):
@ -223,7 +219,6 @@ class Slackbuilds(Configs):
self.view_message.view_skipping_packages(sbo, installed_version) self.view_message.view_skipping_packages(sbo, installed_version)
def patch_slackbuild_tag(self, sbo: str) -> None: def patch_slackbuild_tag(self, sbo: str) -> None:
""" Patching SBo TAG from the configuration file. """
sbo_script: Path = Path(self.build_path, sbo, f'{sbo}.SlackBuild') sbo_script: Path = Path(self.build_path, sbo, f'{sbo}.SlackBuild')
if sbo_script.is_file() and self.repo_tag: if sbo_script.is_file() and self.repo_tag:
@ -236,7 +231,6 @@ class Slackbuilds(Configs):
script.write(line) script.write(line)
def install_package(self, pkg: str) -> None: def install_package(self, pkg: str) -> None:
""" Install the packages that before created in the tmp directory. """
package: str = self.find_package_for_install(pkg) package: str = self.find_package_for_install(pkg)
execute: str = self.installpkg execute: str = self.installpkg
@ -255,7 +249,6 @@ class Slackbuilds(Configs):
self.multi_process(command, package, message) self.multi_process(command, package, message)
def find_package_for_install(self, name: str) -> str: def find_package_for_install(self, name: str) -> str:
""" Returns the package for install. """
version: str = self.data[name][2] version: str = self.data[name][2]
pattern: str = f'{name}-{version}*{self.repo_tag}*' pattern: str = f'{name}-{version}*{self.repo_tag}*'
packages: list = [file.name for file in self.tmp_path.glob(pattern)] packages: list = [file.name for file in self.tmp_path.glob(pattern)]
@ -269,7 +262,6 @@ class Slackbuilds(Configs):
self.errors.raise_error_message(f"Package '{name}' not found for install", exit_status=20) self.errors.raise_error_message(f"Package '{name}' not found for install", exit_status=20)
def build_the_script(self, path: Path, name: str) -> None: def build_the_script(self, path: Path, name: str) -> None:
""" Run the .SlackBuild script. """
folder: str = f'{Path(path, name)}/' folder: str = f'{Path(path, name)}/'
execute: str = f'{folder}./{name}.SlackBuild' execute: str = f'{folder}./{name}.SlackBuild'
@ -289,7 +281,6 @@ class Slackbuilds(Configs):
@staticmethod @staticmethod
def set_makeflags() -> None: def set_makeflags() -> None:
""" Set number of processors. """
os.environ['MAKEFLAGS'] = f'-j {cpu_count()}' os.environ['MAKEFLAGS'] = f'-j {cpu_count()}'
def multi_process(self, command: str, filename: str, message: str) -> None: def multi_process(self, command: str, filename: str, message: str) -> None: