armbian-next: cli: json-info: make errors clearer; don't include logs on success; small fixes

This commit is contained in:
Ricardo Pardini
2023-01-04 10:25:27 +01:00
parent 0e8bddd1e8
commit 6c11914e38
2 changed files with 21 additions and 14 deletions

View File

@@ -69,12 +69,15 @@ def run_armbian_compile_and_parse(path_to_compile_sh, armbian_src_path, compile_
stderr=subprocess.PIPE
)
except subprocess.CalledProcessError as e:
lines_stderr = e.stderr.split("\n")
eprint(
"Error calling Armbian: params: {}, return code: {}, stderr: {}".format(
compile_params, e.returncode, e.stderr.split("\n")[-1]
compile_params, e.returncode,
# the last 5 elements of lines_stderr, joined
"; ".join(lines_stderr[-5:])
)
)
return {"in": compile_params, "out": {}, "logs": e.stderr.split("\n"), "config_ok": False}
return {"in": compile_params, "out": {}, "logs": lines_stderr, "config_ok": False}
if result is not None:
if result.stderr:
@@ -102,7 +105,9 @@ def run_armbian_compile_and_parse(path_to_compile_sh, armbian_src_path, compile_
all_keys[key] = value
return {"in": compile_params, "out": all_keys, "logs": logs, "config_ok": True}
info = {"in": compile_params, "out": all_keys, "config_ok": True}
# info["logs"] = logs
return info
# Find the location of compile.sh, relative to this Python script.
@@ -120,16 +125,16 @@ if not os.path.exists(compile_sh_full_path):
raise Exception("Can't find compile.sh")
common_compile_params = {
"KERNEL_ONLY": "no",
"KERNEL_ONLY": "yes",
"BUILD_MINIMAL": "no",
"DEB_COMPRESS": "none",
"CLOUD_IMAGE": "yes",
"CLEAN_LEVEL": "debs",
"SHOW_LOG": "yes",
"SKIP_EXTERNAL_TOOLCHAINS": "yes",
"CONFIG_DEFS_ONLY": "yes",
# "DEB_COMPRESS": "none",
# "CLOUD_IMAGE": "yes",
# "CLEAN_LEVEL": "debs",
# "SHOW_LOG": "yes",
# "SKIP_EXTERNAL_TOOLCHAINS": "yes",
# "CONFIG_DEFS_ONLY": "yes",
"KERNEL_CONFIGURE": "no",
"EXPERT": "yes"
# "EXPERT": "yes"
}
board_compile_params = {
@@ -161,13 +166,15 @@ def parse_board_file_for_static_info(board_file, board_id):
}
def get_info_for_one_board(board_file, board_name, common_params, board_info):
def get_info_for_one_board(board_file, board_name, common_params, board_info, branch):
# eprint(
# "Getting info for board '{}' branch '{}' in file '{}'".format(
# board_name, common_params["BRANCH"], board_file
# )
# )
board_info = board_info | {"BOARD_DESC_ID": f"{board_name}-{branch}"}
# eprint("Running Armbian bash for board '{}'".format(board_name))
try:
parsed = run_armbian_compile_and_parse(compile_sh_full_path, armbian_src_path,
@@ -203,7 +210,7 @@ if True:
all_params = common_compile_params | board_compile_params | {"BRANCH": possible_branch}
# eprint("Submitting future for board {} with BRANCH={}".format(board, possible_branch))
future = executor.submit(get_info_for_one_board, all_boards[board], board, all_params,
board_info)
board_info, possible_branch)
every_future.append(future)
eprint("Waiting for all futures...")

View File

@@ -51,7 +51,7 @@ for column in columns:
if len(set(values)) == 1:
columns_to_remove.append(column)
eprint("columns with all-identical values: {}".format(len(columns_to_remove)))
eprint("columns with all-identical values: {}: '{}'".format(len(columns_to_remove), columns_to_remove))
# Now actually filter columns, removing columns_to_remove
columns = [column for column in columns if column not in columns_to_remove]