]> granicus.if.org Git - openjpeg/commitdiff
Fix fetching of openjpeg-data
authormayeut <mayeut@users.noreply.github.com>
Sat, 12 Sep 2015 00:59:49 +0000 (02:59 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sat, 12 Sep 2015 00:59:49 +0000 (02:59 +0200)
Fetch from master branch if TRAVIS_BRANCH doesn’t exist

tools/travis-ci/install.sh
tools/travis-ci/run.sh

index d1ce88852ae8be1cdb3f6f73d186a554fd7c1cfd..9130ee95ea7601ad8e8565553709301167f32230 100755 (executable)
@@ -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
+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"
index d95475e54666d589e221c94d9a745c4be0776092..36bcc0d45ed70d72bb25b13841759f49053dd844 100755 (executable)
@@ -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}