From 3961f3d554a2ac9f6d0477ffb0dc539e7842d676 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Nov 22 2017 21:10:58 +0000 Subject: build.sh:-R: always print/don't print std{out,err} logs for failed packages. build.sh:-vv: always print/don't print stdout logs for successfully built packages. subr/ex_rtl_fileop.subr:ex_build_fileop(): log at vvvo (-vvv.) subr/ex_rtl_log.subr, vars/env.vars: removes [vw]arn, separates info & {vnfo,vvfo,vvvo}. var/env.vars:${CLEAR_ENV_VARS_EXCEPT}: adds ARG_VERBOSE[23]. --- diff --git a/build.sh b/build.sh index bfd435d..d26ab7d 100755 --- a/build.sh +++ b/build.sh @@ -16,19 +16,27 @@ for BUILD_TARGET_META in invariants ${BUILD_TARGETS_META:-world}; do BUILD_PACKAGES="$(ex_lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")"; fi; for PKG_NAME in ${BUILD_PACKAGES}; do - ex_log_msg vnfo "Starting \`${PKG_NAME}' build..."; + ex_log_msg info "Starting \`${PKG_NAME}' build..."; ex_pkg_dispatch "${BUILD_TARGET}" "${PKG_NAME}" \ "${ARG_RESTART}" "${ARG_RESTART_AT}"; BUILD_SCRIPT_RC=${?}; case ${BUILD_SCRIPT_RC} in - 0) ex_log_msg succ "Finished \`${PKG_NAME}' build."; - : $((BUILD_NFINI+=1)); continue; ;; - *) ex_log_msg fail "Build failed in \`${PKG_NAME}', check \`${WORKDIR}/${PKG_NAME}_std{err,out}.log' for details."; - : $((BUILD_NFAIL+=1)); - if [ ${ARG_RELAXED:-0} -eq 1 ]; then + 0) : $((BUILD_NFINI+=1)); + if [ "${ARG_VERBOSE2:-0}" -eq 1 ]; then + cat "${WORKDIR}/${PKG_NAME}_stdout.log"; + fi; + ex_log_msg succ "Finished \`${PKG_NAME}' build."; ;; + *) : $((BUILD_NFAIL+=1)); + if [ "${ARG_RELAXED:-0}" -eq 1 ]; then + ex_log_msg fail "Build failed in \`${PKG_NAME}', check \`${WORKDIR}/${PKG_NAME}_std{err,out}.log' for details."; BUILD_PKGS_FAILED="${BUILD_PKGS_FAILED:+${BUILD_PKGS_FAILED} }${PKG_NAME}"; continue; else + ex_log_msg fail "${WORKDIR}/${PKG_NAME}_stdout.log:"; + cat "${WORKDIR}/${PKG_NAME}_stdout.log"; + ex_log_msg fail "${WORKDIR}/${PKG_NAME}_stderr.log:"; + cat "${WORKDIR}/${PKG_NAME}_stderr.log"; + ex_log_msg fail "Build failed in \`${PKG_NAME}'."; break; fi; ;; esac; diff --git a/subr/ex_rtl_fileop.subr b/subr/ex_rtl_fileop.subr index 3732ab5..9cf4423 100644 --- a/subr/ex_rtl_fileop.subr +++ b/subr/ex_rtl_fileop.subr @@ -5,16 +5,16 @@ ex_build_fileop() { local _op="${1}"; shift; if [ "${_op}" = cd ]; then - ex_log_msg varn "Changing working directory to \`${1}'."; + ex_log_msg vvvo "Changing working directory to \`${1}'."; [ \( -n "${1}" \) -a \( -L "${1}" -o -e "${1}" \) ] && cd -- "${1}"; elif [ "${_op}" = cp ]; then - ex_log_msg varn "Copying \`${1}' to \`${2}' w/ -pPR."; + ex_log_msg vvvo "Copying \`${1}' to \`${2}' w/ -pPR."; [ ${#} -ge 2 ] && cp -pPR -- "${@}"; elif [ "${_op}" = ln_symbolic ]; then - ex_log_msg varn "Linking \`${1}' to \`${2}' w/ -fs"; + ex_log_msg vvvo "Linking \`${1}' to \`${2}' w/ -fs"; [ \( -n "${1}" \) -a \( -n "${2}" \) ] && ln -fs -- "${1}" "${2}"; elif [ "${_op}" = mv ]; then - ex_log_msg varn "Moving \`${1}' to \`${2}' w/ -fs"; + ex_log_msg vvvo "Moving \`${1}' to \`${2}' w/ -fs"; [ \( -n "${1}" \) -a \( -n "${2}" \) ] && mv -f -- "${1}" "${2}"; elif [ "${_op}" = mkdir ]\ || [ "${_op}" = rm ]; then @@ -23,11 +23,11 @@ ex_build_fileop() { return 1; elif [ "${_op}" = mkdir ]\ && [ ! -e "${1}" ]; then - ex_log_msg varn "Making directory \`${1}'."; + ex_log_msg vvvo "Making directory \`${1}'."; mkdir -p -- "${1}"; elif [ "${_op}" = rm ]\ && [ \( -L "${1}" \) -o \( -e "${1}" \) ]; then - ex_log_msg varn "Removing directory or file \`${1}'."; + ex_log_msg vvvo "Removing directory or file \`${1}'."; rm -rf -- "${1}"; fi; shift; done; diff --git a/subr/ex_rtl_log.subr b/subr/ex_rtl_log.subr index 31d5cea..c44085a 100644 --- a/subr/ex_rtl_log.subr +++ b/subr/ex_rtl_log.subr @@ -26,22 +26,20 @@ ex_log_msg() { && [ ${ARG_VERBOSE:-0} -eq 0 ]; then return; elif [ "${_lvl}" = vvfo ]\ - && [ ${ARG_VERBOSE1:-0} -eq 0 ]; then + && [ ${ARG_VERBOSE2:-0} -eq 0 ]; then return; elif [ "${_lvl}" = vvvo ]\ - && [ ${ARG_VERBOSE2:-0} -eq 0 ]; then + && [ ${ARG_VERBOSE3:-0} -eq 0 ]; then return; fi; case "${_lvl}" in failexit) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;; fail) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;; info) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; - vnfo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; - vvfo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; - vvvo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; + vnfo) printf "\033[0m\033[${LOG_MSG_VNFO_COLOUR}m"; ;; + vvfo) printf "\033[0m\033[${LOG_MSG_VVFO_COLOUR}m"; ;; + vvvo) printf "\033[0m\033[${LOG_MSG_VVVO_COLOUR}m"; ;; succ) printf "\033[0m\033[${LOG_MSG_SUCC_COLOUR}m"; ;; - warn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;; - varn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;; esac; if [ ${#} -gt 1 ]; then printf "==> %s %s %s\033[0m\n" "$(ex_date)" "${1}" "$*"; diff --git a/subr/pkg_fetch_wget.subr b/subr/pkg_fetch_wget.subr index 731354e..95fdc08 100644 --- a/subr/pkg_fetch_wget.subr +++ b/subr/pkg_fetch_wget.subr @@ -22,7 +22,7 @@ pkgp_fetch_wget() { if [ "${ARG_IGNORE_SHA256SUMS:-0}" -eq 0 ]; then ex_log_msg failexit "Error: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; else - ex_log_msg warn "Warning: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; + ex_log_msg vnfo "Warning: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; fi; fi; fi; diff --git a/vars/env.vars b/vars/env.vars index cac525c..4177542 100644 --- a/vars/env.vars +++ b/vars/env.vars @@ -33,7 +33,7 @@ MAKEFLAGS_BUILD_EXTRA MAKEFLAGS_INSTALL MAKEFLAGS_INSTALL_EXTRA NO_LOG_VARS PREFIX_EXTRA SHA256SUM SLIBTOOL SUBDIR TARGET URL URL_TYPE URLS_GIT VERSION"}; -: ${CLEAR_ENV_VARS_EXCEPT:="ARG_VERBOSE DEFAULT_GITROOT_HEAD HOME PATH SHELL TERM TARBALL_SIGN_GPG_KEY USER"}; +: ${CLEAR_ENV_VARS_EXCEPT:="ARG_VERBOSE ARG_VERBOSE2 ARG_VERBOSE3 DEFAULT_GITROOT_HEAD HOME PATH SHELL TERM TARBALL_SIGN_GPG_KEY USER"}; : ${CLEAR_PREFIX_DIRS:="bin i686-nt32-midipix include lib lib64 libexec minipix native share tmp x86_64-nt64-midipix"}; # Default flags @@ -65,8 +65,10 @@ PREFIX PREFIX_NATIVE PREFIX_CROSS WORKDIR"}; : ${LOG_MSG_FAIL_COLOUR:=91}; : ${LOG_MSG_INFO_COLOUR:=93}; +: ${LOG_MSG_VNFO_COLOUR:=96}; +: ${LOG_MSG_VVFO_COLOUR:=96}; +: ${LOG_MSG_VVVO_COLOUR:=96}; : ${LOG_MSG_SUCC_COLOUR:=92}; -: ${LOG_MSG_WARN_COLOUR:=96}; : ${TARBALL_CROSS_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}_cross.}; : ${TARBALL_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}.}; : ${TARBALL_MINIPIX_FNAME_PREFIX:=minipix-${ARCH}-${BUILD}.};