kconfig check: move check_config_options_set up
In this file and throughout most of the rest of the pmbootstrap code, functions that get called by other functions are defined on top of them if they are in the same file. check_config_options_set gets called by check_config, so put it above. Reviewed-by: Clayton Craft <clayton@craftyguy.net> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230312151325.1968-7-ollieparanoid@postmarketos.org%3E
This commit is contained in:
parent
fd1b4e5d19
commit
23014ef76f
|
@ -91,6 +91,40 @@ def check_option(component, details, config, config_path, option,
|
|||
return True
|
||||
|
||||
|
||||
def check_config_options_set(config, config_path, config_arch, options,
|
||||
component, pkgver, details=False):
|
||||
# Loop through necessary config options, and print a warning,
|
||||
# if any is missing
|
||||
ret = True
|
||||
for rules, archs_options in options.items():
|
||||
# Skip options irrelevant for the current kernel's version
|
||||
# Example rules: ">=4.0 <5.0"
|
||||
skip = False
|
||||
for rule in rules.split(" "):
|
||||
if not pmb.parse.version.check_string(pkgver, rule):
|
||||
skip = True
|
||||
break
|
||||
if skip:
|
||||
continue
|
||||
|
||||
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 not check_option(component, details, config, config_path,
|
||||
option, option_value):
|
||||
ret = False
|
||||
if not details:
|
||||
break # do not give too much error messages
|
||||
return ret
|
||||
|
||||
|
||||
def check_config(config_path, config_arch, pkgver, components_list=[],
|
||||
details=False, enforce_check=True):
|
||||
"""
|
||||
|
@ -147,40 +181,6 @@ def check_config(config_path, config_arch, pkgver, components_list=[],
|
|||
return all(results)
|
||||
|
||||
|
||||
def check_config_options_set(config, config_path, config_arch, options,
|
||||
component, pkgver, details=False):
|
||||
# Loop through necessary config options, and print a warning,
|
||||
# if any is missing
|
||||
ret = True
|
||||
for rules, archs_options in options.items():
|
||||
# Skip options irrelevant for the current kernel's version
|
||||
# Example rules: ">=4.0 <5.0"
|
||||
skip = False
|
||||
for rule in rules.split(" "):
|
||||
if not pmb.parse.version.check_string(pkgver, rule):
|
||||
skip = True
|
||||
break
|
||||
if skip:
|
||||
continue
|
||||
|
||||
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 not check_option(component, details, config, config_path,
|
||||
option, option_value):
|
||||
ret = False
|
||||
if not details:
|
||||
break # do not give too much error messages
|
||||
return ret
|
||||
|
||||
|
||||
def check(args, pkgname, components_list=[], details=False, must_exist=True):
|
||||
"""
|
||||
Check for necessary kernel config options in a package.
|
||||
|
|
Loading…
Reference in New Issue