From 31d92367eddb8b5019b1b4af042441db4214aae7 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 12 Apr 2017 15:26:51 +0200 Subject: [PATCH] git mirror test requires git >= 2.3 --- tests/run-tests | 63 ++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/tests/run-tests b/tests/run-tests index ac3665a7..563145a5 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -41,6 +41,11 @@ create_test_file() { TMPDIR=$WORKSPACE/.testfiles mktemp } +# the < is reverse since 0 means success in exit codes +have_git_2_3() { + python3 -c "import sys; from distutils.version import LooseVersion as V; sys.exit(V(sys.argv[3]) < V('2.3'))" `git --version` +} + #------------------------------------------------------------------------------# # "main" @@ -602,15 +607,19 @@ echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py $fdroid update --verbose -$fdroid server update --verbose -test -e repo/index.xml -test -e repo/index.jar -test -e repo/index-v1.jar -grep -F '> config.py -echo "sync_from_local_copy_dir = True" >> config.py -echo "serverwebroots = '$SERVERWEBROOT'" >> config.py -echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py -echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py -echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py -$fdroid server update --verbose -cd $BINARY_TRANSPARENCY_REMOTE -[ `git rev-list --count HEAD` == "1" ] -cd $SERVER_GIT_MIRROR -[ `git rev-list --count HEAD` == "1" ] +if have_git_2_3; then + $fdroid server update --verbose + grep -F '> config.py + echo "sync_from_local_copy_dir = True" >> config.py + echo "serverwebroots = '$SERVERWEBROOT'" >> config.py + echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py + echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py + echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py + $fdroid server update --verbose + cd $BINARY_TRANSPARENCY_REMOTE + [ `git rev-list --count HEAD` == "1" ] + cd $SERVER_GIT_MIRROR + [ `git rev-list --count HEAD` == "1" ] +else + echo "Skipping test, `git --version` older than 2.3" +fi #------------------------------------------------------------------------------#