summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-10-25 16:35:39 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-10-25 16:35:39 (EDT)
commitfdbb53097124e44d8a15f67e5758c9d04b698298 (patch)
tree9ec679cc3b190b11d967544aafb5eb49fe7bb181
parente91bddd654d58e9401a49801d502c1ed7ba858a0 (diff)
Reduce platforms in ob_parse_dep().
-rw-r--r--lib/deps.sh34
1 files changed, 29 insertions, 5 deletions
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
- # <pkg>[:<archqual>] [(<rel> <ver>)] [\[<arches>\]]
+ # <pkg>[:<archqual>] [(<rel> <ver>)] [\[<arches>\]] [\<<plats>\>]
_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 ${?}