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
|
|
|
|
|
2017-08-02 16:50:11 +02:00
|
|
|
if [ "${OPJ_CI_CC:-}" != "" ]; then
|
|
|
|
export CC=${OPJ_CI_CC}
|
|
|
|
echo "Using ${CC}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${OPJ_CI_CXX:-}" != "" ]; then
|
|
|
|
export CXX=${OPJ_CI_CXX}
|
|
|
|
echo "Using ${CXX}"
|
|
|
|
fi
|
|
|
|
|
2015-10-09 21:20:54 +02:00
|
|
|
OPJ_UPLOAD_ABI_REPORT=0
|
2020-12-29 15:01:40 +01:00
|
|
|
#OPJ_PREVIOUS_VERSION="2.3.1"
|
2020-12-29 14:46:50 +01:00
|
|
|
OPJ_LATEST_VERSION="2.4.0"
|
2016-07-06 00:26:37 +02:00
|
|
|
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
|
2016-09-29 22:06:23 +02:00
|
|
|
if [ "$(echo "${TRAVIS_REPO_SLUG}" | sed 's/\(^.*\)\/.*/\1/')" == "uclouvain" ] && [ "${TRAVIS_PULL_REQUEST:-}" == "false" ] && [ "${TRAVIS_BRANCH:-}" == "master" ]; 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
|
2019-03-29 11:53:23 +01:00
|
|
|
wget https://tools.ietf.org/tools/rfcdiff/rfcdiff
|
|
|
|
chmod +x rfcdiff
|
|
|
|
mv rfcdiff ${PWD}/tools
|
|
|
|
export PATH=${PWD}/tools:$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
|
|
|
|
2017-08-02 16:50:11 +02:00
|
|
|
# This will print configuration
|
|
|
|
# travis-ci doesn't dump cmake version in system info, let's print it
|
|
|
|
cmake --version
|
|
|
|
|
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-09-29 21:44:38 +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-09-29 21:44:38 +02:00
|
|
|
abi-monitor -v current -build openjpeg.json
|
2019-11-17 01:35:26 +01:00
|
|
|
|
|
|
|
rm -rf ./installed/openjpeg/${OPJ_LATEST_VERSION}
|
|
|
|
rm -rf ./compat_report/openjpeg/${OPJ_LATEST_VERSION}
|
|
|
|
rm -rf ./abi_dump/openjpeg/${OPJ_LATEST_VERSION}
|
|
|
|
rm -rf ./headers_diff/openjpeg/${OPJ_LATEST_VERSION}
|
|
|
|
rm -rf ./objects_report/openjpeg/${OPJ_LATEST_VERSION}
|
2016-09-29 21:44:38 +02:00
|
|
|
abi-monitor -v ${OPJ_LATEST_VERSION} -build openjpeg.json
|
|
|
|
if [ "${OPJ_PREVIOUS_VERSION:-}" != "" ]; then
|
|
|
|
abi-monitor -v ${OPJ_PREVIOUS_VERSION} -build openjpeg.json
|
|
|
|
fi
|
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
|
2016-07-06 00:26:37 +02:00
|
|
|
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
|
2019-11-17 01:35:26 +01:00
|
|
|
if [ ${EXIT_CODE} -eq 1 ]; then
|
|
|
|
cat "compat_reports/openjpeg/${OPJ_LATEST_VERSION}_to_current/abi_compat_report.html"
|
|
|
|
fi
|
2016-07-06 00:26:37 +02:00
|
|
|
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
|
2017-08-02 16:50:11 +02:00
|
|
|
|
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"
|
|
|
|
|
2017-08-02 17:07:29 +02:00
|
|
|
git add --all .
|
2016-06-21 16:19:06 +02:00
|
|
|
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
|