Skip to content

Commit

Permalink
TST: travis: Adjust upstream Git build for Xenial
Browse files Browse the repository at this point in the history
Travis recently switched to using Xenial by default, and the Xenial
image, unlike the Trusty one, doesn't have third-party
apt-repositories [0].  Selectively enable ppa:git-core/ppa in the
upstream Git build because we rely on that repository to get the
latest Git.

Note that we install git through "addons: apt: packages:" rather than
our tools/ci/install-latest-git.sh script.  This has the downside that
Git is installed unnecessarily, both for builds that have _DL_CRON set
and for builds where the bundled Git matches the latest upstream one.
We do it because otherwise the build exits (with a status of 0) right
after the installation happens [1].  The same happens if we use "dist:
trusty", which should have the third-party repositories enabled [2].

[0]: https://docs.travis-ci.com/user/reference/xenial/#third-party-apt-repositories-removed
[1]: https://travis-ci.org/datalad/datalad/jobs/550376442
[2]: https://travis-ci.org/datalad/datalad/builds/550835880

Re: datalad#3476
  • Loading branch information
kyleam committed Jun 26, 2019
1 parent aef2b8a commit 2dc7344
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ matrix:
- _DL_CRON=1
# Run with latest git rather than the bundled one.
- python: 3.5
addons:
apt:
sources:
- sourceline: 'ppa:git-core/ppa'
packages:
- git
env:
- DATALAD_USE_DEFAULT_GIT=1
- _DL_UPSTREAM_GIT=1
Expand Down Expand Up @@ -262,8 +268,8 @@ before_install:
- if [ ! -z "${_DL_UPSTREAM_GITANNEX:-}" ]; then sudo tools/ci/install-annex-snapshot.sh; sudo ln -s `find /usr/local/lib/git-annex.linux -maxdepth 1 -type f -perm /+x` /usr/local/bin/; else sudo eatmydata apt-get install git-annex-standalone ; fi
# Install optionally -devel version of annex, and if goes wrong (we have most recent), exit right away
- if [ ! -z "${_DL_DEVEL_ANNEX:-}" ]; then tools/ci/prep-travis-devel-annex.sh || exit 0; fi
# Optionally install the latest Git. Exit code 100 indicates that bundled is same as the latest.
- if [ ! -z "${_DL_UPSTREAM_GIT:-}" ]; then sudo tools/ci/install-latest-git.sh || [ $? -eq 100 ] && exit 0; fi
# Exit code 100 indicates that bundled is same as the latest.
- if [ ! -z "${_DL_UPSTREAM_GIT:-}" ]; then sudo tools/ci/check-latest-git.sh || [ $? -eq 100 ] && exit 0; fi

install:
# Install standalone build of git-annex for the recent enough version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

set -e -u

# NOTE: Travis already has ppa:git-core/ppa set up.
# NOTE: In .travis.yml, we've already set up ppa:git-core/ppa and installed the
# latest git. Ideally, we'd do the install here, but doing so causes the build
# exit right after for some reason.

# e.g., Candidate: 1:2.19.1-1~ppa0~ubuntu14.04.1
latest_git_version=$(apt-cache policy git | awk -F'[:-]' '/Candidate/{print $3;}')
Expand All @@ -19,6 +21,4 @@ elif [ -z "$latest_git_version" ]; then
elif [ "$latest_git_version" = "$bundled_git_version" ]; then
echo "I: latest git version $latest_git_version is same as bundled $bundled_git_version"
exit 100
else
sudo apt-get install -y git
fi

0 comments on commit 2dc7344

Please sign in to comment.