summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-08-27 20:07:46 +0200
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-08-27 20:07:46 +0200
commit2c358983b2d80e298fdfd4f991bde9de54aa4302 (patch)
treebbdf066eff1ca3ff0c7034f5753db527d38f16ae
parenta7749acadb4bf0523a36e7e66d7e063d6421c75a (diff)
downloadmidipix_build-2c358983b2d80e298fdfd4f991bde9de54aa4302.tar.bz2
midipix_build-2c358983b2d80e298fdfd4f991bde9de54aa4302.tar.xz
subr/{build,pkgtool}_init.subr:{build,pkgtool}p_init_env(): correctly implement messages file loading.
-rw-r--r--subr/build_init.subr30
-rw-r--r--subr/pkgtool_init.subr31
2 files changed, 39 insertions, 22 deletions
diff --git a/subr/build_init.subr b/subr/build_init.subr
index c7669f14..e83e5afd 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -68,7 +68,7 @@ buildp_init_args() {
};
buildp_init_env() {
- local _fname="" _lang="${LANG:-C}" _rc=0; _status=""; _lang="${_lang%%_*}";
+ local _fname="" _lang="${LANG:-C}" _lang_="" _name="" _rc=0; _status=""; _lang="${_lang%%_*}";
if ! cd "${0%/*}"; then
printf "Error: failed to change working directory to \`${0%/*}'." >&2; exit 1;
@@ -80,23 +80,31 @@ buildp_init_env() {
$(find subr.rtl -name *.subr) \
$(find subr -name *.subr) \
etc/build.theme \
- "etc/build.msgs.${_lang}" \
- "etc/rtl.msgs.${_lang}" \
;
do
if ! . "${_fname}"; then
printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
fi;
done;
- for _fname in \
- "etc/build.theme.local" \
- "etc/build.msgs.${_lang}.local" \
- "etc/rtl.msgs.${_lang}.local" \
- ;
- do
- if [ -e "${_fname}" ]; then
- printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
+ if [ -e "etc/build.theme.local" ]; then
+ if ! . "etc/build.theme.local"; then
+ printf "Error: failed to source \`%s'.\n" "etc/build.theme.local" >&2; exit 1;
fi;
+ fi;
+ for _name in build rtl; do
+ for _lang_ in ${_lang} C; do
+ _fname="etc/${_name}.msgs.${_lang_}";
+ if [ -e "${_fname}" ]; then
+ if ! . "${_fname}"; then
+ printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
+ fi;
+ if [ -e "${_fname}.local" ]; then
+ if ! . "${_fname}.local"; then
+ printf "Error: failed to source \`%s'.\n" "${_fname}.local" >&2; exit 1;
+ fi;
+ fi; break;
+ fi;
+ done;
done;
fi; export LANG=C LC_ALL=C; return "${_rc}";
};
diff --git a/subr/pkgtool_init.subr b/subr/pkgtool_init.subr
index 4a90cc2c..9d77d8d9 100644
--- a/subr/pkgtool_init.subr
+++ b/subr/pkgtool_init.subr
@@ -18,7 +18,7 @@ pkgtoolp_init_args() {
};
pkgtoolp_init_env() {
- local _fname="" _lang="${LANG:-C}" _rc=0; _status=""; _lang="${_lang%%_*}";
+ local _fname="" _lang="${LANG:-C}" _name="" _rc=0; _status=""; _lang="${_lang%%_*}";
if ! cd "${0%/*}"; then
printf "Error: failed to change working directory to \`${0%/*}'." >&2; exit 1;
@@ -28,24 +28,33 @@ pkgtoolp_init_env() {
$(find subr.rtl -name *.subr) \
$(find subr -name *.subr) \
etc/pkgtool.theme \
- "etc/pkgtool.msgs.${_lang}" \
- "etc/rtl.msgs.${_lang}" \
;
do
if ! . "${_fname}"; then
printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
fi;
done;
- for _fname in \
- "etc/pkgtool.theme.local" \
- "etc/pkgtool.msgs.${_lang}.local" \
- "etc/rtl.msgs.${_lang}.local" \
- ;
- do
- if [ -e "${_fname}" ]; then
- printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
+ if [ -e "etc/pkgtool.theme.local" ]; then
+ if ! . "etc/pkgtool.theme.local"; then
+ printf "Error: failed to source \`%s'.\n" "etc/pkgtool.theme.local" >&2; exit 1;
fi;
+ fi;
+ for _name in pkgtool rtl; do
+ for _lang_ in ${_lang} C; do
+ _fname="etc/${_name}.msgs.${_lang_}";
+ if [ -e "${_fname}" ]; then
+ if ! . "${_fname}"; then
+ printf "Error: failed to source \`%s'.\n" "${_fname}" >&2; exit 1;
+ fi;
+ if [ -e "${_fname}.local" ]; then
+ if ! . "${_fname}.local"; then
+ printf "Error: failed to source \`%s'.\n" "${_fname}.local" >&2; exit 1;
+ fi;
+ fi; break;
+ fi;
+ done;
done;
+
fi; export LANG=C LC_ALL=C; return "${_rc}";
};