Skip to content
Snippets Groups Projects
Verified Commit ea697ea1 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

compile_pkgs: replace separate debug variables with one generic

We in the end have only one place where we use those variables. It is
cleaner to have them specified directly by appropriate tool.
parent 890a6874
No related branches found
No related tags found
2 merge requests!377Turris OS 5.2 (HBK),!208compile_pkgs: split force-make to separate script
......@@ -92,11 +92,7 @@ openwrt_feed
# Technical variables
declare -A available_commands # Set of all commands defined in this script
mirror_updated="" # Variable signaling that mirrors were update in this run already
# Variables set by _enable_debug function
perl_debug=""
sh_debug=""
make_debug=""
owrt_debug=""
debug="" # set when debug on executed scripts should be enabled
# OpenWRT directory for temporally data
export TMPDIR="${build_dir}/tmp"
......@@ -112,35 +108,29 @@ _git() {
}
_sh() {
sh $sh_debug "$@"
sh ${debug:+-x} "$@"
}
_perl() {
perl $perl_debug "$@"
perl ${debug:+-d:Trace} "$@"
}
_make() {
make $make_debug "$@"
make ${debug:+-d} "$@"
}
# Make for OpenWRT
_openwrt_make() {
local mk=("make" -j "$BUILD_JOBS")
[ -z "$FORCE" ] || mk=("$src_dir/helpers/force-make" "-j" "$BULD_JOBS" "-c" "$FORCE" "-f" "V=s" "--")
local args=( "IGNORE_ERRORS=m" "BUILD_LOG=1" )
[ -z "$owrt_debug" ] || args+=( "$owrt_debug" )
[ "${#BUILD_ARGS[@]}" -eq 0 ] || args+=( "${BUILD_ARGS[@]}" )
"${mk[@]}" $make_debug "${args[@]}" "$@"
}
local mk
if [ -z "$FORCE" ]; then
mk=("make" -j "$BUILD_JOBS")
else
mk=("$src_dir/helpers/force-make" "-j" "$BULD_JOBS" "-c" "$FORCE" "-f" "V=s" "--")
fi
_enable_debug() {
set -x
perl_debug="-d:Trace"
make_debug="-d"
sh_debug="-x"
owrt_debug="V=s"
"${mk[@]}" ${debug:+-d} \
"IGNORE_ERRORS=m" "BUILD_LOG=1" ${debug:+V=s} "${BUILD_ARGS[@]}" \
"$@"
}
# Definition of avaliable commands ###############################################
......@@ -585,7 +575,7 @@ while [ $# -gt 0 ]; do
CLONE_DEEP="y"
;;
-x)
_enable_debug
debug="y"
;;
-h|--help)
print_help
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment