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.
This commit is contained in:
Oliver Smith 2024-07-28 15:51:59 +02:00
parent 816ae5ac6c
commit f1afdeaaa1
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 13 additions and 2 deletions

View file

@ -77,7 +77,7 @@ def run_command(args: PmbArgs):
elif args.action == "pull": elif args.action == "pull":
command = Pull() command = Pull()
elif args.action == "kconfig" and args.action_kconfig == "check": 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"]: elif args.action == "kconfig" and args.action_kconfig in ["edit", "migrate"]:
command = KConfigEdit(args.package[0], args.action_kconfig == "migrate") command = KConfigEdit(args.package[0], args.action_kconfig == "migrate")
else: else:

View file

@ -14,11 +14,13 @@ class KConfigCheck(commands.Command):
details: bool details: bool
file: str file: str
packages: list[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.details = details
self.file = file self.file = file
self.packages = packages self.packages = packages
self.keep_going = keep_going
def run(self): def run(self):
# Build the components list from cli arguments (--waydroid etc.) # Build the components list from cli arguments (--waydroid etc.)
@ -51,6 +53,8 @@ class KConfigCheck(commands.Command):
continue continue
if not pmb.parse.kconfig.check(package, components_list, details=self.details): if not pmb.parse.kconfig.check(package, components_list, details=self.details):
error = True error = True
if not self.keep_going:
break
# At least one failure # At least one failure
if error: if error:

View file

@ -660,6 +660,12 @@ def arguments_kconfig(subparser):
help="print one generic error per component instead of" help="print one generic error per component instead of"
" listing each option that needs to be adjusted", " 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="*") add_kernel_arg(check, nargs="*")
# "pmbootstrap kconfig edit" # "pmbootstrap kconfig edit"

View file

@ -99,6 +99,7 @@ class PmbArgs(Namespace):
kconfig_check_details: bool kconfig_check_details: bool
kernel: str kernel: str
keymap: str keymap: str
keep_going: bool
lines: int lines: int
log: Path log: Path
mirror_alpine: str mirror_alpine: str