Skip to content

Commit 65d5f9e

Browse files
committed
CI: Use the git commit hash to determine the revision of APR/APR-util
from the github repos, and build exactly that, rather than relying on SVN: - works if apr/apr-util moves to a r/w git in the future - removes a race for branches where the git revision tested could be different to the SVN revision retrieved before Github: closes #528 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1924958 13f79535-47bb-0310-9956-ffa450edef68
1 parent e6cfbfa commit 65d5f9e

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/travis_before_linux.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,45 @@ fi
2424
function install_apx() {
2525
local name=$1
2626
local version=$2
27-
local root=https://svn.apache.org/repos/asf/apr/${name}
2827
local prefix=${HOME}/root/${name}-${version}
2928
local build=${HOME}/build/${name}-${version}
3029
local giturl=https://github.com/apache/${name}.git
3130
local config=$3
3231
local buildconf=$4
3332

3433
case $version in
35-
trunk) url=${root}/trunk ;;
36-
*.x) url=${root}/branches/${version} ;;
37-
*) url=${root}/tags/${version} ;;
34+
trunk|*.x) ref=refs/heads/${version} ;;
35+
*) ref=refs/tags/${version} ;;
3836
esac
3937

40-
local revision=`svn info --show-item last-changed-revision ${url}`
38+
# Fetch the object ID (hash) of latest commit
39+
local commit=`git ls-remote ${giturl} ${ref} | cut -f1`
40+
if test -z "$commit"; then
41+
: Could not determine latest commit hash for ${ref} in ${giturl} - check branch is valid?
42+
exit 1
43+
fi
4144

4245
# Blow away the cached install root if the cached install is stale
4346
# or doesn't match the expected configuration.
44-
grep -q "${version} ${revision} ${config} CC=$CC" ${HOME}/root/.key-${name} || rm -rf ${prefix}
47+
grep -q "${version} ${commit} ${config} CC=$CC" ${HOME}/root/.key-${name} || rm -rf ${prefix}
4548

4649
if test -d ${prefix}; then
4750
return 0
4851
fi
4952

50-
git clone -q --depth=1 --branch=$version ${giturl} ${build}
53+
git init -q ${build}
5154
pushd $build
55+
# Clone and checkout the commit identified above.
56+
git remote add origin ${giturl}
57+
git fetch -q --depth=1 origin ${commit}
58+
git checkout ${commit}
5259
./buildconf ${buildconf}
5360
./configure --prefix=${prefix} ${config}
5461
make -j2
5562
make install
5663
popd
5764

58-
echo ${version} ${revision} "${config}" "CC=${CC}" > ${HOME}/root/.key-${name}
65+
echo ${version} ${commit} "${config}" "CC=${CC}" > ${HOME}/root/.key-${name}
5966
}
6067

6168
# Allow to load $HOME/build/apache/httpd/.gdbinit

0 commit comments

Comments
 (0)