openjpeg/tools/travis-ci/abi-check.sh

77 lines
2.6 KiB
Bash
Raw Normal View History

2015-10-08 20:06:59 +02:00
#!/bin/bash
# This script executes the abi-check step when running under travis-ci (in run step)
# Set-up some bash options
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o pipefail ## Fail on error in pipe
set -o xtrace ## set -x : Print a trace of simple commands and their arguments after they are expanded and before they are executed.
# Exit if not ABI check
if [ "${OPJ_CI_ABI_CHECK:-}" != "1" ]; then
exit 0
fi
2015-10-09 21:20:54 +02:00
OPJ_UPLOAD_ABI_REPORT=0
OPJ_LIMIT_ABI_BUILDS="-limit 2"
if [ "${TRAVIS_REPO_SLUG:-}" != "" ]; then
if [ "$(echo "${TRAVIS_REPO_SLUG}" | sed 's/\(^.*\)\/.*/\1/')" == "uclouvain" ] && [ "${TRAVIS_PULL_REQUEST:-}" == "false" ]; then
# Upload report
OPJ_UPLOAD_ABI_REPORT=1
# Build full report
OPJ_LIMIT_ABI_BUILDS=
fi
fi
2015-10-08 20:06:59 +02:00
OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
2015-10-09 21:20:54 +02:00
mkdir ${HOME}/abi-check
2015-10-08 20:06:59 +02:00
cd ${HOME}/abi-check
2015-10-09 21:20:54 +02:00
# Let's get tools not available with apt
mkdir tools
2015-10-09 21:48:33 +02:00
# Travis doesn't allow package wdiff...
wget -qO - http://mirrors.kernel.org/gnu/wdiff/wdiff-latest.tar.gz | tar -xz
cd wdiff-*
2015-10-09 22:23:32 +02:00
./configure --prefix=${HOME}/abi-check/tools/wdiff &> /dev/null
make &> /dev/null
make check &> /dev/null
make install &> /dev/null
2015-10-09 21:48:33 +02:00
cd ..
export PATH=${PWD}/tools/wdiff/bin:$PATH
2015-10-09 21:20:54 +02:00
wget -qO - https://tools.ietf.org/tools/rfcdiff/rfcdiff-1.42.tgz | tar -xz
mv rfcdiff-1.42 ${PWD}/tools/rfcdiff
2015-10-09 21:48:33 +02:00
export PATH=${PWD}/tools/rfcdiff:$PATH
2015-10-09 23:51:54 +02:00
wget -qO - https://github.com/lvc/installer/archive/0.4.tar.gz | tar -xz
2015-10-09 21:20:54 +02:00
mkdir ${PWD}/tools/abi-tracker
2015-10-09 23:51:54 +02:00
make -C installer-0.4 install prefix=${PWD}/tools/abi-tracker target=abi-tracker
2015-10-09 21:48:33 +02:00
export PATH=${PWD}/tools/abi-tracker/bin:$PATH
2015-10-09 23:51:54 +02:00
2015-10-09 21:20:54 +02:00
mkdir tracker
cd tracker
2015-10-08 20:06:59 +02:00
2015-10-09 21:20:54 +02:00
# Let's create all we need
2015-10-09 23:51:54 +02:00
grep -v Git ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json > ./openjpeg.json
2015-10-09 21:20:54 +02:00
abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -get openjpeg.json
2015-10-09 23:51:54 +02:00
cp -f ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json ./openjpeg.json
2015-10-09 21:20:54 +02:00
cp -rf ${OPJ_SOURCE_DIR} src/openjpeg/current
abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -build openjpeg.json
abi-tracker -build openjpeg.json
2015-10-08 20:06:59 +02:00
2015-10-09 21:20:54 +02:00
EXIT_CODE=0
# Check API
abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/2.1 -name '*.dump') -new $(find ./abi_dump/openjpeg/current -name '*.dump') -header openjpeg.h -api -s || EXIT_CODE=1
2015-10-08 20:06:59 +02:00
# Check ABI
2015-10-09 21:20:54 +02:00
abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/2.1 -name '*.dump') -new $(find ./abi_dump/openjpeg/current -name '*.dump') -header openjpeg.h -abi -s || EXIT_CODE=1
rm -rf src installed
if [ ${OPJ_UPLOAD_ABI_REPORT} -eq 1 ]; then
echo "TODO: Where to upload the report"
fi
exit $EXIT_CODE