From f1afdeaaa1e045fc6d8a43704b6f1fa89647f88f Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 28 Jul 2024 15:51:59 +0200 Subject: [PATCH] kconfig check: add --keep-going argument (MR 2384) Abort the "pmbootstrap kconfig check" on the first error, unless the --keep-going argument was passed. This makes it easier to go through the failed kernels one by one until they are all fixed. --- pmb/commands/__init__.py | 2 +- pmb/commands/kconfig_check.py | 6 +++++- pmb/parse/arguments.py | 6 ++++++ pmb/types.py | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pmb/commands/__init__.py b/pmb/commands/__init__.py index e6619736..a8ea02fe 100644 --- a/pmb/commands/__init__.py +++ b/pmb/commands/__init__.py @@ -77,7 +77,7 @@ def run_command(args: PmbArgs): elif args.action == "pull": command = Pull() elif args.action == "kconfig" and args.action_kconfig == "check": - command = KConfigCheck(args.kconfig_check_details, args.file, args.package) + command = KConfigCheck(args.kconfig_check_details, args.file, args.package, args.keep_going) elif args.action == "kconfig" and args.action_kconfig in ["edit", "migrate"]: command = KConfigEdit(args.package[0], args.action_kconfig == "migrate") else: diff --git a/pmb/commands/kconfig_check.py b/pmb/commands/kconfig_check.py index 02b8c40e..f45651ee 100644 --- a/pmb/commands/kconfig_check.py +++ b/pmb/commands/kconfig_check.py @@ -14,11 +14,13 @@ class KConfigCheck(commands.Command): details: bool file: str packages: list[str] + keep_going: bool - def __init__(self, details, file, packages): + def __init__(self, details, file, packages, keep_going): self.details = details self.file = file self.packages = packages + self.keep_going = keep_going def run(self): # Build the components list from cli arguments (--waydroid etc.) @@ -51,6 +53,8 @@ class KConfigCheck(commands.Command): continue if not pmb.parse.kconfig.check(package, components_list, details=self.details): error = True + if not self.keep_going: + break # At least one failure if error: diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index baecd779..4898e12a 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -660,6 +660,12 @@ def arguments_kconfig(subparser): help="print one generic error per component instead of" " listing each option that needs to be adjusted", ) + check.add_argument( + "-k", + "--keep-going", + action="store_true", + help="continue on errors instead of aborting on the first error", + ) add_kernel_arg(check, nargs="*") # "pmbootstrap kconfig edit" diff --git a/pmb/types.py b/pmb/types.py index fe47788b..c966abb6 100644 --- a/pmb/types.py +++ b/pmb/types.py @@ -99,6 +99,7 @@ class PmbArgs(Namespace): kconfig_check_details: bool kernel: str keymap: str + keep_going: bool lines: int log: Path mirror_alpine: str