From 17219d56f4d9e42b0f3b71ad9c1f8bfa87382e4c Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 11 Apr 2017 23:46:14 +0200 Subject: [PATCH] server: support git mirrors with the offline signing setup --- fdroidserver/server.py | 17 +++++++++++- tests/run-tests | 63 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/fdroidserver/server.py b/fdroidserver/server.py index df8d5c80..0f2b5f7e 100644 --- a/fdroidserver/server.py +++ b/fdroidserver/server.py @@ -223,8 +223,23 @@ def update_localcopy(repo_section, local_copy_dir): def update_servergitmirrors(servergitmirrors, repo_section): - # depend on GitPython only if users set a git mirror + '''update repo mirrors stored in git repos + + This is a hack to use public git repos as F-Droid repos. It + recreates the git repo from scratch each time, so that there is no + history. That keeps the size of the git repo small. Services + like GitHub or GitLab have a size limit of something like 1 gig. + This git repo is only a git repo for the purpose of being hosted. + For history, there is the archive section, and there is the binary + transparency log. + + ''' import git + if config.get('local_copy_dir') \ + and not config.get('sync_from_local_copy_dir'): + logging.debug('Offline machine, skipping git mirror generation until `fdroid server update`') + return + # right now we support only 'repo' git-mirroring if repo_section == 'repo': git_mirror_path = 'git-mirror' diff --git a/tests/run-tests b/tests/run-tests index 43641c4e..ac3665a7 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -591,17 +591,15 @@ set -e echo_header "copy tests/repo, update with binary transparency log" REPOROOT=`create_test_dir` +GIT_REMOTE=`create_test_dir` GNUPGHOME=$REPOROOT/gnupghome KEYSTORE=$WORKSPACE/tests/keystore.jks -mkdir $REPOROOT/git_remote -cd $REPOROOT/git_remote -git init --bare cd $REPOROOT $fdroid init --keystore $KEYSTORE --repo-keyalias=sova cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/ echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py -echo "binary_transparency_remote = '$REPOROOT/git_remote'" >> 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 @@ -611,7 +609,7 @@ test -e repo/index-v1.jar grep -F '> config.py +echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py +echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py +echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py +$fdroid 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" ] + + #------------------------------------------------------------------------------# # remove this to prevent git conflicts and complaining -- 2.30.2