Merge pull request #1313 from Pmodules/1312-enhancement-enable-verbose-output-for-make

enhancement: verbose output for make
This commit is contained in:
2025-10-29 17:31:31 +01:00
committed by GitHub
2 changed files with 24 additions and 8 deletions
+21 -5
View File
@@ -634,14 +634,30 @@ pbuild::post_compile() {
:
}
pbuild::compile() {
local -- v_save="$V"
unset V
local -- tmp_v="$V"
local -- restore='no'
local -- tmp_verbose=''
if [[ -v VERBOSE ]]; then
tmp_verbose="${VERBOSE}"
restore='yes'
fi
if (( opt_verbose > 0 )); then
declare -g V=1
declare -g VERBOSE=1
else
unset V
fi
(( JOBS == 0 )) && JOBS=$(_get_num_cores)
/bin/bash -c "${make} -j${JOBS} -e" || \
std::info "CC=$CC"
std::info "CXX=$CXX"
/bin/bash -c "CC=$CC CXX=$CXX ${make} -j${JOBS} -e" || \
std::die 3 \
"%s " "${module_name}/${module_version}:" \
"compilation failed!"
declare -g V="${v_save}"
declare -g V="${tmp_v}"
if [[ "${restore}" == 'yes' ]]; then
VERBOSE="${tmp_verbose}"
fi
}
##############################################################################
@@ -1538,7 +1554,7 @@ _build_module() {
[[ -n "${pkg_version}" ]] || \
die_sub_package_version_missing "${yaml}"
[[ "${opt_verbose}" == 'yes' ]] && \
(( opt_verbose > 0 )) && \
pkg_build_args+=( '--verbose' )
[[ "${opt_debug}" == 'yes' ]] && \
pkg_build_args+=( '--debug' )
+3 -3
View File
@@ -149,7 +149,7 @@ declare -i opt_jobs=0
declare opt_update_modulefiles='no'
declare opt_cleanup_modulefiles='no'
declare opt_system=''
declare opt_verbose='no'
declare -i opt_verbose=0
# array collecting all modules specified on the command line via '--with=module'
declare -a opt_with_modules=()
declare -A opt_with_dict=()
@@ -190,7 +190,7 @@ parse_args() {
;;
-v | --verbose )
trap 'echo "$BASH_COMMAND"' DEBUG
opt_verbose='yes'
(( opt_verbose+=1 ))
echo='echo'
;;
--debug )
@@ -1526,7 +1526,7 @@ parse_args "$@"
#
declare -r logfile="${BUILDBLOCK_DIR}/pbuild.log"
${rm} -f "${logfile}"
if [[ "${opt_verbose}" == 'yes' ]]; then
if (( opt_verbose > 0 )); then
exec > >(${tee} -a "${logfile}")
else
exec > >(${cat} >> "${logfile}")