summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ob-checkbuilddeps.sh30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh
index 39d7e60..1bfbe7f 100644
--- a/src/ob-checkbuilddeps.sh
+++ b/src/ob-checkbuilddeps.sh
@@ -19,6 +19,26 @@
set -eu
+opkg_compare_versions_reference_status=
+
+compare_versions()
+{
+ local pkg_ver="${1}"
+ local dep_rel="${2}"
+ local dep_ver="${3}"
+ shift 3
+
+ # "Classic" (now Yocto) opkg returns 1 on a true comparison and 0 on a
+ # false comparison. opkg-lede reversed this in commit 93de62b. Compare
+ # the compare-versions exit status with a reference exit status from a
+ # true statement (1 << 2).
+ ! "${OPKG}" compare-versions "${pkg_ver}" "${dep_rel}" "${dep_ver}"
+ # The "-e" setting is ignored while executing anything, including
+ # commands in a function, within the context of the condition of an "if"
+ # statement.
+ [ ${?} -eq ${opkg_compare_versions_reference_status} ]
+}
+
check_dep()
{
local dep="${1}"
@@ -39,9 +59,8 @@ check_dep()
if [ "x${dep_rel}" != 'x' ]; then
pkg_ver="$(printf '%s\n' "${status}" | \
sed -n 's/^Version: //p')"
- # opkg returns 1 on a true comparison, 0 on a false comparison.
- if "${OPKG}" compare-versions \
- "${pkg_ver}" "${dep_rel}" "${dep_ver}"; then
+ if ! compare_versions "${pkg_ver}" "${dep_rel}" "${dep_ver}"
+ then
return 1
fi
fi
@@ -92,6 +111,11 @@ main()
ob_init_package '..' || return 1
ob_set_package_substvars ''
+ # See compare_versions() above.
+ # The "-e" setting is ignored for pipelines beginning with "!".
+ ! "${OPKG}" compare-versions 1 '>>' 2
+ opkg_compare_versions_reference_status=${?}
+
check_build_deps || return ${?}
return 0