CI: kconfig check: just run pmbootstrap (MR 5301)

Replace previous code that used internal pmbootstrap code with running
pmbootstrap directly. pmbootstrap doesn't really have a stable API yet,
so calling the internal code is always a bit fragile and now that we
have reworked a lot of its code, this is all broken.

The trade-off is that it is now slower and the output isn't as pretty,
but we can finally use kconfigcheck.toml from the pmaports branch. So it
is worth it!
This commit is contained in:
Oliver Smith 2024-06-30 18:33:09 +02:00
parent 3963f4cc8a
commit e0453db08f
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# Copyright 2023 Oliver Smith
# Copyright 2024 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import glob
@ -10,42 +10,25 @@ import subprocess
# Same dir
import common
# pmbootstrap
import add_pmbootstrap_to_import_path # noqa
import pmb.parse
import pmb.helpers.logging
def check_kconfig(args, pkgnames):
def check_kconfig(pkgnames):
last_failed = None
for i in range(len(pkgnames)):
pkgname = pkgnames[i]
print(f" ({i+1}/{len(pkgnames)}) {pkgname}")
apkbuild_path = pmb.helpers.pmaports.find(args, pkgname)
apkbuild = pmb.parse._apkbuild.apkbuild(f"{apkbuild_path}/APKBUILD")
p = subprocess.run(["pmbootstrap", "kconfig", "check", pkgname],
check=False)
options = []
for opt in apkbuild["options"]:
if "pmb:kconfigcheck" in opt:
options += [opt]
if len(options):
options.sort()
print(f'options="{" ".join(options)}"')
if "!pmb:kconfigcheck" in apkbuild["options"]:
print("skipped (!pmb:kconfigcheck)")
continue
if not pmb.parse.kconfig.check(args, pkgname, details=True):
if p.returncode:
last_failed = pkgname
return last_failed
def show_error(last_failed):
print("")
print("---")
print("")
print("Please adjust your kernel config. This is required for getting your"
" patch merged.")
@ -59,6 +42,8 @@ def show_error(last_failed):
print("Run this check again (on all kernels you modified):")
print(" pmbootstrap ci kconfig")
print("")
print("---")
print("")
if __name__ == "__main__":
@ -70,13 +55,7 @@ if __name__ == "__main__":
print("No kernels changed in this branch")
exit(0)
# Initialize args (so we can use pmbootstrap's kconfig parsing)
sys.argv = ["pmbootstrap", "kconfig", "check"]
args = pmb.parse.arguments()
pmb.helpers.logging.init(args)
print("Running kconfig check on changed kernels...")
last_failed = check_kconfig(args, pkgnames)
last_failed = check_kconfig(pkgnames)
if last_failed:
show_error(last_failed)