diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/package.sh | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/package.sh b/lib/package.sh index d763f9a..5322ad6 100644 --- a/lib/package.sh +++ b/lib/package.sh @@ -20,6 +20,8 @@ [ -n "${_OB_PACKAGE_SM}" ] && return 0 _OB_PACKAGE_SM='true' +ob_use metadata + _OB_PACKAGE_DIR= _OB_PACKAGE_FORMAT= _OB_BINARY_PACKAGES= @@ -122,7 +124,8 @@ ob_parse_package_metadata() ob_get_binary_packages() { - _ob_local _obgbpk_opt _obgbpk_host_arch _obgbpk_pkgs + _ob_local _obgbpk_opt _obgbpk_host_arch _obgbpk_pkgs _obgbpk_pkg \ + _obgbpk_pkgs_clean _obgbpk_pkg_clean _obgbpk_orig_text_domain while getopts 'a:' _obgbpk_opt; do case "${_obgbpk_opt}" in @@ -145,7 +148,41 @@ ob_get_binary_packages() # NB: If a source package lists no binary packages, this will be true each # call. if [ -z "${_OB_BINARY_PACKAGES}" ]; then + _ob_package_do 'get_binary_packages' + + _obgbpk_orig_text_domain="$(ob_get_text_domain)" + ob_set_text_domain 'libopkbuild.1' + + _obgbpk_pkgs_clean=' ' + + for _obgbpk_pkg in ${_OB_BINARY_PACKAGES}; do + + # Validate the name. + if ! ob_validate_binary_name "${_obgbpk_pkg}"; then + ob_warn 'bad_binary_name' + continue + fi + + # Make sure the "clean" name is unique. + _obgbpk_pkg_clean=" $(echo "${_obgbpk_pkg}" | tr 'a-z' 'A-Z' | \ + tr -dC 'A-Z0-9') " + if echo "${_obgbpk_pkgs_clean}" | grep "${_obgbpk_pkg_clean}" \ + >/dev/null 2>&1; then + ob_warn 'duplicate_clean_binary_name' + continue + else + _obgbpk_pkgs_clean="${_obgbpk_pkgs_clean}${_obgbpk_pkg_clean} " + fi + + _obgbpk_pkgs="${_obgbpk_pkgs} ${_obgbpk_pkg}" + + done + + _OB_BINARY_PACKAGES="$(IFS=' ' echo ${_obgbpk_pkgs})" + + ob_set_text_domain "${_obgbpk_orig_text_domain}" + fi if [ -n "${_obgbpk_host_arch}" ]; then |