diff options
author | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2021-08-26 20:39:04 +0200 |
---|---|---|
committer | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2021-08-26 20:39:04 +0200 |
commit | e493dc0247f05ee9f700d50e8ddaa09b5a1ab06a (patch) | |
tree | 15c6ed9e48f3cf820b4e1f46008ee425a05128ce /subr | |
parent | ff862f04542067e8edea1ffb5a6f5527d975172c (diff) | |
download | midipix_build-e493dc0247f05ee9f700d50e8ddaa09b5a1ab06a.tar.bz2 midipix_build-e493dc0247f05ee9f700d50e8ddaa09b5a1ab06a.tar.xz |
Implements localised message files.
Diffstat (limited to 'subr')
-rw-r--r-- | subr/build_init.subr | 23 | ||||
-rw-r--r-- | subr/ex_pkg.subr | 6 | ||||
-rw-r--r-- | subr/ex_pkg_dispatch.subr | 4 | ||||
-rw-r--r-- | subr/ex_pkg_env.subr | 2 | ||||
-rw-r--r-- | subr/pkg_fetch_download.subr | 2 | ||||
-rw-r--r-- | subr/pkg_install_files.subr | 2 | ||||
-rw-r--r-- | subr/pkgtool_init.subr | 26 |
7 files changed, 40 insertions, 25 deletions
diff --git a/subr/build_init.subr b/subr/build_init.subr index 13819de6..c7669f14 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -68,7 +68,7 @@ buildp_init_args() { }; buildp_init_env() { - local _fname="" _rc=0; _status=""; + local _fname="" _lang="${LANG:-C}" _rc=0; _status=""; _lang="${_lang%%_*}"; if ! cd "${0%/*}"; then printf "Error: failed to change working directory to \`${0%/*}'." >&2; exit 1; @@ -80,18 +80,25 @@ 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; - 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; + 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; fi; - fi; - fi; return "${_rc}"; + done; + fi; export LANG=C LC_ALL=C; return "${_rc}"; }; buildp_init_files() { @@ -119,8 +126,8 @@ buildp_init_files() { fi; rtl_fileop touch "${DEFAULT_BUILD_LOG_FNAME}"; rtl_log_set_fname "${DEFAULT_BUILD_LOG_FNAME}"; if rtl_lmatch "${ARG_CLEAN_BUILDS}" "prefix" ","; then - trap "rm -f \"${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}\" 2>/dev/null; rtl_log_msg \"fatalexit\" \"Build aborted.\"" HUP INT TERM USR1 USR2; - rtl_log_msg "info" "-C prefix specified, cleaning prefix..."; + trap "rm -f \"${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}\" 2>/dev/null; rtl_log_msg \"fatalexit\" \"${MSG_build_aborted}\"" HUP INT TERM USR1 USR2; + rtl_log_msg "info" "${MSG_build_clean_prefix}"; for _pname in ${DEFAULT_CLEAR_PREFIX_PATHS}; do if ! rtl_fileop rm "${PREFIX}/${_pname}"; then _rc=1; _status="failed to remove \`${PREFIX}/${_pname}'."; break; diff --git a/subr/ex_pkg.subr b/subr/ex_pkg.subr index f8267f54..e8e3ecb4 100644 --- a/subr/ex_pkg.subr +++ b/subr/ex_pkg.subr @@ -21,7 +21,7 @@ ex_pkg_check_depends() { if ! rtl_lmatch "${_pkg_disabled}" "${_pkg_name_depend}"\ && ! rtl_lmatch "${_pkg_finished}" "${_pkg_name_depend}"; then if ! rtl_lmatch "${_pkg_names}" "${_pkg_name_depend}"; then - rtl_log_msg "fatalexit" "Error: dependency \`%s' of \`%s' unknown." "${_pkg_name_depend}" "${_pkg_name}"; + rtl_log_msg "fatalexit" "${MSG_build_unknown_dep}" "${_pkg_name_depend}" "${_pkg_name}"; else _dependfl=1; break; fi; @@ -78,8 +78,8 @@ ex_pkg_get_packages() { ex_pkg_load_dump() { local _pkg_name="${1}" _workdir="${2}" _rc=0; _status=""; if [ ! -e "${_workdir}/${_pkg_name}.dump" ]; then - rtl_log_msg "warning" "Warning: failed to locate environment dump for package \`%s' in \`%s'." "${_pkg_name}" "${_workdir}"; - rtl_log_msg "info" "Rebuilding package \`%s' w/ --dump-in build..." "${_pkg_name}"; + rtl_log_msg "warning" "${MSG_pkgtool_no_env_dump}" "${_pkg_name}" "${_workdir}"; + rtl_log_msg "info" "${MSG_pkgtool_rebuilding_pkg}" "${_pkg_name}"; (export ARCH BUILD_KIND BUILD_DLCACHEDIR BUILD_WORKDIR \ PREFIX PREFIX_CROSS PREFIX_MINGW32 PREFIX_MINIPIX \ PREFIX_NATIVE PREFIX_ROOT PREFIX_RPM; diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr index f91f536b..139cf94e 100644 --- a/subr/ex_pkg_dispatch.subr +++ b/subr/ex_pkg_dispatch.subr @@ -230,10 +230,10 @@ ex_pkg_dispatch() { _perc_group="$(rtl_percentage "${EXP_PKG_DISPATCH_GROUP_CUR}" "${EXP_PKG_DISPATCH_GROUP_MAX}")"; if "${_dispatch_fn}" start_group "${_group_name}" "" "${EXP_PKG_DISPATCH_GROUP_CUR}" "${EXP_PKG_DISPATCH_GROUP_MAX}" "${_perc_group}"; then if rtl_fileop mkdir "${_workdir}"\ - && rtl_log_msg "verbose" "Resolving \`%s' dependencies..." "${_group_name}"\ + && rtl_log_msg "verbose" "${MSG_build_resolving_deps}" "${_group_name}"\ && exp_pkg_dispatch_expand_packages "${_checkfl}" "${_forcefl}" "${_group_name}" "${_restart}" "${_reversefl}"\ && exp_pkg_dispatch_complete "${_dispatch_fn}" "${_group_name}" "${EX_PKG_DISABLED}" "${EX_PKG_FINISHED}"\ - && rtl_log_msg "verbose" "Resolved \`%s' dependencies." "${_group_name}"\ + && rtl_log_msg "verbose" "${MSG_build_resolved_deps}" "${_group_name}"\ && EXP_PKG_DISPATCH_COUNT_MAX="$(rtl_llength "${EX_PKG_NAMES}")"\ && [ "${EXP_PKG_DISPATCH_COUNT_MAX}" -gt 0 ]; then _pkg_names="$(rtl_lconcat "${_pkg_names}" "${EX_PKG_NAMES}")"; diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr index 5367172c..c13cfdfc 100644 --- a/subr/ex_pkg_env.subr +++ b/subr/ex_pkg_env.subr @@ -26,7 +26,7 @@ exp_pkg_env_defaults() { if [ -z "${PKG_SUBDIR:-}" ]; then if [ -n "${PKG_URLS_GIT:-}" ]\ && [ -n "${PKG_FNAME:-}" ]; then - rtl_log_msg "fatalexit" "Error: \${PKG_SUBDIR} must be specified given both \${PKG_FNAME} and \${PKG_URLS_GIT}."; + rtl_log_msg "fatalexit" "${MSG_pkg_fail_missing_vars}"; elif [ -n "${PKG_URLS_GIT:-}" ]; then PKG_SUBDIR="${PKG_URLS_GIT%%=*}"; else case "${PKG_FNAME:-}" in diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr index 9cd2fbe0..7a333947 100644 --- a/subr/pkg_fetch_download.subr +++ b/subr/pkg_fetch_download.subr @@ -20,7 +20,7 @@ pkg_fetch_download_clean_dlcache() { done; if [ "${_skipfl}" -eq 0 ]; then _fname="${_dlcachedir}/${_pkg_name}/${_fname}"; - rtl_log_msg "verbose" "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}"; + rtl_log_msg "verbose" "${MSG_rtl_fetch_rm_redundant}" "${_fname}" "${_pkg_name}"; rtl_fileop rm "${_fname}"; fi; done; diff --git a/subr/pkg_install_files.subr b/subr/pkg_install_files.subr index d387293b..0cd03e43 100644 --- a/subr/pkg_install_files.subr +++ b/subr/pkg_install_files.subr @@ -92,7 +92,7 @@ pkgp_install_files_strip() { if [ "${_stripfl:-0}" -eq 1 ]; then for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do if objdump -sj .debug_frame -j .debug_info "${_bin_path}" >/dev/null 2>&1; then - rtl_log_msg "pkg_strip" "Stripping %s..." "${_bin_path}"; + rtl_log_msg "pkg_strip" "${MSG_pkg_strip}" "${_bin_path}"; if ! "${PKG_TARGET}-strip" "${_bin_path}"; then return 1; fi; diff --git a/subr/pkgtool_init.subr b/subr/pkgtool_init.subr index 2a408423..4a90cc2c 100644 --- a/subr/pkgtool_init.subr +++ b/subr/pkgtool_init.subr @@ -18,27 +18,35 @@ pkgtoolp_init_args() { }; pkgtoolp_init_env() { - local _fname="" _rc=0; _status=""; + local _fname="" _lang="${LANG:-C}" _rc=0; _status=""; _lang="${_lang%%_*}"; + if ! cd "${0%/*}"; then printf "Error: failed to change working directory to \`${0%/*}'." >&2; exit 1; elif ! umask 022; then printf "Error: failed to set umask(2).\n" >&2; exit 1; else for _fname in \ - $(find subr.rtl -name *.subr) \ - $(find subr -name *.subr) \ - etc/pkgtool.theme \ + $(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; - 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; + 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; fi; - fi; - fi; return "${_rc}"; + done; + fi; export LANG=C LC_ALL=C; return "${_rc}"; }; pkgtoolp_init_getopts() { |