From db163aded680b3cfcc40be6be5d477b70aa54e91 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 16 Apr 2024 18:05:06 +0200 Subject: [PATCH] Print ERROR: infront of {NonBug,BuildFailed}Error (MR 2298) Make the handling of the custom NonBugError and BuildFailedError exceptions more consistent with the handling of other exceptions, by printing "ERROR: " infront of the actual error text. Then we don't need to duplicate that where we raise the errors. pmbootstrap prints "ERROR" in red. --- pmb/__init__.py | 4 ++-- pmb/build/_package.py | 2 +- pmb/parse/kconfig.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pmb/__init__.py b/pmb/__init__.py index f11d66ca..be19f5d6 100644 --- a/pmb/__init__.py +++ b/pmb/__init__.py @@ -88,11 +88,11 @@ def main(): sys.exit(130) # SIGINT(2) + 128 except NonBugError as exception: - logging.error(exception) + logging.error(f"ERROR: {exception}") return 2 except BuildFailedError as exception: - logging.error(exception) + logging.error(f"ERROR: {exception}") print_log_hint(args) return 3 diff --git a/pmb/build/_package.py b/pmb/build/_package.py index bc56553c..d059e684 100644 --- a/pmb/build/_package.py +++ b/pmb/build/_package.py @@ -535,6 +535,6 @@ def package(args, pkgname, arch=None, force=False, strict=False, (output, cmd, env) = run_abuild(args, apkbuild, arch, strict, force, cross, suffix, src, bootstrap_stage) except RuntimeError: - raise BuildFailedError(f"ERROR: Build for {arch}/{pkgname} failed!") + raise BuildFailedError(f"Build for {arch}/{pkgname} failed!") finish(args, apkbuild, arch, output, strict, suffix) return output diff --git a/pmb/parse/kconfig.py b/pmb/parse/kconfig.py index 872098b9..d2e9048e 100644 --- a/pmb/parse/kconfig.py +++ b/pmb/parse/kconfig.py @@ -272,7 +272,7 @@ def check(args, pkgname, components_list=[], details=False, must_exist=True): config_name_split = config_name.split(".") if len(config_name_split) != 2: - raise NonBugError(f"ERROR: {config_name} is not a valid kernel config " + raise NonBugError(f"{config_name} is not a valid kernel config" "name. Ensure that the _config property in your " "kernel APKBUILD has a . before the " "architecture name, e.g. .aarch64 or .armv7, "