From aceb844afd05bf5704ff7f9a58589ec408f5da3f Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 2 Apr 2023 09:07:57 +0300 Subject: [PATCH] Fixed for failed build message --- slpkg/sbos/slackbuild.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/slpkg/sbos/slackbuild.py b/slpkg/sbos/slackbuild.py index 6eb3bd90..5c64156d 100644 --- a/slpkg/sbos/slackbuild.py +++ b/slpkg/sbos/slackbuild.py @@ -46,7 +46,6 @@ class Slackbuilds(Configs): self.install_order: list = [] self.dependencies: list = [] self.sbos: dict = {} - self.output: int = 0 self.stderr = None self.stdout = None self.process_message: str = '' @@ -271,14 +270,19 @@ class Slackbuilds(Configs): def package_for_install(self, name: str) -> str: """ Returns the package for install. """ + package_to_install: str = '' version: str = SBoQueries(name).version() - pattern: str = f'{name}-{version}*{self.repos.repo_tag}*' tmp = Path(self.tmp_path) packages: list = [file.name for file in tmp.glob(pattern)] - return max(packages) + try: + package_to_install: str = max(packages) + except ValueError: + self.utils.raise_error_message(f"Package '{name}' not found for install") + + return package_to_install def build_the_script(self, path: Path, name: str) -> None: """ Run the .SlackBuild script. """ @@ -326,11 +330,10 @@ class Slackbuilds(Configs): if not p1.is_alive(): if p1.exitcode != 0: - done: str = f' {self.bred} Failed{self.endc}' - self.output: int = p1.exitcode # type: ignore + done: str = f'{self.bred}Failed: {self.endc}{self.process_message}' - print(f'{self.endc}{done}', end='') p2.terminate() + print(f'{self.endc}{done}', end='') # Wait until process 2 finish p2.join() @@ -340,13 +343,6 @@ class Slackbuilds(Configs): else: self.utils.process(command, self.stderr, self.stdout) - self.print_error() - - def print_error(self) -> None: - """ Stop the process and print the error message. """ - if self.output != 0: - self.utils.raise_error_message(f"{self.output}: {self.process_message}") - def choose_dependencies(self, dependencies: list) -> list: """ Choose packages for install. """ height: int = 10