pmb.parse.kconfig: remove config_path_pretty

Don't set the config_path_pretty variable and pass it through various
functions until it ends up being used in check_option. This was just the
directory name of the kernel config and the kernel config filename (or
in case of pmbootstrap kconfig check --file, just the same as the
config path).

Instead we can just print the filename of the kernel config, for example
"config-postmarketos-qcom-sdm845.aarch64". It is shorter and already
obvious to which package it belongs.

Reviewed-by: Clayton Craft <clayton@craftyguy.net>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230312151325.1968-3-ollieparanoid@postmarketos.org%3E
This commit is contained in:
Oliver Smith 2023-03-12 16:13:09 +01:00
parent dbe13fa812
commit d14dbd49de
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -42,18 +42,18 @@ def is_in_array(config, option, string):
return False return False
def check_option(component, details, config, config_path_pretty, option, def check_option(component, details, config, config_path, option,
option_value): option_value):
def warn_ret_false(should_str): def warn_ret_false(should_str):
config_name = os.path.basename(config_path)
if details: if details:
logging.warning(f"WARNING: {config_path_pretty}: CONFIG_{option}" logging.warning(f"WARNING: {config_name}: CONFIG_{option} should"
f" should {should_str} ({component}):" f" {should_str} ({component}):"
f" https://wiki.postmarketos.org/wiki/kconfig#CONFIG_{option}") f" https://wiki.postmarketos.org/wiki/kconfig#CONFIG_{option}")
else: else:
logging.warning(f"WARNING: {config_path_pretty} isn't" logging.warning(f"WARNING: {config_name} isn't configured properly"
f" configured properly ({component}), run" f" ({component}), run 'pmbootstrap kconfig check'"
f" 'pmbootstrap kconfig check' for details!") " for details!")
return False return False
if isinstance(option_value, list): if isinstance(option_value, list):
@ -74,7 +74,7 @@ def check_option(component, details, config, config_path_pretty, option,
return True return True
def check_config(config_path, config_path_pretty, config_arch, pkgver, def check_config(config_path, config_arch, pkgver,
waydroid=False, waydroid=False,
iwd=False, iwd=False,
nftables=False, nftables=False,
@ -119,9 +119,8 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
results = [] results = []
for component, options in components.items(): for component, options in components.items():
result = check_config_options_set(config, config_path_pretty, result = check_config_options_set(config, config_path, config_arch,
config_arch, options, component, options, component, pkgver, details)
pkgver, details)
# We always enforce "postmarketOS" component and when explicitly # We always enforce "postmarketOS" component and when explicitly
# requested # requested
if enforce_check or component == "postmarketOS": if enforce_check or component == "postmarketOS":
@ -130,7 +129,7 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver,
return all(results) return all(results)
def check_config_options_set(config, config_path_pretty, config_arch, options, def check_config_options_set(config, config_path, config_arch, options,
component, pkgver, details=False): component, pkgver, details=False):
# Loop through necessary config options, and print a warning, # Loop through necessary config options, and print a warning,
# if any is missing # if any is missing
@ -156,8 +155,8 @@ def check_config_options_set(config, config_path_pretty, config_arch, options,
continue continue
for option, option_value in options.items(): for option, option_value in options.items():
if not check_option(component, details, config, if not check_option(component, details, config, config_path,
config_path_pretty, option, option_value): option, option_value):
ret = False ret = False
if not details: if not details:
break # do not give too much error messages break # do not give too much error messages
@ -229,8 +228,7 @@ def check(args, pkgname,
"elsewhere in the name.") "elsewhere in the name.")
config_arch = config_name_split[1] config_arch = config_name_split[1]
config_path_pretty = f"linux-{flavor}/{os.path.basename(config_path)}" ret &= check_config(config_path, config_arch,
ret &= check_config(config_path, config_path_pretty, config_arch,
pkgver, pkgver,
waydroid=check_waydroid, waydroid=check_waydroid,
iwd=check_iwd, iwd=check_iwd,
@ -289,7 +287,7 @@ def check_file(config_file, waydroid=False, nftables=False,
version = extract_version(config_file) version = extract_version(config_file)
logging.debug(f"Check kconfig: parsed arch={arch}, version={version} from " logging.debug(f"Check kconfig: parsed arch={arch}, version={version} from "
f"file: {config_file}") f"file: {config_file}")
return check_config(config_file, config_file, arch, version, return check_config(config_file, arch, version,
waydroid=waydroid, waydroid=waydroid,
nftables=nftables, nftables=nftables,
containers=containers, containers=containers,