diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-01-12 14:26:02 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-01-12 14:26:02 (EST) |
commit | 84b7fa4a5b0133f6f9e8e16d47d3a77bcf5e80b1 (patch) | |
tree | 4c3c8f22620214160749e61f75f1065aba448702 /src/cmd | |
parent | 1fd419b0d5c18d35ee1d031ee08a8feaf4282fd7 (diff) |
cmd/build: Don't print build info if not logging
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/build.sh | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/cmd/build.sh b/src/cmd/build.sh index dd89848..466e650 100644 --- a/src/cmd/build.sh +++ b/src/cmd/build.sh @@ -101,12 +101,13 @@ _cmd_build_fini() _cmd_build_build() { - local build_arch="${1}" - local build_plat="${2}" - local host_arch="${3}" - local host_plat="${4}" - local dist="${5}" - shift 5 + local log="${1}" + local build_arch="${2}" + local build_plat="${3}" + local host_arch="${4}" + local host_plat="${5}" + local dist="${6}" + shift 6 local build_date= local es= local changes= @@ -114,14 +115,16 @@ _cmd_build_build() local opk= local build_time= - build_date="$(LC_ALL='C' date '+%a, %d %b %Y %H:%M:%S %z')" - build_time=$(_cmd_build_time) + if ${log}; then + build_date="$(LC_ALL='C' date '+%a, %d %b %Y %H:%M:%S %z')" + build_time=$(_cmd_build_time) - printf '%s (%s) %s\n' "${0##*/}" "${PACKAGE_NAME}" "${PACKAGE_VERSION}" - _cmd_build_header '=' '%-47s %31s' \ - "${source} (${version})" "${build_date}" + printf '%s (%s) %s\n' \ + "${0##*/}" "${PACKAGE_NAME}" "${PACKAGE_VERSION}" + _cmd_build_header '=' '%-47s %31s' \ + "${source} (${version})" "${build_date}" - cat <<-EOF + cat <<-EOF Source: ${source} Version: ${version} Build-Architecture: ${build_arch} @@ -133,10 +136,11 @@ _cmd_build_build() Filter: Replacing "$(session_dir)" with "<<SESSION_DIR>>" Filter: Replacing "$(session_id)" with "<<SESSION_ID>>" EOF + fi es=0 - _cmd_build_header '-' 'Install Build Dependencies' + ${log} && _cmd_build_header '-' 'Install Build Dependencies' _cmd_build_build_deps="$(package_get_build_deps \ "${host_arch}" "${host_plat}")" if [ "x${_cmd_build_build_deps}" != 'x' ]; then @@ -150,17 +154,21 @@ _cmd_build_build() fi fi - _cmd_build_header '-' 'Installed Packages' + ${log} && _cmd_build_header '-' 'Installed Packages' session_exec opkg list-installed || es=${?} - _cmd_build_header '-' 'Build' + ${log} && _cmd_build_header '-' 'Build' if [ ${es} -eq 0 ]; then session_exec opkbuild "${@}" || es=${?} fi - _cmd_build_header '-' 'Remove Build Dependencies' + ${log} && _cmd_build_header '-' 'Remove Build Dependencies' _cmd_build_fini + if ! ${log}; then + return ${es} + fi + changes="${_cmd_build_pkg_dir}/../$(: \ )${source}_${version}_${host_arch}_${host_plat}.changes" if [ -r "${changes}" ]; then @@ -310,7 +318,7 @@ cmd_build_main() { { set +e - _cmd_build_build \ + _cmd_build_build true \ "${build_arch}" "${build_plat}"\ "${host_arch}" "${host_plat}" \ "${dist}" "${@}" 2>&1 @@ -325,7 +333,7 @@ cmd_build_main() } } 2>&1 || es=${?} else - _cmd_build_build \ + _cmd_build_build false \ "${build_arch}" "${build_plat}" \ "${host_arch}" "${host_plat}" \ "${dist}" "${@}" |