diff options
author | Greg Kroah-Hartman <gregkh@google.com> | 2019-07-14 09:01:10 +0200 |
---|---|---|
committer | Matthias Männich <maennich@google.com> | 2019-07-15 07:23:26 +0000 |
commit | ab75f54d7d9190fc33846b5c72c7edeba91a94a4 (patch) | |
tree | 196798e4ebcb844e4776e69f326379b82e6bd388 | |
parent | 9344e8acf737c7ee7f375662ded5cc20e7dce0ad (diff) |
remove dpkg usage from build_abi.sh
No need to rely on Debian to do a version check when sort can do it for
us already. Removing the call to dpkg allows us to run the script on
non-Debian systems, which is nice for those of us not using that
specific distro variant.
Also, break the check for a working abidiff up into two different tests,
providing two different error messages to help people understand what
specifically went wrong (either no abigail installed at all, or an old
version is installed.)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9cda3c63b2cca732deb96ae92cd542643376adf5
-rwxr-xr-x | build_abi.sh | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/build_abi.sh b/build_abi.sh index ef3f990..e612286 100755 --- a/build_abi.sh +++ b/build_abi.sh @@ -39,13 +39,22 @@ function update_config_for_abi_dump() { make O=${OUT_DIR} ${CC_LD_ARG} $archsubarch CROSS_COMPILE=${CROSS_COMPILE} olddefconfig) } -# ensure we have a sufficient abigail installation in path before continuing -if ! ( hash abidiff 2>/dev/null \ - && dpkg --compare-versions \ - $(abidiff --version | awk '{print $2}') ge 1.6.0) -then +function version_greater_than() { + test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; +} + +# ensure that abigail is present in path +if ! ( hash abidiff 2>/dev/null); then + echo "ERROR: libabigail is not found in \$PATH at all!" + echo "Have you run abi/bootstrap and followed the instructions?" + exit 1 +fi + +# ensure we have a "new enough" version of abigail present before continuing +if ! ( version_greater_than "$(abidiff --version | awk '{print $2}')" \ + "1.6.0" ); then echo "ERROR: no suitable libabigail (>= 1.6.0) in \$PATH." - echo "Did you run abi/bootstrap and followed the instructions?" + echo "Have you run abi/bootstrap and followed the instructions?" exit 1 fi |