diff --git a/.travis.yml.example-full b/.travis.yml.example-full index 0f31f88..442c46d 100644 --- a/.travis.yml.example-full +++ b/.travis.yml.example-full @@ -5,6 +5,14 @@ language: cpp compiler: gcc dist: xenial +cache: + directories: + - $HOME/.cache + +env: + global: + - SETUP_PATH=.ci-local:.ci + addons: apt: packages: diff --git a/defaults.set b/defaults.set new file mode 100644 index 0000000..da493e8 --- /dev/null +++ b/defaults.set @@ -0,0 +1 @@ +BASE_REPO=https://github.com/epics-base/epics-base.git diff --git a/travis-prepare.sh b/travis-prepare.sh index f5e30fd..5e0912a 100755 --- a/travis-prepare.sh +++ b/travis-prepare.sh @@ -1,23 +1,41 @@ #!/bin/sh set -e -x -CURDIR="$PWD" +SETUP_DIRS=$(echo $SETUP_PATH | tr ":" "\n") -# determine if BASE is a release or a branch -git ls-remote --quiet --exit-code --tags https://github.com/${REPOBASE:-epics-base}/epics-base.git "$BASE" && BASE_RELEASE=YES -git ls-remote --quiet --exit-code --heads https://github.com/${REPOBASE:-epics-base}/epics-base.git "$BASE" && BASE_BRANCH=YES +source_set() { + SETFILE=$1 + for set_dir in ${SETUP_DIRS} + do + if [ -e $set_dir/$SETFILE.set ] + then + source $set_dir/$SETFILE.set + fi + done +} + +source_set defaults + +CURDIR="$PWD" +CACHEDIR="$HOME/.cache" +SOURCEDIR="$HOME/.source" + +# determine if BASE points to a release or a branch +git ls-remote --quiet --exit-code --tags "$BASE_REPO" "$BASE" && BASE_RELEASE=YES +git ls-remote --quiet --exit-code --heads "$BASE_REPO" "$BASE" && BASE_BRANCH=YES if [ "$BASE_RELEASE" = "YES" ] then - # TODO: use a cached location - BASE_LOCATION=$HOME/.source/epics-base + BASE_LOCATION=$CACHEDIR/epics-base + BASE_RECURSIVE="--recursive" else if [ "$BASE_BRANCH" = "YES" ] then - BASE_LOCATION=$HOME/.source/epics-base + BASE_LOCATION=$SOURCEDIR/epics-base + BASE_RECURSIVE= else - echo $BASE is neither a tag nor a branch name for BASE - exit 1 + echo $BASE is neither a tag nor a branch name for BASE + exit 1 fi fi @@ -25,9 +43,6 @@ cat << EOF > $CURDIR/configure/RELEASE.local EPICS_BASE=$BASE_LOCATION EOF -install -d "$HOME/.source" -cd "$HOME/.source" - add_gh_flat() { MODULE=$1 REPOOWNER=$2 @@ -42,9 +57,23 @@ ${MODULE_UC}=$HOME/.source/$MODULE EOF } -# not recursive -git clone --quiet --depth 5 --branch "$BASE" https://github.com/${REPOBASE:-epics-base}/epics-base.git epics-base +if [ "$BASE_RELEASE" = "YES" ] +then + mkdir -s "$CACHEDIR" + cd "$CACHEDIR" + BASE_MODULE= +else + mkdir -s "$SOURCEDIR" + cd "$SOURCEDIR" + BASE_MODULE=epics-base +fi + +git clone --quiet --depth 5 $BASE_RECURSIVE --branch "$BASE" $BASE_REPO epics-base (cd epics-base && git log -n1 ) + +mkdir -s "$SOURCEDIR" +cd "$SOURCEDIR" + for modrepo in ${MODULES} do module=${modrepo%CPP} @@ -152,7 +181,7 @@ CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386-qemu EOF fi -for modrepo in epics-base ${MODULES} +for modrepo in ${BASE_MODULE} ${MODULES} do module=${modrepo%CPP} make -j2 -C $module $EXTRA