pmb.parse.kconfig: don't enforce non-core checks for testing devices

Currently when any device does not conform to the options they declare,
we fail the whole kconfig check.

Now that we start requiring more options, especially with
pmb:kconfigcheck-community it makes sense to relax these restrictions so
we're more free to edit kconfig options and don't have to adjust all
testing devices that may or may not be properly maintained.

As a side effect this patch makes it practically impossible to make
kconfig check actually fail for any testing device which might not be
optimal. If these use cases appear in the future we will want to adjust
pmbootstrap to allow for that.

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20221105074432.13804-2-luca@z3ntu.xyz%3E
This commit is contained in:
Luca Weiss 2022-11-05 08:44:34 +01:00 committed by Oliver Smith
parent 381a1ca907
commit 4a6c5657d5
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 18 additions and 6 deletions

View File

@ -93,7 +93,8 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
netboot=False,
community=False,
uefi=False,
details=False):
details=False,
enforce_check=True):
logging.debug(f"Check kconfig: {config_path}")
with open(config_path) as handle:
config = handle.read()
@ -126,10 +127,16 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
if uefi:
components["uefi"] = pmb.config.necessary_kconfig_options_uefi
results = [check_config_options_set(config, config_path_pretty,
config_arch, options, component,
pkgver, details)
for component, options in components.items()]
results = []
for component, options in components.items():
result = check_config_options_set(config, config_path_pretty,
config_arch, options, component,
pkgver, details)
# We always enforce "postmarketOS" component and when explicitly
# requested
if enforce_check or component == "postmarketOS":
results += [result]
return all(results)
@ -197,6 +204,10 @@ def check(args, pkgname,
return None
apkbuild = pmb.parse.apkbuild(f"{aport}/APKBUILD")
pkgver = apkbuild["pkgver"]
# We only enforce optional checks for community & main devices
enforce_check = aport.split("/")[-2] in ["community", "main"]
check_waydroid = force_waydroid_check or (
"pmb:kconfigcheck-waydroid" in apkbuild["options"])
check_iwd = force_iwd_check or (
@ -239,7 +250,8 @@ def check(args, pkgname,
netboot=check_netboot,
community=check_community,
uefi=check_uefi,
details=details)
details=details,
enforce_check=enforce_check)
return ret