pmb: flasher: frontend: don't fail if kernel config cannot be found (MR 2184)

When using a kernel from Alpine the kernel configuration cannot be
found in pmaports. We cannot check the kernel config for missing
options in that case, but that's no reason to break the flasher
entirely.
This commit is contained in:
Minecrell 2022-05-28 13:53:51 +02:00 committed by Oliver Smith
parent cc90bc81f0
commit f1cbcb7b3b
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
3 changed files with 11 additions and 3 deletions

View File

@ -20,7 +20,7 @@ def kernel(args):
pmb.chroot.initfs.build(args, flavor, "rootfs_" + args.device)
# Check kernel config
pmb.parse.kconfig.check(args, flavor)
pmb.parse.kconfig.check(args, flavor, must_exist=False)
# Generate the paths and run the flasher
if args.action_flasher == "boot":

View File

@ -167,11 +167,13 @@ def check(args, pkgname,
force_zram_check=False,
force_netboot_check=False,
force_uefi_check=False,
details=False):
details=False,
must_exist=True):
"""
Check for necessary kernel config options in a package.
:returns: True when the check was successful, False otherwise
None if the aport cannot be found (only if must_exist=False)
"""
# Pkgname: allow omitting "linux-" prefix
if pkgname.startswith("linux-"):
@ -181,7 +183,9 @@ def check(args, pkgname,
# Read all kernel configs in the aport
ret = True
aport = pmb.helpers.pmaports.find(args, "linux-" + flavor)
aport = pmb.helpers.pmaports.find(args, "linux-" + flavor, must_exist=must_exist)
if aport is None:
return None
apkbuild = pmb.parse.apkbuild(f"{aport}/APKBUILD")
pkgver = apkbuild["pkgver"]
check_anbox = force_anbox_check or (

View File

@ -21,6 +21,10 @@ def args(tmpdir, request):
def test_kconfig_check(args):
# non-existing package
assert pmb.parse.kconfig.check(args, "non-existing-kernel-package",
must_exist=False) is None
# basic checks, from easiers to hard-ish
dir = f"{pmb_test.const.testdata}/kconfig_check/"
assert not pmb.parse.kconfig.check_file(dir +