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
1 changed files with 15 additions and 17 deletions

View File

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