From fdbb53097124e44d8a15f67e5758c9d04b698298 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 25 Oct 2012 16:35:39 -0400 Subject: Reduce platforms in ob_parse_dep(). --- (limited to 'lib') diff --git a/lib/deps.sh b/lib/deps.sh index a1b0010..0b2397c 100644 --- a/lib/deps.sh +++ b/lib/deps.sh @@ -25,12 +25,13 @@ ob_use metadata ob_parse_dep() { _ob_local _obpd_opt _obpd_pkg_var _obpd_archqual_var _obpd_rel_var \ - _obpd_ver_var _obpd_arches_var _obpd_host_arch _obpd_dep \ + _obpd_ver_var _obpd_arches_var _obpd_plats_var \ + _obpd_host_arch _obpd_host_plat _obpd_dep \ _obpd_pkgarchqual _obpd_pkg _obpd_archqual \ - _obpd_relver _obpd_rel _obpd_ver _obpd_arches \ + _obpd_relver _obpd_rel _obpd_ver _obpd_arches _obpd_plats \ _obpd_comp _obpd_comp_var - while getopts 'p:q:r:v:A:a:' _obpd_opt; do + while getopts 'p:q:r:v:A:l:a:P:' _obpd_opt; do case "${_obpd_opt}" in p) _obpd_pkg_var="${OPTARG}" @@ -67,9 +68,19 @@ ob_parse_dep() return ${?} fi ;; + l) + _obpd_plats_var="${OPTARG}" + if ! _ob_validate_var_name "${_obpd_plats_var}"; then + _ob_return 125 + return ${?} + fi + ;; a) _obpd_host_arch="${OPTARG}" ;; + P) + _obpd_host_plat="${OPTARG}" + ;; ?) _ob_return 125 return ${?} @@ -90,7 +101,7 @@ ob_parse_dep() return ${?} fi - # [:] [( )] [\[\]] + # [:] [( )] [\[\]] [\<\>] _obpd_pkgarchqual="${_obpd_dep%% *}" _obpd_dep=" ${_obpd_dep#* }" @@ -113,8 +124,14 @@ ob_parse_dep() _obpd_dep="${_obpd_dep# \[*\]}" fi + if [ "${_obpd_dep# <*>}" != "${_obpd_dep}" ]; then + _obpd_plats="${_obpd_dep# <}" + _obpd_plats="${_obpd_arches%%>*}" + _obpd_dep="${_obpd_dep# <*>}" + fi + # Set the specified variables. - for _obpd_comp in pkg archqual rel ver arches; do + for _obpd_comp in pkg archqual rel ver arches plats; do _obpd_comp_var="$(eval echo \"\$\{_obpd_${_obpd_comp}_var\}\")" [ -z "${_obpd_comp_var}" ] && continue eval ${_obpd_comp_var}=\"\$\{_obpd_${_obpd_comp}\}\" @@ -125,12 +142,19 @@ ob_parse_dep() _ob_return 0 return ${?} fi + if [ -n "${_obpd_host_plat}" ] && ! _ob_dep_plat_is_concerned \ + "${_obpd_host_plat}" "${_obpd_plats}"; then + _ob_return 0 + return ${?} + fi printf '%s' "${_obpd_pkg}" [ -n "${_obpd_archqual}" ] && printf ':%s' "${_obpd_archqual}" [ -n "${_obpd_ver}" ] && printf ' (%s %s)' "${_obpd_rel}" "${_obpd_ver}" [ -z "${_obpd_host_arch}" -a -n "${_obpd_arches}" ] && \ printf ' [%s]' "${_obpd_arches}" + [ -z "${_obpd_host_plat}" -a -n "${_obpd_plats}" ] && \ + printf ' [%s]' "${_obpd_plats}" _ob_return 0 return ${?} -- cgit v0.9.1