From 1fd419b0d5c18d35ee1d031ee08a8feaf4282fd7 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 12 Jan 2021 14:22:14 -0500 Subject: cmd/build: Allow logging to be disabled --- (limited to 'src/cmd') diff --git a/src/cmd/build.sh b/src/cmd/build.sh index a3e903b..dd89848 100644 --- a/src/cmd/build.sh +++ b/src/cmd/build.sh @@ -211,12 +211,12 @@ cmd_build_main() local build_plat= local host_arch= local host_plat= + local log= local opts= local opt= local source= local version= local dist= - local log= local es= if [ ${#} -lt 2 ]; then @@ -242,11 +242,13 @@ cmd_build_main() build_plat="$(cat -- "${root}/etc/proteanos_plat")" host_arch="${build_arch}" host_plat="${build_plat}" + log=true opts='' - while getopts "${opkbuild_optstring}" opt 2>/dev/null; do + while getopts "l${opkbuild_optstring}" opt 2>/dev/null; do case "${opt}" in a) host_arch="${OPTARG}";; p) host_plat="${OPTARG}";; + l) log=false;; *) opts="${opts}${opt} " eval "opt_${opt}_set=\"\${OPTARG:+set}\"" @@ -297,31 +299,37 @@ cmd_build_main() return 2 fi - read -r source version dist <<-EOF - $(package_get_name_version_dist) - EOF - log="${_cmd_build_pkg_dir}/../$(: \ - )${source}_${version}_${host_arch}_${host_plat}.log" - es=0 - { + if ${log}; then + read -r source version dist <<-EOF + $(package_get_name_version_dist) + EOF + log="${_cmd_build_pkg_dir}/../$(: \ + )${source}_${version}_${host_arch}_${host_plat}.log" { { - set +e - _cmd_build_build \ - "${build_arch}" "${build_plat}" \ - "${host_arch}" "${host_plat}" \ - "${dist}" "${@}" 2>&1 - printf '%d' ${?} 1>&3 - } | sed "/^Filter: /!{ - s|$(session_dir)|<>|; - s|$(session_id)|<>|; - };" | tee "${log}" 1>&2 - } 3>&1 | { - read es - exit ${es} - } - } 2>&1 || es=${?} + { + set +e + _cmd_build_build \ + "${build_arch}" "${build_plat}"\ + "${host_arch}" "${host_plat}" \ + "${dist}" "${@}" 2>&1 + printf '%d' ${?} 1>&3 + } | sed "/^Filter: /!{ + s|$(session_dir)|<>|; + s|$(session_id)|<>|; + };" | tee "${log}" 1>&2 + } 3>&1 | { + read es + exit ${es} + } + } 2>&1 || es=${?} + else + _cmd_build_build \ + "${build_arch}" "${build_plat}" \ + "${host_arch}" "${host_plat}" \ + "${dist}" "${@}" + fi session_end -- cgit v0.9.1