Skip to content

Commit 7229774

Browse files
authored
[build]: Added support for cache status on the build output (sonic-net#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>
1 parent c1add9a commit 7229774

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

rules/functions

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ define HEADER
6464
@
6565
$(PRINT_DEPENDENCIES)
6666
$(FLUSH_LOG)
67-
./update_screen.sh -a $@
67+
./update_screen.sh -a $@ $*
6868
endef
6969

7070
# footer for each rule
7171
define FOOTER
72-
./update_screen.sh -d $@
72+
./update_screen.sh -d $@ $($*_CACHE_LOADED)
7373
endef
7474

7575
###############################################################################

update_screen.sh

+16-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ done
2828

2929
function remove_target {
3030
# Check if TERM is available
31-
[[ "${TERM}" == "dumb" ]] && echo "[ finished ] [ $1 ] " && return
31+
local status="finished"
32+
[[ ! -z "${2}" ]] && status="cached"
33+
[[ "${TERM}" == "dumb" ]] && echo "[ ${status} ] [ $1 ] " && return
3234

3335
old_list=$(cat ${target_list_file})
3436
rm ${target_list_file}
@@ -52,6 +54,17 @@ sleep 2 && print_targets && rm -f .screen &
5254
exit 0
5355
}
5456

57+
# $3 takes the DPKG caching argument, if the target is loaded from cache,
58+
# it adds the log as 'cached' else it is logged as 'finished'
59+
#
60+
# Without DPKG cache support :
61+
# [ building ] [ target/docker-base.gz ]
62+
# [ finished ] [ target/docker-base.gz ]
63+
#
64+
# With DPKG cache support :
65+
# [ building ] [ target/docker-base.gz ]
66+
# [ cached ] [ target/docker-base.gz ]
67+
5568
while getopts ":a:d:e:" opt; do
5669
case $opt in
5770
a)
@@ -61,12 +74,12 @@ while getopts ":a:d:e:" opt; do
6174
;;
6275
d)
6376
scroll_up
64-
remove_target ${OPTARG}
77+
remove_target ${OPTARG} $3
6578
print_targets
6679
;;
6780
e)
6881
scroll_up
69-
remove_target ${OPTARG}
82+
remove_target ${OPTARG} $3
7083
echo "[ FAIL LOG START ] [ ${OPTARG} ]"
7184
cat ${OPTARG}.log
7285
echo "[ FAIL LOG END ] [ ${OPTARG} ]"

0 commit comments

Comments
 (0)