]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1924958 from trunk:
authorJoe Orton <jorton@apache.org>
Wed, 9 Apr 2025 15:18:19 +0000 (15:18 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 9 Apr 2025 15:18:19 +0000 (15:18 +0000)
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

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1924962 13f79535-47bb-0310-9956-ffa450edef68

test/travis_before_linux.sh

index 59aea2f2349642cf4252b9d3a865e833f3aa03f2..38591a66d33863c10a2911954735f1158b583364 100755 (executable)
@@ -24,7 +24,6 @@ fi
 function install_apx() {
     local name=$1
     local version=$2
-    local root=https://svn.apache.org/repos/asf/apr/${name}
     local prefix=${HOME}/root/${name}-${version}
     local build=${HOME}/build/${name}-${version}
     local giturl=https://github.com/apache/${name}.git
@@ -32,30 +31,38 @@ function install_apx() {
     local buildconf=$4
 
     case $version in
-    trunk) url=${root}/trunk ;;
-    *.x) url=${root}/branches/${version} ;;
-    *) url=${root}/tags/${version} ;;
+    trunk|*.x) ref=refs/heads/${version} ;;
+    *) ref=refs/tags/${version} ;;
     esac
 
-    local revision=`svn info --show-item last-changed-revision ${url}`
+    # Fetch the object ID (hash) of latest commit
+    local commit=`git ls-remote ${giturl} ${ref} | cut -f1`
+    if test -z "$commit"; then
+        : Could not determine latest commit hash for ${ref} in ${giturl} - check branch is valid?
+        exit 1
+    fi
 
     # Blow away the cached install root if the cached install is stale
     # or doesn't match the expected configuration.
-    grep -q "${version} ${revision} ${config} CC=$CC" ${HOME}/root/.key-${name} || rm -rf ${prefix}
+    grep -q "${version} ${commit} ${config} CC=$CC" ${HOME}/root/.key-${name} || rm -rf ${prefix}
 
     if test -d ${prefix}; then
         return 0
     fi
 
-    git clone -q --depth=1 --branch=$version ${giturl} ${build}
+    git init -q ${build}
     pushd $build
+         # Clone and checkout the commit identified above.
+         git remote add origin ${giturl}
+         git fetch -q --depth=1 origin ${commit}
+         git checkout ${commit}
          ./buildconf ${buildconf}
          ./configure --prefix=${prefix} ${config}
          make -j2
          make install
     popd
 
-    echo ${version} ${revision} "${config}" "CC=${CC}" > ${HOME}/root/.key-${name}
+    echo ${version} ${commit} "${config}" "CC=${CC}" > ${HOME}/root/.key-${name}
 }
 
 # Allow to load $HOME/build/apache/httpd/.gdbinit