From 41a96aee5af59cc18f4292becc9f5122f6589f2d Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 12 Sep 2015 02:59:49 +0200 Subject: [PATCH] Fix fetching of openjpeg-data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fetch from master branch if TRAVIS_BRANCH doesn’t exist --- tools/travis-ci/install.sh | 14 +++++++++++--- tools/travis-ci/run.sh | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/travis-ci/install.sh b/tools/travis-ci/install.sh index d1ce8885..9130ee95 100755 --- a/tools/travis-ci/install.sh +++ b/tools/travis-ci/install.sh @@ -22,12 +22,20 @@ trap exit ERR # 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 -echo "Cloning openjpeg-data from ${TRAVIS_BRANCH} branch" -git clone --depth=1 --branch=${TRAVIS_BRANCH} git://github.com/uclouvain/openjpeg-data.git data +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 ${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" diff --git a/tools/travis-ci/run.sh b/tools/travis-ci/run.sh index d95475e5..36bcc0d4 100755 --- a/tools/travis-ci/run.sh +++ b/tools/travis-ci/run.sh @@ -60,7 +60,7 @@ fi 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}