[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 <lguohan@gmail.com>
This commit is contained in:
lguohan 2020-10-09 02:49:20 -07:00 committed by GitHub
parent c1add9a9c5
commit 72297749df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -64,12 +64,12 @@ define HEADER
@ @
$(PRINT_DEPENDENCIES) $(PRINT_DEPENDENCIES)
$(FLUSH_LOG) $(FLUSH_LOG)
./update_screen.sh -a $@ ./update_screen.sh -a $@ $*
endef endef
# footer for each rule # footer for each rule
define FOOTER define FOOTER
./update_screen.sh -d $@ ./update_screen.sh -d $@ $($*_CACHE_LOADED)
endef endef
############################################################################### ###############################################################################

View File

@ -28,7 +28,9 @@ done
function remove_target { function remove_target {
# Check if TERM is available # 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}) old_list=$(cat ${target_list_file})
rm ${target_list_file} rm ${target_list_file}
@ -52,6 +54,17 @@ sleep 2 && print_targets && rm -f .screen &
exit 0 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 while getopts ":a:d:e:" opt; do
case $opt in case $opt in
a) a)
@ -61,12 +74,12 @@ while getopts ":a:d:e:" opt; do
;; ;;
d) d)
scroll_up scroll_up
remove_target ${OPTARG} remove_target ${OPTARG} $3
print_targets print_targets
;; ;;
e) e)
scroll_up scroll_up
remove_target ${OPTARG} remove_target ${OPTARG} $3
echo "[ FAIL LOG START ] [ ${OPTARG} ]" echo "[ FAIL LOG START ] [ ${OPTARG} ]"
cat ${OPTARG}.log cat ${OPTARG}.log
echo "[ FAIL LOG END ] [ ${OPTARG} ]" echo "[ FAIL LOG END ] [ ${OPTARG} ]"