aggregation: fix: don't eat value if empty during bash_string_multiline(); write end-of-file comment; show aggregation bash results if debugging

This commit is contained in:
Ricardo Pardini
2023-03-29 13:16:09 +02:00
committed by Igor Pečovnik
parent fe7a24885b
commit f75b9c110f
3 changed files with 10 additions and 5 deletions

View File

@@ -214,6 +214,7 @@ with open(output_file, "w") as bash, SummarizedMarkdownWriter("aggregation.md",
"AGGREGATED_DESKTOP_BSP_POSTINST", AGGREGATED_DESKTOP_BSP_POSTINST))
bash.write(util.prepare_bash_output_single_string(
"AGGREGATED_DESKTOP_BSP_PREPARE", AGGREGATED_DESKTOP_BSP_PREPARE))
bash.write("\n## End of aggregation output\n");
# 2) @TODO: Some removals... uninstall-inside-cache and such. (debsums case? also some gnome stuff)

View File

@@ -318,14 +318,13 @@ def prepare_bash_output_single_string(output_array_name, merged_list):
"contents"] + "\n" + "### END Source: " + refs_str + "\n\n")
values_list_bash = "\n".join(values_list)
if (len(values_list_bash) == 0):
values_list_bash = "### NO sources found during aggregation.\n"
return bash_string_multiline(output_array_name, values_list_bash)
def bash_string_multiline(var_name, contents):
return f"declare -g {var_name}" + "\n" + (
f"{var_name}=\"$(cat <<-'EOD_{var_name}_EOD'\n" +
f"{contents}\nEOD_{var_name}_EOD\n)\"\n" + "\n"
) + f"declare -r -g {var_name}" + "\n"
return f"declare -g {var_name}\n{var_name}=\"$(cat <<-'EOD_{var_name}_EOD'\n{contents}\nEOD_{var_name}_EOD\n)\"\n\n"
def encode_source_base_path_extra(contents_dict):