diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-01-12 14:22:14 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-01-12 14:22:14 (EST) |
commit | 1fd419b0d5c18d35ee1d031ee08a8feaf4282fd7 (patch) | |
tree | 438f5047efc8d38f114ff6a16df9ea3e13096c18 /src | |
parent | f9a48ef542e978df9af08e1afbff59287d8af10e (diff) |
cmd/build: Allow logging to be disabled
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/build.sh | 56 |
1 files changed, 32 insertions, 24 deletions
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)|<<SESSION_DIR>>|; - s|$(session_id)|<<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)|<<SESSION_DIR>>|; + s|$(session_id)|<<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 |