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

126 lines
4.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_PREVIOUS_VERSION="2.1"
2016-07-05 23:33:00 +02:00
OPJ_LATEST_VERSION="2.1.1"
if [ "${OPJ_PREVIOUS_VERSION:-}" != "" ]; then
OPJ_LIMIT_ABI_BUILDS="-limit 3"
else
OPJ_LIMIT_ABI_BUILDS="-limit 2"
fi
2016-06-21 16:19:06 +02:00
OPJ_REPO="https://github.com/uclouvain/openjpeg.git"
OPJ_SSH_REPO=${OPJ_REPO/https:\/\/github.com\//git@github.com:}
OPJ_UPLOAD_BRANCH="gh-pages"
OPJ_UPLOAD_DIR="abi-check"
2015-10-09 21:20:54 +02:00
if [ "${TRAVIS_REPO_SLUG:-}" != "" ]; then
if [ "$(echo "${TRAVIS_REPO_SLUG}" | sed 's/\(^.*\)\/.*/\1/')" == "uclouvain" ] && [ "${TRAVIS_PULL_REQUEST:-}" == "false" ]; then
2016-06-21 16:19:06 +02:00
# Upload updated report to gh-pages
2015-10-09 21:20:54 +02:00
OPJ_UPLOAD_ABI_REPORT=1
# Build full report
2016-06-21 16:19:06 +02:00
#OPJ_LIMIT_ABI_BUILDS=
2015-10-09 21:20:54 +02:00
fi
fi
2015-10-08 20:06:59 +02:00
OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
2016-06-21 16:19:06 +02:00
# INSTALL REQUIRED PACKAGES
2015-10-08 20:06:59 +02:00
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
2016-06-21 16:19:06 +02:00
wget -qO - https://github.com/lvc/installer/archive/0.10.tar.gz | tar -xz
2015-10-09 21:20:54 +02:00
mkdir ${PWD}/tools/abi-tracker
2016-06-21 16:19:06 +02:00
make -C installer-0.10 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
2016-06-21 16:19:06 +02:00
# RUN THE ABI-CHECK SCRIPTS
mkdir work
cd work
2016-06-25 01:09:42 +02:00
# Clone the gh-pages branch and work from there
git clone -b $OPJ_UPLOAD_BRANCH --single-branch $OPJ_REPO .
cd $OPJ_UPLOAD_DIR
rm -rf installed/openjpeg/current/*
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
2016-06-21 17:21:08 +02:00
#abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -get openjpeg.json
2015-10-14 22:43:39 +02:00
if [ "${OPJ_LIMIT_ABI_BUILDS}" != "" ]; then
cp -f ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json ./openjpeg.json
else
# Old versions of openjpeg don't like -fvisibility=hidden...
grep -v Configure ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json > ./openjpeg.json
fi
2015-10-09 21:20:54 +02:00
cp -rf ${OPJ_SOURCE_DIR} src/openjpeg/current
2016-06-21 17:21:08 +02:00
abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -rebuild openjpeg.json
2016-06-21 17:41:29 +02:00
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
2016-06-21 16:19:06 +02:00
abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/$OPJ_LATEST_VERSION -name '*.dump') -new $(find ./abi_dump/openjpeg/current -name '*.dump') -header openjpeg.h -api -s || EXIT_CODE=1
if [ "${OPJ_PREVIOUS_VERSION:-}" != "" ]; then
abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/$OPJ_PREVIOUS_VERSION -name '*.dump') -new $(find ./abi_dump/openjpeg/$OPJ_LATEST_VERSION -name '*.dump') -header openjpeg.h -api -s || EXIT_CODE=1
fi
2015-10-08 20:06:59 +02:00
# Check ABI
2015-10-14 22:43:39 +02:00
if [ "${OPJ_LIMIT_ABI_BUILDS}" != "" ]; then
2016-06-21 16:19:06 +02:00
abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/$OPJ_LATEST_VERSION -name '*.dump') -new $(find ./abi_dump/openjpeg/current -name '*.dump') -header openjpeg.h -abi -s || EXIT_CODE=1
if [ "${OPJ_PREVIOUS_VERSION:-}" != "" ]; then
abi-compliance-checker -l openjpeg -old $(find ./abi_dump/openjpeg/$OPJ_PREVIOUS_VERSION -name '*.dump') -new $(find ./abi_dump/openjpeg/$OPJ_LATEST_VERSION -name '*.dump') -header openjpeg.h -abi -s || EXIT_CODE=1
fi
2015-10-14 22:43:39 +02:00
else
echo "Disable ABI check for now, problems with symbol visibility..."
fi
2015-10-09 21:20:54 +02:00
2016-06-21 16:19:06 +02:00
rm -rf src/openjpeg/current
rm -rf build_logs
2015-10-09 21:20:54 +02:00
if [ ${OPJ_UPLOAD_ABI_REPORT} -eq 1 ]; then
2016-06-21 16:19:06 +02:00
git config user.name "OpenJPEG Travis CI"
git config user.email "info@openjpeg.org"
git add .
git commit -m "Update ABI/API compatibility reports after commit ${TRAVIS_COMMIT:-}"
# Get the deploy key by using Travis's stored variables to decrypt travis_rsa.enc
2016-06-21 16:46:38 +02:00
openssl aes-256-cbc -K $encrypted_99d63218f67a_key -iv $encrypted_99d63218f67a_iv -in ${OPJ_SOURCE_DIR}/tools/travis-ci/travis_rsa.enc -out travis_rsa -d
2016-06-21 16:19:06 +02:00
chmod 600 travis_rsa
eval `ssh-agent -s`
ssh-add travis_rsa
# Now that we're all set up, we can push.
git push $OPJ_SSH_REPO $OPJ_UPLOAD_BRANCH
2015-10-09 21:20:54 +02:00
fi
2016-06-21 16:19:06 +02:00
rm -rf src installed
2015-10-09 21:20:54 +02:00
exit $EXIT_CODE