mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-04 02:00:11 +02:00
server: support git mirrors with the offline signing setup
This commit is contained in:
parent
d3b9dbece9
commit
17219d56f4
@ -223,8 +223,23 @@ def update_localcopy(repo_section, local_copy_dir):
|
|||||||
|
|
||||||
|
|
||||||
def update_servergitmirrors(servergitmirrors, repo_section):
|
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
|
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
|
# right now we support only 'repo' git-mirroring
|
||||||
if repo_section == 'repo':
|
if repo_section == 'repo':
|
||||||
git_mirror_path = 'git-mirror'
|
git_mirror_path = 'git-mirror'
|
||||||
|
@ -591,17 +591,15 @@ set -e
|
|||||||
echo_header "copy tests/repo, update with binary transparency log"
|
echo_header "copy tests/repo, update with binary transparency log"
|
||||||
|
|
||||||
REPOROOT=`create_test_dir`
|
REPOROOT=`create_test_dir`
|
||||||
|
GIT_REMOTE=`create_test_dir`
|
||||||
GNUPGHOME=$REPOROOT/gnupghome
|
GNUPGHOME=$REPOROOT/gnupghome
|
||||||
KEYSTORE=$WORKSPACE/tests/keystore.jks
|
KEYSTORE=$WORKSPACE/tests/keystore.jks
|
||||||
mkdir $REPOROOT/git_remote
|
|
||||||
cd $REPOROOT/git_remote
|
|
||||||
git init --bare
|
|
||||||
cd $REPOROOT
|
cd $REPOROOT
|
||||||
$fdroid init --keystore $KEYSTORE --repo-keyalias=sova
|
$fdroid init --keystore $KEYSTORE --repo-keyalias=sova
|
||||||
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
||||||
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
||||||
echo 'keypass = "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
|
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
|
||||||
$fdroid update --verbose
|
$fdroid update --verbose
|
||||||
$fdroid server update --verbose
|
$fdroid server update --verbose
|
||||||
@ -611,7 +609,7 @@ test -e repo/index-v1.jar
|
|||||||
grep -F '<application id=' repo/index.xml > /dev/null
|
grep -F '<application id=' repo/index.xml > /dev/null
|
||||||
cd binary_transparency
|
cd binary_transparency
|
||||||
[ `git rev-list --count HEAD` == "2" ]
|
[ `git rev-list --count HEAD` == "2" ]
|
||||||
cd $REPOROOT/git_remote
|
cd $GIT_REMOTE
|
||||||
[ `git rev-list --count HEAD` == "2" ]
|
[ `git rev-list --count HEAD` == "2" ]
|
||||||
|
|
||||||
|
|
||||||
@ -662,6 +660,61 @@ $fdroid update --create-key
|
|||||||
test -e $KEYSTORE
|
test -e $KEYSTORE
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------#
|
||||||
|
echo_header "sign binary repo in offline box, then publishing from online box"
|
||||||
|
|
||||||
|
OFFLINE_ROOT=`create_test_dir`
|
||||||
|
KEYSTORE=$WORKSPACE/tests/keystore.jks
|
||||||
|
LOCAL_COPY_DIR=`create_test_dir`/fdroid
|
||||||
|
mkdir $LOCAL_COPY_DIR
|
||||||
|
ONLINE_ROOT=`create_test_dir`
|
||||||
|
SERVERWEBROOT=`create_test_dir`
|
||||||
|
|
||||||
|
# create offline binary transparency log
|
||||||
|
cd $OFFLINE_ROOT
|
||||||
|
mkdir binary_transparency
|
||||||
|
cd binary_transparency
|
||||||
|
git init
|
||||||
|
|
||||||
|
# fake git remote server for binary transparency log
|
||||||
|
BINARY_TRANSPARENCY_REMOTE=`create_test_dir`
|
||||||
|
|
||||||
|
# fake git remote server for repo mirror
|
||||||
|
SERVER_GIT_MIRROR=`create_test_dir`
|
||||||
|
cd $SERVER_GIT_MIRROR
|
||||||
|
git init
|
||||||
|
git config receive.denyCurrentBranch updateInstead
|
||||||
|
|
||||||
|
cd $OFFLINE_ROOT
|
||||||
|
$fdroid init --keystore $KEYSTORE --repo-keyalias=sova
|
||||||
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/
|
||||||
|
|
||||||
|
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> 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 '<application id=' repo/index.xml > /dev/null
|
||||||
|
cd binary_transparency
|
||||||
|
[ `git rev-list --count HEAD` == "1" ]
|
||||||
|
cd ..
|
||||||
|
$fdroid server update --verbose
|
||||||
|
grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null
|
||||||
|
cd $ONLINE_ROOT
|
||||||
|
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> 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
|
# remove this to prevent git conflicts and complaining
|
||||||
|
Loading…
Reference in New Issue
Block a user