1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-05 18:50:09 +02:00

git mirror test requires git >= 2.3

This commit is contained in:
Hans-Christoph Steiner 2017-04-12 15:26:51 +02:00
parent fcb0634eaa
commit 31d92367ed

View File

@ -41,6 +41,11 @@ create_test_file() {
TMPDIR=$WORKSPACE/.testfiles mktemp 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" # "main"
@ -602,15 +607,19 @@ echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
$fdroid update --verbose $fdroid update --verbose
$fdroid server update --verbose if have_git_2_3; then
test -e repo/index.xml $fdroid server update --verbose
test -e repo/index.jar test -e repo/index.xml
test -e repo/index-v1.jar test -e repo/index.jar
grep -F '<application id=' repo/index.xml > /dev/null test -e repo/index-v1.jar
cd binary_transparency grep -F '<application id=' repo/index.xml > /dev/null
[ `git rev-list --count HEAD` == "2" ] cd binary_transparency
cd $GIT_REMOTE [ `git rev-list --count HEAD` == "2" ]
[ `git rev-list --count HEAD` == "2" ] cd $GIT_REMOTE
[ `git rev-list --count HEAD` == "2" ]
else
echo "Skipping test, `git --version` older than 2.3"
fi
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
@ -683,7 +692,9 @@ BINARY_TRANSPARENCY_REMOTE=`create_test_dir`
SERVER_GIT_MIRROR=`create_test_dir` SERVER_GIT_MIRROR=`create_test_dir`
cd $SERVER_GIT_MIRROR cd $SERVER_GIT_MIRROR
git init git init
git config receive.denyCurrentBranch updateInstead if have_git_2_3; then
git config receive.denyCurrentBranch updateInstead
fi
cd $OFFLINE_ROOT cd $OFFLINE_ROOT
$fdroid init --keystore $KEYSTORE --repo-keyalias=sova $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
@ -699,20 +710,24 @@ grep -F '<application id=' repo/index.xml > /dev/null
cd binary_transparency cd binary_transparency
[ `git rev-list --count HEAD` == "1" ] [ `git rev-list --count HEAD` == "1" ]
cd .. cd ..
$fdroid server update --verbose if have_git_2_3; then
grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null $fdroid server update --verbose
cd $ONLINE_ROOT grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py cd $ONLINE_ROOT
echo "sync_from_local_copy_dir = True" >> config.py echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
echo "serverwebroots = '$SERVERWEBROOT'" >> config.py echo "sync_from_local_copy_dir = True" >> config.py
echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py echo "serverwebroots = '$SERVERWEBROOT'" >> config.py
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
$fdroid server update --verbose echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py
cd $BINARY_TRANSPARENCY_REMOTE $fdroid server update --verbose
[ `git rev-list --count HEAD` == "1" ] cd $BINARY_TRANSPARENCY_REMOTE
cd $SERVER_GIT_MIRROR [ `git rev-list --count HEAD` == "1" ]
[ `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
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#