@@ -163,17 +163,29 @@ if test -v TEST_SSL; then
163163 popd
164164fi
165165
166+ # Build the requested version of OpenSSL if it's not already installed
167+ # in the cached ~/root
166168if test -v TEST_OPENSSL3; then
167- # Build the requested version of OpenSSL if it's not already
168- # installed in the cached ~/root
169+ # For a branch, rebuild if the remote branch has updated.
170+ if test -v TEST_OPENSSL3_BRANCH -a -f $HOME /root/openssl-is-${TEST_OPENSSL3} ; then
171+ latest=` git ls-remote -b $TEST_OPENSSL3_BRANCH https://github.com/openssl/openssl refs/heads/${TEST_OPENSSL3_BRANCH} | cut -f1`
172+ : Got branch latest commit ${latest}
173+ if grep -q ^${latest} $HOME /root/openssl-is-${TEST_OPENSSL3} ; then
174+ : Cached repos already at ${latest}
175+ else
176+ : Forcing rebuild
177+ rm -f $HOME /root/openssl-is-${TEST_OPENSSL3}
178+ fi
179+ fi
180+
169181 if ! test -f $HOME /root/openssl-is-${TEST_OPENSSL3} ; then
170182 # Remove any previous install.
171183 rm -rf $HOME /root/openssl3
172184
173185 mkdir -p build/openssl
174186 pushd build/openssl
175187 if test -v TEST_OPENSSL3_BRANCH; then
176- git clone -b $TEST_OPENSSL3_BRANCH -q https://github.com/openssl/openssl openssl-${TEST_OPENSSL3}
188+ git clone --depth=1 - b $TEST_OPENSSL3_BRANCH -q https://github.com/openssl/openssl openssl-${TEST_OPENSSL3}
177189 else
178190 curl -L " https://github.com/openssl/openssl/releases/download/openssl-${TEST_OPENSSL3} /openssl-${TEST_OPENSSL3} .tar.gz" |
179191 tar -xzf -
@@ -185,7 +197,11 @@ if test -v TEST_OPENSSL3; then
185197 ' -Wl,-rpath=$(LIBRPATH)'
186198 make $MFLAGS
187199 make install_sw
188- touch $HOME /root/openssl-is-${TEST_OPENSSL3}
200+ if test -d .git; then
201+ git rev-parse HEAD > $HOME /root/openssl-is-${TEST_OPENSSL3}
202+ else
203+ touch $HOME /root/openssl-is-${TEST_OPENSSL3}
204+ fi
189205 popd
190206 fi
191207
0 commit comments