More robust status print ending build step

This commit is contained in:
Stephen Seo 2023-11-17 20:32:12 +09:00
parent 02af05e7a4
commit ba1980afbe

View file

@ -1203,6 +1203,8 @@ def update_pkg_list(
"""For each package to build: builds it, signs it, and moves it to """For each package to build: builds it, signs it, and moves it to
"pkg_out_dir".""" "pkg_out_dir"."""
atexit.register(build_print_pkg_info, pkgs, other_state)
if not get_sudo_privileges(): if not get_sudo_privileges():
log_print( log_print(
"ERROR: Failed to get sudo privileges", other_state=other_state "ERROR: Failed to get sudo privileges", other_state=other_state
@ -1559,17 +1561,6 @@ def update_pkg_list(
), ),
) )
max_name_len = 1
for pkg in pkgs:
if len(pkg) + 1 > max_name_len:
max_name_len = len(pkg) + 1
for pkg in pkgs:
name_space = " " * (max_name_len - len(pkg))
log_print(
f'"{pkg}"{name_space}status: {pkg_state[pkg]["build_status"]}',
other_state=other_state,
)
def get_latest_pkg(pkg: str, cache_dir: str): def get_latest_pkg(pkg: str, cache_dir: str):
"""Gets the latest pkg from the specified "cache_dir" and return its """Gets the latest pkg from the specified "cache_dir" and return its
@ -1656,6 +1647,20 @@ def print_state_info_and_get_update_list(
return to_update return to_update
def build_print_pkg_info(pkgs: tuple[str], other_state: dict[str, any]):
"""Prints the current "build" state of the given pkgs."""
max_name_len = 1
for pkg in pkgs:
if len(pkg) + 1 > max_name_len:
max_name_len = len(pkg) + 1
for pkg in pkgs:
name_space = " " * (max_name_len - len(pkg))
log_print(
f'"{pkg}"{name_space}status: {pkg_state[pkg]["build_status"]}',
other_state=other_state,
)
def test_gpg_passphrase( def test_gpg_passphrase(
signing_gpg_dir: str, signing_key_fp: str, passphrase: str signing_gpg_dir: str, signing_key_fp: str, passphrase: str
): ):