|
24 | 24 | function install_apx() { |
25 | 25 | local name=$1 |
26 | 26 | local version=$2 |
27 | | - local root=https://svn.apache.org/repos/asf/apr/${name} |
28 | 27 | local prefix=${HOME}/root/${name}-${version} |
29 | 28 | local build=${HOME}/build/${name}-${version} |
30 | 29 | local giturl=https://github.com/apache/${name}.git |
31 | 30 | local config=$3 |
32 | 31 | local buildconf=$4 |
33 | 32 |
|
34 | 33 | 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} ;; |
38 | 36 | esac |
39 | 37 |
|
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 |
41 | 44 |
|
42 | 45 | # Blow away the cached install root if the cached install is stale |
43 | 46 | # 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} |
45 | 48 |
|
46 | 49 | if test -d ${prefix}; then |
47 | 50 | return 0 |
48 | 51 | fi |
49 | 52 |
|
50 | | - git clone -q --depth=1 --branch=$version ${giturl} ${build} |
| 53 | + git init -q ${build} |
51 | 54 | 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} |
52 | 59 | ./buildconf ${buildconf} |
53 | 60 | ./configure --prefix=${prefix} ${config} |
54 | 61 | make -j2 |
55 | 62 | make install |
56 | 63 | popd |
57 | 64 |
|
58 | | - echo ${version} ${revision} "${config}" "CC=${CC}" > ${HOME}/root/.key-${name} |
| 65 | + echo ${version} ${commit} "${config}" "CC=${CC}" > ${HOME}/root/.key-${name} |
59 | 66 | } |
60 | 67 |
|
61 | 68 | # Allow to load $HOME/build/apache/httpd/.gdbinit |
|
0 commit comments