# travis-ci doesn't dump cmake version in system info, let's print it
cmake --version
+OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
+
# We need test data
if [ "${TRAVIS_BRANCH:-}" == "" ]; then
- TRAVIS_BRANCH=master #default to master
+ TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up
+fi
+OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads git://github.com/uclouvain/openjpeg-data.git ${TRAVIS_BRANCH} | wc -l)
+if [ ${OPJ_DATA_HAS_BRANCH} -ne 0 ]; then
+ OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
+else
+ OPJ_DATA_BRANCH=master #default to master
fi
-echo "Cloning openjpeg-data from ${TRAVIS_BRANCH} branch"
-git clone --depth=1 --branch=${TRAVIS_BRANCH} git://github.com/uclouvain/openjpeg-data.git data
+echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch"
+git clone --depth=1 --branch=${OPJ_DATA_BRANCH} git://github.com/uclouvain/openjpeg-data.git data
# We need jpylyzer for the test suite
echo "Retrieving jpylyzer"
if [ "${TRAVIS_BRANCH:-}" == "" ]; then
echo "Guessing branch"
- TRAVIS_BRANCH=$(git -C ../openjpeg branch | grep '*' | tr -d '*[[:blank:]]') #default to master
+ TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to master
fi
OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-${TRAVIS_BRANCH}