summaryrefslogtreecommitdiffstats
path: root/src/ob-checkbuilddeps.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-12-25 16:11:38 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-12-25 16:11:38 (EST)
commit888b97fbda8aa867816770fb495dad105411a3eb (patch)
tree4539b5a79f562838355a80b44173050e4063153a /src/ob-checkbuilddeps.sh
parent0f5c59fee40bfcbcb85da69c7633366e304c77bc (diff)
ob-*: Move function definitions before points of use
Diffstat (limited to 'src/ob-checkbuilddeps.sh')
-rw-r--r--src/ob-checkbuilddeps.sh60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh
index 51264fe..fd1f10b 100644
--- a/src/ob-checkbuilddeps.sh
+++ b/src/ob-checkbuilddeps.sh
@@ -19,16 +19,32 @@
. "${LIBDATADIR}/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
-main()
+check_dep()
{
- ob_set_text_domain 'opkbuild'
+ local dep="${1}"
+ local dep_pkg=
+ local dep_rel=
+ local dep_ver=
+ local status=
+ local pkg_ver=
- ob_init_package '..' || exit 1
- ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
- ob_set_package_substvars ''
+ ob_parse_dep -p dep_pkg -r dep_rel -v dep_ver "${dep}"
+ status="$("${OPKG}" status "${dep_pkg}")"
- check_build_deps
- return ${?}
+ if ! printf '%s\n' "${status}" | grep '^Status: .* .* installed$' \
+ >/dev/null 2>&1; then
+ return 1
+ fi
+ if [ "x${dep_rel}" != 'x' ]; then
+ pkg_ver="$(printf '%s\n' "${status}" | \
+ sed -n 's/^Version: //p')"
+ if "${OPKG}" compare-versions \
+ "${pkg_ver}" "${dep_rel}" "${dep_ver}"; then
+ return 1
+ fi
+ fi
+
+ return 0
}
check_build_deps()
@@ -62,32 +78,16 @@ check_build_deps()
return 0
}
-check_dep()
+main()
{
- local dep="${1}"
- local dep_pkg=
- local dep_rel=
- local dep_ver=
- local status=
- local pkg_ver=
-
- ob_parse_dep -p dep_pkg -r dep_rel -v dep_ver "${dep}"
- status="$("${OPKG}" status "${dep_pkg}")"
+ ob_set_text_domain 'opkbuild'
- if ! printf '%s\n' "${status}" | grep '^Status: .* .* installed$' \
- >/dev/null 2>&1; then
- return 1
- fi
- if [ "x${dep_rel}" != 'x' ]; then
- pkg_ver="$(printf '%s\n' "${status}" | \
- sed -n 's/^Version: //p')"
- if "${OPKG}" compare-versions \
- "${pkg_ver}" "${dep_rel}" "${dep_ver}"; then
- return 1
- fi
- fi
+ ob_init_package '..' || exit 1
+ ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
+ ob_set_package_substvars ''
- return 0
+ check_build_deps
+ return ${?}
}
main "${@}"