From 72297749dffee902b00b5aa0338e43d6e355cd88 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 9 Oct 2020 02:49:20 -0700 Subject: [PATCH] [build]: Added support for cache status on the build output (#5564) print cache status when use cached file in the build process Without DPKG cache support : [ building ] [ target/docker-base.gz ] [ finished ] [ target/docker-base.gz ] With DPKG cache support : [ building ] [ target/docker-base.gz ] [ cached ] [ target/docker-base.gz ] extracted from PR 4595 by Kalimuthu Velappan Signed-off-by: Guohan Lu --- rules/functions | 4 ++-- update_screen.sh | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/rules/functions b/rules/functions index 16665029c0..d5aba46fd5 100644 --- a/rules/functions +++ b/rules/functions @@ -64,12 +64,12 @@ define HEADER @ $(PRINT_DEPENDENCIES) $(FLUSH_LOG) -./update_screen.sh -a $@ +./update_screen.sh -a $@ $* endef # footer for each rule define FOOTER -./update_screen.sh -d $@ +./update_screen.sh -d $@ $($*_CACHE_LOADED) endef ############################################################################### diff --git a/update_screen.sh b/update_screen.sh index de54774cc6..af272843d9 100755 --- a/update_screen.sh +++ b/update_screen.sh @@ -28,7 +28,9 @@ done function remove_target { # Check if TERM is available -[[ "${TERM}" == "dumb" ]] && echo "[ finished ] [ $1 ] " && return +local status="finished" +[[ ! -z "${2}" ]] && status="cached" +[[ "${TERM}" == "dumb" ]] && echo "[ ${status} ] [ $1 ] " && return old_list=$(cat ${target_list_file}) rm ${target_list_file} @@ -52,6 +54,17 @@ sleep 2 && print_targets && rm -f .screen & exit 0 } +# $3 takes the DPKG caching argument, if the target is loaded from cache, +# it adds the log as 'cached' else it is logged as 'finished' +# +# Without DPKG cache support : +# [ building ] [ target/docker-base.gz ] +# [ finished ] [ target/docker-base.gz ] +# +# With DPKG cache support : +# [ building ] [ target/docker-base.gz ] +# [ cached ] [ target/docker-base.gz ] + while getopts ":a:d:e:" opt; do case $opt in a) @@ -61,12 +74,12 @@ while getopts ":a:d:e:" opt; do ;; d) scroll_up - remove_target ${OPTARG} + remove_target ${OPTARG} $3 print_targets ;; e) scroll_up - remove_target ${OPTARG} + remove_target ${OPTARG} $3 echo "[ FAIL LOG START ] [ ${OPTARG} ]" cat ${OPTARG}.log echo "[ FAIL LOG END ] [ ${OPTARG} ]"