-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rules/functions][slave.mk]: Refine build output (#838)
Print current build configuration before run Update screen with currently running targets (only available if TERM is available) Change format of printed targets Signed-off-by: marian-pritsak <[email protected]>
- Loading branch information
1 parent
f136334
commit 7d95fd7
Showing
4 changed files
with
109 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,43 +41,30 @@ log_green = echo -e "$(GREEN)$(1)$(GRAY)" | |
## Logging | ||
############################################################################### | ||
|
||
ifeq ($(SONIC_CONFIG_LOG_TO_FILES),y) | ||
FLUSH_LOG = rm -f [email protected] | ||
|
||
LOG = &>> $(PROJECT_ROOT)/[email protected] || { [ $$? -eq 0 ] || cat $(PROJECT_ROOT)/[email protected] ; false ; } | ||
endif | ||
LOG = &>> $(PROJECT_ROOT)/[email protected] || { [ $$? -eq 0 ] || pushd $(PROJECT_ROOT) > /dev/null ; ./update_screen.sh -e $@ ; popd > /dev/null ; false ; } | ||
|
||
############################################################################### | ||
## Header and footer for each target | ||
############################################################################### | ||
|
||
# Print name of target being built | ||
PRINT_TARGET = $(call log_purple,Executing rules for $@) | ||
|
||
# Print name of target that finished build | ||
PRINT_END_TARGET = $(call log_green,Finished $@) | ||
|
||
# Dump targets taht current depends on | ||
ifeq ($(SONIC_CONFIG_PRINT_DEPENDENCIES),y) | ||
PRINT_DEPENDENCIES = $(call log_blue,Dependencies for $@ are $^) | ||
endif | ||
|
||
# Enable verbose mode | ||
ifneq ($(SONIC_CONFIG_VERBOSE),y) | ||
ENABLE_VERBOSE = @ | ||
PRINT_DEPENDENCIES = echo Dependencies for $@ are $^ $(LOG) | ||
endif | ||
|
||
# header for each rule | ||
define HEADER | ||
$(ENABLE_VERBOSE) | ||
$(PRINT_TARGET) | ||
@ | ||
$(PRINT_DEPENDENCIES) | ||
$(FLUSH_LOG) | ||
./update_screen.sh -a $@ | ||
endef | ||
|
||
# footer for each rule | ||
define FOOTER | ||
$(PRINT_END_TARGET) | ||
./update_screen.sh -d $@ | ||
endef | ||
|
||
############################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
|
||
lockfile .screen | ||
|
||
target_list_file=/tmp/target_list | ||
touch ${target_list_file} | ||
|
||
function scroll_up { | ||
# Check if TERM is available | ||
[[ "${TERM}" == "dumb" ]] && return | ||
|
||
for i in $(cat ${target_list_file}); do | ||
tput cuu1 | ||
tput el | ||
done | ||
} | ||
|
||
function print_targets { | ||
# Check if TERM is available | ||
[[ "${TERM}" == "dumb" ]] && return | ||
|
||
count=1 | ||
for i in $(cat ${target_list_file}); do | ||
printf "[ %02d ] [ %s ]\n" "${count}" "$i" | ||
((count++)) | ||
done | ||
} | ||
|
||
function remove_target { | ||
# Check if TERM is available | ||
[[ "${TERM}" == "dumb" ]] && echo "[ finished ] [ $1 ] " && return | ||
|
||
old_list=$(cat ${target_list_file}) | ||
rm ${target_list_file} | ||
for target in ${old_list}; do | ||
if [[ "${target}" != "$1" ]]; then | ||
echo ${target} >> ${target_list_file} | ||
fi | ||
done | ||
touch ${target_list_file} | ||
} | ||
|
||
function add_target { | ||
# Check if TERM is available | ||
[[ "${TERM}" == "dumb" ]] && echo "[ building ] [ $1 ] " && return | ||
|
||
echo $1 >> ${target_list_file} | ||
} | ||
|
||
function print_targets_delay { | ||
sleep 2 && print_targets && rm -f .screen & | ||
exit 0 | ||
} | ||
|
||
while getopts ":a:d:e:" opt; do | ||
case $opt in | ||
a) | ||
scroll_up | ||
add_target ${OPTARG} | ||
print_targets | ||
;; | ||
d) | ||
scroll_up | ||
remove_target ${OPTARG} | ||
print_targets | ||
;; | ||
e) | ||
scroll_up | ||
remove_target ${OPTARG} | ||
echo "[ FAIL LOG START ] [ ${OPTARG} ]" | ||
cat ${OPTARG}.log | ||
echo "[ FAIL LOG END ] [ ${OPTARG} ]" | ||
print_targets_delay | ||
;; | ||
\?) | ||
echo "Invalid option: -$OPTARG" >&2 | ||
rm -f .screen | ||
exit 1 | ||
;; | ||
:) | ||
echo "Option -$OPTARG requires an argument." >&2 | ||
rm -f .screen | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
rm -f .screen |