summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/deps.sh30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/deps.sh b/lib/deps.sh
index 72bfb47..3dc3460 100644
--- a/lib/deps.sh
+++ b/lib/deps.sh
@@ -24,7 +24,9 @@ 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_pkgarchqual _obpd_relver _obpd_arches
+ _obpd_pkgarchqual _obpd_pkg _obpd_archqual \
+ _obpd_relver _obpd_rel _obpd_ver _obpd_arches \
+ _obpd_comp _obpd_comp_var
while getopts 'p:q:r:v:A:a:' _obpd_opt; do
case "${_obpd_opt}" in
@@ -67,34 +69,30 @@ ob_parse_dep()
_obpd_pkgarchqual="${_obpd_dep%% *}"
_obpd_dep=" ${_obpd_dep#* }"
- if [ -n "${_obpd_pkg_var}" ]; then
- eval "${_obpd_pkg_var}=${_obpd_pkgarchqual%:*}"
- fi
- if [ -n "${_obpd_archqual_var}" ]; then
- eval "${_obpd_archqual_var}=${_obpd_pkgarchqual##*:}"
- fi
+ _obpd_pkg="${_obpd_pkgarchqual%:*}"
+ _obpd_archqual="${_obpd_pkgarchqual##*:}"
if [ "${_obpd_dep# (*)}" != "${_obpd_dep}" ]; then
_obpd_relver="${_obpd_dep# (}"
_obpd_relver="${_obpd_relver%%)*}"
_obpd_dep="${_obpd_dep#(*)}"
- if [ -n "${_obpd_rel_var}" ]; then
- eval "${_obpd_rel_var}=${_obpd_relver% *}"
- fi
- if [ -n "${_obpd_ver_var}" ]; then
- eval "${_obpd_ver_var}=${_obpd_relver##* }"
- fi
+ _obpd_rel="${_obpd_relver% *}"
+ _obpd_ver="${_obpd_relver##* }"
fi
if [ "${_obpd_dep# \[*\]}" != "${_obpd_dep}" ]; then
_obpd_arches="${_obpd_dep# \[}"
_obpd_arches="${_obpd_arches%%\]*}"
# TODO: Reduce arch is host arch is given.
- if [ -n "${_obpd_arches_var}" ]; then
- eval "${_obpd_arches_var}=${_obpd_arches}"
- fi
fi
+ # Set the specified variables.
+ for _obpd_comp in pkg archqual rel ver arches; do
+ _obpd_comp_var="$(eval echo \"\$\{_obpd_${_obpd_comp}_var\}\")"
+ [ -z "${_obpd_comp_var}" ] && continue
+ eval ${_obpd_comp_var}=\"\$\{_obpd_${_obpd_comp}\}\"
+ done
+
return $(_ob_return 0)
}