summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-05-11 10:39:07 +0100
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-05-11 10:39:07 +0100
commitcb9a055f42c023f527e4f97d1a3ec80a44729cf2 (patch)
tree1f9ebe04188154fccb0ecf2d265cc394057d482f /subr
parentbbb50c0f1c15dab6893cfcf695b2a269c41baa62 (diff)
downloadmidipix_build-cb9a055f42c023f527e4f97d1a3ec80a44729cf2.tar.bz2
midipix_build-cb9a055f42c023f527e4f97d1a3ec80a44729cf2.tar.xz
subr/build_init.subr:buildp_init_{args,getopts}(): call rtl_fileop_set_log() as soon as possible.
subr/ex_pkg.subr:ex_pkg_load_vars(): log variable file names at `notice' level. subr/rtl_fileop.subr:rtl_fileop(): implements `source'.
Diffstat (limited to 'subr')
-rw-r--r--subr/build_init.subr18
-rw-r--r--subr/ex_pkg.subr15
-rw-r--r--subr/rtl_fileop.subr6
3 files changed, 24 insertions, 15 deletions
diff --git a/subr/build_init.subr b/subr/build_init.subr
index 5938ecfb..c876919b 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -73,16 +73,6 @@ buildp_init_args() {
*) _rc=1; _status="Error: unknown packages: $(rtl_subst "${_pkg_names_unknown}" " " ", ")"; ;;
esac;
fi;
- if [ "${_rc}" -eq 0 ]; then
- case "${ARG_VERBOSE:-0}" in
- 0) rtl_fileop_set_log 0; rtl_log_set_lvl 0; ;;
- 1) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
- 2) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
- 3) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
- 4) rtl_fileop_set_log 1; rtl_log_set_lvl 3; ;;
- *) _rc=1; _status="Error: invalid verbosity level (max. -vvvv)"; ;;
- esac;
- fi;
fi;
fi;
fi;
@@ -218,6 +208,14 @@ buildp_init_getopts() {
esac;
if [ "${_rc:-0}" -eq 0 ]; then
DEFAULT_BUILD_CPUS="${ARG_PARALLEL}";
+ case "${ARG_VERBOSE:-0}" in
+ 0) rtl_fileop_set_log 0; rtl_log_set_lvl 0; ;;
+ 1) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 2) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 3) rtl_fileop_set_log 0; rtl_log_set_lvl 2; ;;
+ 4) rtl_fileop_set_log 1; rtl_log_set_lvl 3; ;;
+ *) _rc=1; _status="Error: invalid verbosity level (max. -vvvv)"; ;;
+ esac;
fi;
fi;
fi;
diff --git a/subr/ex_pkg.subr b/subr/ex_pkg.subr
index 4b88622c..317bd725 100644
--- a/subr/ex_pkg.subr
+++ b/subr/ex_pkg.subr
@@ -105,7 +105,7 @@ ex_pkg_load_dump() {
# Return: zero (0) on success, non-zero (>0) on failure, build variables post-return on success.
#
ex_pkg_load_vars() {
- local _rc=0; _status="";
+ local _rc=0 _fname=""; _status="";
if ! rtl_lmatch "${ARCH}" "nt32 nt64"; then
_rc=1; _status="Error: invalid architecture \`${ARCH}'.";
elif ! rtl_lmatch "${BUILD_KIND}" "debug release"; then
@@ -114,9 +114,16 @@ ex_pkg_load_vars() {
nt32) DEFAULT_TARGET="i686-nt32-midipix"; ;;
nt64) DEFAULT_TARGET="x86_64-nt64-midipix"; ;;
esac;
- rtl_fileop source_opt \
- "${HOME}/midipix_build.vars" "${HOME}/.midipix_build.vars" \
- ../midipix_build.vars ./midipix.env;
+ for _fname in \
+ "${HOME}/midipix_build.vars" \
+ "${HOME}/.midipix_build.vars" \
+ ../midipix_build.vars \
+ ./midipix.env; do
+ if [ -r "${_fname}" ]; then
+ rtl_log_msg notice "Sourcing \`%s'." "${_fname}";
+ rtl_fileop source "${_fname}";
+ fi;
+ done;
if [ -z "${PREFIX}" ]; then
_rc=1; _status="Error: \${PREFIX} empty or unset.";
fi;
diff --git a/subr/rtl_fileop.subr b/subr/rtl_fileop.subr
index 64538c59..dd82311e 100644
--- a/subr/rtl_fileop.subr
+++ b/subr/rtl_fileop.subr
@@ -92,7 +92,7 @@ rtl_fileop() {
rtlp_fileop_log "Moving \`${1}' to \`${2}' w/ -fs";
mv -f -- "${1}" "${2}"; _rc="${?}";
fi; ;;
- mkdir|mkfifo|rm|source_opt|test|touch)
+ mkdir|mkfifo|rm|source|source_opt|test|touch)
while [ \( "${?}" -eq 0 \) -a \( ""${#}"" -gt 0 \) ]; do
if [ -z "${1}" ]; then
rtl_log_msg fatalexit "Missing parameters (in: %s %s.)" "${_op}" "${*}";
@@ -117,6 +117,10 @@ rtl_fileop() {
&& rtlp_fileop_check "${PREFIX:-}" "${1}"; then
rtlp_fileop_log "Removing directory or file \`${1}'.";
rm -rf -- "${1}"; _rc="${?}";
+ elif [ "${_op}" = source ]\
+ && rtlp_fileop_check "${PREFIX:-}" "${1}"; then
+ rtlp_fileop_log "Sourcing file \`${1}'.";
+ . "${1}"; _rc="${?}";
elif [ "${_op}" = source_opt ]\
&& rtl_fileop test "${1}"\
&& rtlp_fileop_check "${PREFIX:-}" "${1}"; then