3 # This script executes the abi-check step when running under travis-ci (in run step)
5 # Set-up some bash options
6 set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
7 set -o errexit ## set -e : exit the script if any statement returns a non-true return value
8 set -o pipefail ## Fail on error in pipe
9 set -o xtrace ## set -x : Print a trace of simple commands and their arguments after they are expanded and before they are executed.
11 # Exit if not ABI check
12 if [ "${OPJ_CI_ABI_CHECK:-}" != "1" ]; then
16 OPJ_UPLOAD_ABI_REPORT=0
17 OPJ_LATEST_VERSION="2.1"
18 OPJ_LIMIT_ABI_BUILDS="-limit 2"
19 OPJ_REPO="https://github.com/uclouvain/openjpeg.git"
20 OPJ_SSH_REPO=${OPJ_REPO/https:\/\/github.com\//git@github.com:}
21 OPJ_UPLOAD_BRANCH="gh-pages"
22 OPJ_UPLOAD_DIR="abi-check"
23 if [ "${TRAVIS_REPO_SLUG:-}" != "" ]; then
24 if [ "$(echo "${TRAVIS_REPO_SLUG}" | sed 's/\(^.*\)\/.*/\1/')" == "uclouvain" ] && [ "${TRAVIS_PULL_REQUEST:-}" == "false" ]; then
25 # Upload updated report to gh-pages
26 OPJ_UPLOAD_ABI_REPORT=1
28 #OPJ_LIMIT_ABI_BUILDS=
32 OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
34 # INSTALL REQUIRED PACKAGES
36 mkdir ${HOME}/abi-check
38 # Let's get tools not available with apt
40 # Travis doesn't allow package wdiff...
41 wget -qO - http://mirrors.kernel.org/gnu/wdiff/wdiff-latest.tar.gz | tar -xz
43 ./configure --prefix=${HOME}/abi-check/tools/wdiff &> /dev/null
45 make check &> /dev/null
46 make install &> /dev/null
48 export PATH=${PWD}/tools/wdiff/bin:$PATH
49 wget -qO - https://tools.ietf.org/tools/rfcdiff/rfcdiff-1.42.tgz | tar -xz
50 mv rfcdiff-1.42 ${PWD}/tools/rfcdiff
51 export PATH=${PWD}/tools/rfcdiff:$PATH
52 wget -qO - https://github.com/lvc/installer/archive/0.10.tar.gz | tar -xz
53 mkdir ${PWD}/tools/abi-tracker
54 make -C installer-0.10 install prefix=${PWD}/tools/abi-tracker target=abi-tracker
55 export PATH=${PWD}/tools/abi-tracker/bin:$PATH
57 # RUN THE ABI-CHECK SCRIPTS
62 # If upload is scheduled, clone the gh-pages branch and work from there
63 if [ ${OPJ_UPLOAD_ABI_REPORT} -eq 1 ]; then
64 git clone -b $OPJ_UPLOAD_BRANCH --single-branch $OPJ_REPO .
66 rm -rf installed/openjpeg/current/*
69 # Let's create all we need
70 grep -v Git ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json > ./openjpeg.json
71 #abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -get openjpeg.json
72 if [ "${OPJ_LIMIT_ABI_BUILDS}" != "" ]; then
73 cp -f ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json ./openjpeg.json
75 # Old versions of openjpeg don't like -fvisibility=hidden...
76 grep -v Configure ${OPJ_SOURCE_DIR}/tools/abi-tracker/openjpeg.json > ./openjpeg.json
78 cp -rf ${OPJ_SOURCE_DIR} src/openjpeg/current
79 abi-monitor ${OPJ_LIMIT_ABI_BUILDS} -rebuild openjpeg.json
80 abi-tracker -build openjpeg.json
85 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
88 if [ "${OPJ_LIMIT_ABI_BUILDS}" != "" ]; then
89 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
91 echo "Disable ABI check for now, problems with symbol visibility..."
94 rm -rf src/openjpeg/current
97 if [ ${OPJ_UPLOAD_ABI_REPORT} -eq 1 ]; then
98 git config user.name "OpenJPEG Travis CI"
99 git config user.email "info@openjpeg.org"
101 # Commit the "changes", i.e. the new version.
102 # The delta will show diffs between new and old versions.
103 git diff > ../diff.patch
105 git commit -m "Update ABI/API compatibility reports after commit ${TRAVIS_COMMIT:-}"
107 # Get the deploy key by using Travis's stored variables to decrypt travis_rsa.enc
108 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
113 # Now that we're all set up, we can push.
114 git push $OPJ_SSH_REPO $OPJ_UPLOAD_BRANCH