linefeeds in info messages fixed

This commit is contained in:
Achim Gsell
2021-03-04 09:31:52 +01:00
parent 459f6b84df
commit cea58bfc60
3 changed files with 58 additions and 45 deletions
+36 -23
View File
@@ -517,7 +517,7 @@ pbuild::prep() {
local i=0
for ((_i = 0; _i < ${#PATCH_FILES[@]}; _i++)); do
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"Appling patch '${PATCH_FILES[_i]}' ..."
local -i strip_val="${PATCH_STRIPS[_i]:-${PATCH_STRIP_DEFAULT}}"
@@ -641,7 +641,7 @@ pbuild::configure() {
"cmake failed"
else
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"${FUNCNAME[0]}: skipping..."
fi
@@ -817,7 +817,7 @@ pbuild::make_all() {
local -r docdir="${PREFIX}/${_DOCDIR}/${module_name}"
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"Installing documentation to ${docdir}"
install -m 0755 -d \
@@ -865,7 +865,7 @@ pbuild::make_all() {
local -r fname="$1"
shift
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"writing run-time dependencies to ${fname} ..."
local dep
@@ -887,7 +887,7 @@ pbuild::make_all() {
# multilib problem with LIBRARY_PATH on 64-bit systems
post_install_linux() {
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"running post-installation for ${OS} ..."
cd "${PREFIX}"
@@ -917,7 +917,7 @@ pbuild::make_all() {
cleanup_build
cleanup_src
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"Done ..."
return 0
@@ -931,7 +931,7 @@ pbuild::make_all() {
find_modulefile src
if (( $? != 0 )); then
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"skipping modulefile installation ..."
return
@@ -946,7 +946,7 @@ pbuild::make_all() {
local -r dstdir=${dst%/*}
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"installing modulefile in '${dstdir}' ..."
mkdir -p "${dstdir}"
@@ -970,7 +970,7 @@ pbuild::make_all() {
read release < "${release_file}"
if [[ "${release}" != "${module_release}" ]]; then
std::info \
"%s %s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"changing release from" \
"'${release}' to '${module_release}' ..."
@@ -978,7 +978,7 @@ pbuild::make_all() {
fi
else
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"setting release to '${module_release}' ..."
echo "${module_release}" > "${release_file}"
@@ -997,7 +997,7 @@ pbuild::make_all() {
"BUILD_DIR is set to '/'"
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"Cleaning up '${BUILD_DIR}'..."
rm -rf "${BUILD_DIR##*/}"
@@ -1015,7 +1015,7 @@ pbuild::make_all() {
"Oops: internal error:" \
"SRC_DIR is set to '/'"
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"Cleaning up '${SRC_DIR}'..."
rm -rf "${SRC_DIR##*/}"
@@ -1071,16 +1071,18 @@ pbuild::make_all() {
# build module ${module_name}/${module_version}
build_module() {
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"start building ..."
"start building" \
${with_modules:+with ${with_modules[@]}} \
"..."
[[ ${dry_run} == yes ]] && std::die 0 ""
mkdir -p "${SRC_DIR}"
mkdir -p "${BUILD_DIR}"
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"preparing sources ..."
# write stdout and stderr to logfile, stderr to terminal
@@ -1089,21 +1091,21 @@ pbuild::make_all() {
[[ "${build_target}" == "prep" ]] && return 0
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"configuring ..."
build_target "${BUILD_DIR}" configure
[[ "${build_target}" == "configure" ]] && return 0
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"compiling ..."
build_target "${BUILD_DIR}" compile
[[ "${build_target}" == "compile" ]] && return 0
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"installing ..."
mkdir -p "${PREFIX}"
@@ -1114,7 +1116,7 @@ pbuild::make_all() {
remove_module() {
if [[ -d "${PREFIX}" ]]; then
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"removing all files in '${PREFIX}' ..."
[[ "${dry_run}" == 'no' ]] && rm -rf ${PREFIX}
@@ -1131,7 +1133,7 @@ pbuild::make_all() {
if [[ -e "${dst}" ]]; then
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"removing modulefile '${dst}' ..."
[[ "${dry_run}" == 'no' ]] && rm -v "${dst}"
@@ -1139,7 +1141,7 @@ pbuild::make_all() {
local release_file="${dstdir}/.release-${module_version}"
if [[ -e "${release_file}" ]]; then
std::info \
"%s %s\n" \
"%s " \
"${module_name}/${module_version}:" \
"removing release file '${release_file}' ..."
[[ "${dry_run}" == 'no' ]] && rm -v "${release_file}"
@@ -1323,7 +1325,7 @@ pbuild.build_module() {
"${m}: module does not exist," \
"cannot continue with dry run..."
std::info "%s\n" \
std::info "%s " \
"$m: module does not exist, trying to build it..."
local args=( '' )
set -- ${ARGS[@]}
@@ -1429,11 +1431,16 @@ pbuild.build_module() {
"since the dependency '$m' is ${release_of_dependency}"
fi
std::info "Loading module: ${m}\n"
std::info "Loading module: ${m}"
eval $( "${MODULECMD}" bash load "${m}" )
done
}
std::info \
"%s " \
"${module_name}/${module_version}:" \
${with_modules:+with ${with_modules[@]}} \
"building ..."
MODULECMD="${PMODULES_HOME}/bin/modulecmd"
[[ -x ${MODULECMD} ]] || \
std::die 2 "No such file or executable -- '${MODULECMD}'"
@@ -1470,6 +1477,12 @@ pbuild.build_module() {
pbuild.init_env "${module_name}" "${module_version}"
pbuild::make_all
std::info \
"%s " \
"${module_name}/${module_version}:" \
${with_modules:+with ${with_modules[@]}} \
"done!"
std::info "* * * * *\n"
}
pbuild.bootstrap() {
+2 -2
View File
@@ -7,8 +7,8 @@ std::log() {
local -ri fd=$1
local -r fmt="$2"
shift 2
printf -- "$fmt" "$@" 1>&$fd
echo
printf -- "${fmt}" "$@" 1>&$fd
printf -- "\n" 1>&$fd
}
std::info() {
+20 -20
View File
@@ -346,7 +346,7 @@ subcommand_load() {
output+="module load ${line[@]:3} ${line[0]}\n"
done < <(subcommand_search "${m}" -a --no-header 2>&1)
if [[ -n "${output}" ]]; then
std::info "\nTry with one of the following command(s):\n"
std::info "\nTry with one of the following command(s):"
std::die 3 "${output}\n"
fi
}
@@ -479,7 +479,7 @@ subcommand_load() {
fi
fi
if [[ ! "${found}" ]]; then
std::info "%s %s: module unavailable -- %s\n" \
std::info "%s %s: module unavailable -- %s" \
"${CMD}" 'load' "${m}"
[[ ${verbosity_lvl} == 'verbose' ]] && output_load_hints
std::die 3 ""
@@ -540,7 +540,7 @@ subcommand_load() {
"${m}")
if [[ ${verbosity_lvl} != silent ]] && \
[[ ${release} != stable ]]; then
std::info "%s\n" "${msg}"
std::info "%s" "${msg}"
fi
logger "${msg}"
done
@@ -803,7 +803,7 @@ subcommand_avail() {
esac
printf "%-20s\t%s\n" "${mod}" "${out}" 1>&2
done
std::info "\n"
std::info ""
}
machine_output() {
@@ -829,7 +829,7 @@ subcommand_avail() {
esac
printf "%-20s\t%s\n" "${mod}" "${out}" 1>&2
done
std::info "\n"
std::info ""
}
human_readable_output() {
@@ -1008,47 +1008,47 @@ subcommand_use() {
print_info() {
local f
local r
std::info "Used groups:\n"
std::info "Used groups:"
for f in ${UsedGroups//:/ }; do
std::info "\t${f}\n"
std::info "\t${f}"
done
std::info "\nUnused groups:\n"
std::info "\nUnused groups:"
local _group
for _group in "${!GroupDepths[@]}"; do
local -i depth=${GroupDepths[${_group}]}
if ! group_is_used "${_group}" && (( depth == 0 )); then
std::info "\t${_group}\n"
std::info "\t${_group}"
fi
done
std::info "\nUsed releases:\n"
std::info "\nUsed releases:"
for r in ${UsedReleases//:/ }; do
std::info "\t${r}\n"
std::info "\t${r}"
done
std::info "\nUnused releases:\n"
std::info "\nUnused releases:"
for r in ${PMODULES_DEFINED_RELEASES//:/ }; do
if ! release_is_used $r; then
std::info "\t${r}\n"
std::info "\t${r}"
fi
done
std::info "\nUsed flags:\n"
std::info "\nUsed flags:"
for flag in "${!UseFlags[@]}"; do
std::info "\t${flag}\n"
std::info "\t${flag}"
done
std::info "\nAdditonal directories in MODULEPATH:\n"
std::info "\nAdditonal directories in MODULEPATH:"
let n=0
for (( i=0; i<${#modulepath[@]}; i++)); do
if [[ ! ${modulepath[i]} =~ ${PMODULES_ROOT} ]]; then
std::info "\t${modulepath[i]}\n"
std::info "\t${modulepath[i]}"
let n+=1
fi
done
if (( n == 0 )); then
std::info "\tnone\n"
std::info "\tnone"
fi
std::info "\n"
std::info ""
}
use () {
@@ -1554,7 +1554,7 @@ subcommand_search() {
out+="$d/"
done
out+="${line[0]}"
std::info "${out}\n"
std::info "${out}"
done < <("${sort}" -k 1,1 -k 4,4 -k 5,5 "${tmpfile}" | \
awk "${with_modules}")
elif [[ "${opt_print_csv}" == "yes" ]]; then