diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-03 17:53:17 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-03 17:53:17 (EDT) |
commit | acbff35a80d06c20286efa586fbc8b674c6b5b4d (patch) | |
tree | 21b61df3aceb120e9c82d936ef61da8902bb4dc7 /src | |
parent | dd4179fa34847edea7b3b8e527ae9a6dbfee64d6 (diff) |
ob-checkbuilddeps: Support compare-versions change in opkg-lede
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-checkbuilddeps.sh | 30 |
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 |