build icon indicating copy to clipboard operation
build copied to clipboard

Display "repeat build options" at the end if process was cancelled

Open iav opened this issue 1 year ago • 6 comments

Description

Currently "Repeat Build Options" shows at the end of screen log only if process was successfully finished.

This change adds "Repeat Build Options" text on the screen at the end of visible log.

iav avatar Mar 08 '24 20:03 iav

Currently "Repeat Build Options" in case of break prints 2 times:

[🐳|🌱] Installing base system with 9 packages [ Stage 1/2 ]
[🐳|🔨]   I: Retrieving InRelease
[🐳|🔨]   I: Checking Release signature
[🐳|🔨]   I: Valid Release signature (key id A7236886F3CCCAAD148A27F80E98404D386FA1D9)
[🐳|🔨]   I: Retrieving Packages
[🐳|🔨]   I: Validating Packages
^C[🐳|🚸] Build interrupted [ Build interrupted by SIGINT ]
[🐳|💥] error! [ Debootstrap first stage failed /armbian/cache/sources/debootstrap-debian-devel/debootstrap trixie  kde-plasma no ]
[🐳|💥] Cleaning up [ please wait for cleanups to finish ]
[🐳|🌿] Unmounting recursively [ SDCARD - be patient ]
[🐳|🌿] Unmounting recursively [ MOUNT - be patient ]
[🐳|✨] Repeat Build Options [ ./compile.sh iav build BOARD=rockpi-4a BUILD_DESKTOP=yes DESKTOP_APPGROUPS_SELECTED= DESKTOP_ENVIRONMENT=kde-plasma DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base RELEASE=trixie ]
[🐳|🌿] ANSI log file built; inspect it by running: [ less -RS output/logs/log-build-bb926850-d130-40d0-afea-83c1f021e422.log.ans ]
[🐳|🌱] SHARE_LOG=yes, uploading log [ uploading logs ]
[🐳|🌿] Log uploaded, share URL: [ https://paste.armbian.com/iqayakawiw ]
[💥] -------------Docker run failed after 27s-------------------------- [ 🐳 failed ]
[🌱] Cleaning up [ please wait for cleanups to finish ]
[✨] Repeat Build Options [ ./compile.sh iav build BOARD=rockpi-4a BUILD_DESKTOP=yes DESKTOP_ENVIRONMENT=kde-plasma DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base RELEASE=trixie ]

Seems print operator added to the wrong place. Please recommend better place to output this info in case of break or error.

iav avatar Mar 08 '24 20:03 iav

IMO better is at the end.

igorpecovnik avatar Mar 08 '24 20:03 igorpecovnik

Confirm, better in the end. But I add one string into one place :) How to avoid one of 2 occurrence — not idea for a while.

iav avatar Mar 08 '24 21:03 iav

How to avoid one of 2 occurrence

Yeah, compare:

[🐳|✨] Repeat Build Options [... ]
...
[✨] Repeat Build Options [ ... ]

One has a whale while the other doesn't. It's the same code running both during the launcher (your actual compile invocation, without the whale) and inside Docker , with the whale).

rpardini avatar Mar 09 '24 08:03 rpardini

Insert print into end entrypoint.sh, after run_cleanup_handlers?

iav avatar Mar 10 '24 04:03 iav

Next try:

diff --git a/lib/functions/cli/entrypoint.sh b/lib/functions/cli/entrypoint.sh
index a1ca19383..0655b446f 100644
--- a/lib/functions/cli/entrypoint.sh
+++ b/lib/functions/cli/entrypoint.sh
@@ -179,4 +179,10 @@ function cli_entrypoint() {
        # Build done, run the cleanup handlers explicitly.
        # This zeroes out the list of cleanups, so it"s not done again when the main script exits normally and trap = 0 runs.
        run_cleanup_handlers
+
+       # Gather repeat build args, included in the logs.
+#      declare -g repeat_args=()
+       produce_repeat_args_array # produces repeat_args
+       declare repeat_args_string="${repeat_args[*]}"
+       display_alert "Repeat Build Options" "${repeat_args[*]}" "ext" # * = expand array, space delimited, single-word.
 }

I see it prints string I use as command line, not string need to repeat build. It's not the same if some parameter entered via menu. Example: command line: ./compile.sh iav BOARD=rockpi-4a BUILD_DESKTOP=yes DESKTOP_ENVIRONMENT= DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base RELEASE= Repeat Build Options: ./compile.sh iav build BOARD=rockpi-4a BUILD_DESKTOP=yes DESKTOP_APPGROUPS_SELECTED='browsers multimedia office remote_desktop' DESKTOP_ENVIRONMENT=kde-plasma DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base RELEASE=jammy

iav avatar Mar 10 '24 17:03 iav