diff --git a/pmb/flasher/frontend.py b/pmb/flasher/frontend.py index 14f0c7fe..a76b424f 100644 --- a/pmb/flasher/frontend.py +++ b/pmb/flasher/frontend.py @@ -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": diff --git a/pmb/parse/kconfig.py b/pmb/parse/kconfig.py index c649cdc1..ee7eaef4 100644 --- a/pmb/parse/kconfig.py +++ b/pmb/parse/kconfig.py @@ -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 ( diff --git a/test/test_kconfig_check.py b/test/test_kconfig_check.py index 116c9768..da8ebd51 100644 --- a/test/test_kconfig_check.py +++ b/test/test_kconfig_check.py @@ -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 +