From 8d5bfc4679824ca505f5982ee602e5b79774f890 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 25 Dec 2018 22:41:19 -0500 Subject: libopkbuild: Move function definitions before points of use --- diff --git a/lib/changelog.sh b/lib/changelog.sh index e8da1f4..aea567c 100644 --- a/lib/changelog.sh +++ b/lib/changelog.sh @@ -24,6 +24,45 @@ OB_CHANGELOG_CHANGES= OB_CHANGELOG_MAINTAINER= OB_CHANGELOG_DATE= +_ob_parse_changelog_error() +{ + local file= + local line_nr= + local msg_id= + local file_info= + local orig_text_domain= + + file="${1}" + line_nr="${2}" + msg_id="${3}" + shift 3 + + file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")" + + orig_text_domain="$(ob_get_text_domain)" + ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" + + ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}" + + ob_set_text_domain "${orig_text_domain}" + + return 0 +} + +_ob_get_changelog_expect_str() +{ + local orig_text_domain= + + orig_text_domain="$(ob_get_text_domain)" + ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" + + echo "$(ob_get_msg "changelog_expect_${1}")" + + ob_set_text_domain "${orig_text_domain}" + + return 0 +} + ob_parse_changelog() { local file= @@ -162,42 +201,3 @@ ${blank_lines}${line}" return 0 } - -_ob_parse_changelog_error() -{ - local file= - local line_nr= - local msg_id= - local file_info= - local orig_text_domain= - - file="${1}" - line_nr="${2}" - msg_id="${3}" - shift 3 - - file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")" - - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - - ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}" - - ob_set_text_domain "${orig_text_domain}" - - return 0 -} - -_ob_get_changelog_expect_str() -{ - local orig_text_domain= - - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - - echo "$(ob_get_msg "changelog_expect_${1}")" - - ob_set_text_domain "${orig_text_domain}" - - return 0 -} diff --git a/lib/control.sh b/lib/control.sh index 157a677..40a9b08 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -22,6 +22,35 @@ _OB_SUBSTVARS_MAX_DEPTH=50 OB_CONTROL_NAME= OB_CONTROL_VALUE= +_ob_parse_control_error() +{ + local file= + local line_nr= + local msg_id= + local file_info= + local orig_text_domain= + + file="${1}" + line_nr="${2}" + msg_id="${3}" + shift 3 + + if [ ${line_nr} -eq 0 ]; then + file_info="$(printf '%20s:' "${file}")" + else + file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")" + fi + + orig_text_domain="$(ob_get_text_domain)" + ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" + + ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}" + + ob_set_text_domain "${orig_text_domain}" + + return 0 +} + ob_parse_control() { local file= @@ -235,32 +264,3 @@ ob_substvars() return 0 } - -_ob_parse_control_error() -{ - local file= - local line_nr= - local msg_id= - local file_info= - local orig_text_domain= - - file="${1}" - line_nr="${2}" - msg_id="${3}" - shift 3 - - if [ ${line_nr} -eq 0 ]; then - file_info="$(printf '%20s:' "${file}")" - else - file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")" - fi - - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - - ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}" - - ob_set_text_domain "${orig_text_domain}" - - return 0 -} diff --git a/lib/locale.sh b/lib/locale.sh index c1fae2d..f168037 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -32,6 +32,24 @@ ob_get_text_domain() return 0 } +_ob_try_load_messages() +{ + local locale= + local ms= + + locale="${1}" + ms="$(printf "${_OB_LOCALE_PATH}" \ + "${locale}" "${_OB_TEXT_DOMAIN}")" + + if [ -f "${ms}" ]; then + . "${ms}" + else + return 1 + fi + + return 0 +} + ob_set_text_domain() { if [ ${#} -eq 1 ]; then @@ -96,21 +114,3 @@ ob_get_msg() return 0 } - -_ob_try_load_messages() -{ - local locale= - local ms= - - locale="${1}" - ms="$(printf "${_OB_LOCALE_PATH}" \ - "${locale}" "${_OB_TEXT_DOMAIN}")" - - if [ -f "${ms}" ]; then - . "${ms}" - else - return 1 - fi - - return 0 -} diff --git a/lib/metadata.sh b/lib/metadata.sh index 3ffae71..30aa018 100644 --- a/lib/metadata.sh +++ b/lib/metadata.sh @@ -17,6 +17,18 @@ # You should have received a copy of the GNU General Public License # along with opkbuild. If not, see . +_ob_metadata_do() +{ + local func= + + func="${1}" + shift 1 + + "_ob_${func}" "${@}" + + return ${?} +} + ob_validate_source_name() { local name= @@ -300,15 +312,3 @@ ob_get_system_path() return ${?} } - -_ob_metadata_do() -{ - local func= - - func="${1}" - shift 1 - - "_ob_${func}" "${@}" - - return ${?} -} diff --git a/lib/package.sh b/lib/package.sh index 33e8af1..2e97af3 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -57,6 +57,18 @@ ob_init_package() return 0 } +_ob_package_do() +{ + local func= + + func="${1}" + shift 1 + + "_ob_${func}_${_OB_PACKAGE_FORMAT}" "${@}" + + return ${?} +} + ob_parse_package_metadata() { local opt= @@ -335,18 +347,6 @@ ob_set_package_substvars() return ${?} } -_ob_package_do() -{ - local func= - - func="${1}" - shift 1 - - "_ob_${func}_${_OB_PACKAGE_FORMAT}" "${@}" - - return ${?} -} - _ob_set_binary_packages() { local packages= -- cgit v0.9.1