kconfig check: properly test UEVENT_HELPER, LBDAF (!1796)

Add check for UEVENT_HELPER for kernels >= 4.0.0. Change LBDAF check to
be only required for kernels <5.2.0. Adjust the config format and
checking code to support such range specific checks.
This commit is contained in:
Oliver Smith 2019-06-30 15:39:47 +02:00
parent 22b49fe495
commit d13997241c
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 57 additions and 42 deletions

View File

@ -168,20 +168,29 @@ build_cross_native = ["linux-*", "arch-bin-masquerade", "u-boot*"]
# Necessary kernel config options
necessary_kconfig_options = {
"all": {
"ANDROID_PARANOID_NETWORK": False,
"BLK_DEV_INITRD": True,
"DEVTMPFS": True,
"DM_CRYPT": True,
"EXT4_FS": True,
"KINETO_GAN": False,
"PFT": False,
"SYSVIPC": True,
"VT": True,
"USE_VFB": False,
">=0.0.0": { # all versions
"all": { # all arches
"ANDROID_PARANOID_NETWORK": False,
"BLK_DEV_INITRD": True,
"DEVTMPFS": True,
"DM_CRYPT": True,
"EXT4_FS": True,
"KINETO_GAN": False,
"PFT": False,
"SYSVIPC": True,
"VT": True,
"USE_VFB": False,
}
},
"armhf armv7 x86": {
"LBDAF": True
">=4.0.0": {
"all": {
"UEVENT_HELPER": True,
},
},
"<5.2.0": {
"armhf armv7 x86": {
"LBDAF": True
}
}
}

View File

@ -52,6 +52,7 @@ def check(args, pkgname, details=False):
# Read all kernel configs in the aport
ret = True
aport = pmb.helpers.pmaports.find(args, "linux-" + flavor)
pkgver = pmb.parse.apkbuild(args, aport + "/APKBUILD")["pkgver"]
for config_path in glob.glob(aport + "/config-*"):
logging.debug("Check kconfig: " + config_path)
with open(config_path) as handle:
@ -64,34 +65,39 @@ def check(args, pkgname, details=False):
# Loop trough necessary config options, and print a warning,
# if any is missing
path = "linux-" + flavor + "/" + os.path.basename(config_path)
for archs, options in pmb.config.necessary_kconfig_options.items():
if archs != "all":
# Split and check if the device's architecture architecture has special config
# options. If option does not contain the architecture of the device
# kernel, then just skip the option.
architectures = archs.split(" ")
if config_arch not in architectures:
continue
for rule, archs_options in pmb.config.necessary_kconfig_options.items():
# Skip options irrelevant for the current kernel's version
if not pmb.parse.version.check_string(pkgver, rule):
continue
for option, option_value in options.items():
if option_value not in [True, False]:
raise RuntimeError("kconfig check code can only handle"
" True/False right now, given value '" +
str(option_value) + "' is not supported. If you"
" need this, please open an issue.")
if option_value != is_set(config, option):
ret = False
if details:
should = "should" if option_value else "should *not*"
link = ("https://wiki.postmarketos.org/wiki/"
"Kernel_configuration#CONFIG_" + option)
logging.info("WARNING: " + path + ": CONFIG_" + option + " " +
should + " be set. See <" + link +
"> for details.")
else:
logging.warning("WARNING: " + path + " isn't configured"
" properly for postmarketOS, run"
" 'pmbootstrap kconfig check' for"
" details!")
break
for archs, options in archs_options.items():
if archs != "all":
# Split and check if the device's architecture architecture has special config
# options. If option does not contain the architecture of the device
# kernel, then just skip the option.
architectures = archs.split(" ")
if config_arch not in architectures:
continue
for option, option_value in options.items():
if option_value not in [True, False]:
raise RuntimeError("kconfig check code can only handle"
" True/False right now, given value '" +
str(option_value) + "' is not supported. If you"
" need this, please open an issue.")
if option_value != is_set(config, option):
ret = False
if details:
should = "should" if option_value else "should *not*"
link = ("https://wiki.postmarketos.org/wiki/"
"Kernel_configuration#CONFIG_" + option)
logging.info("WARNING: " + path + ": CONFIG_" + option + " " +
should + " be set. See <" + link +
"> for details.")
else:
logging.warning("WARNING: " + path + " isn't configured"
" properly for postmarketOS, run"
" 'pmbootstrap kconfig check' for"
" details!")
break
return ret