mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-14 03:00:29 +03:00
feat: add servergitmirrors as a dict support
This commit is contained in:
parent
12692b76b7
commit
947217549a
10 changed files with 118 additions and 22 deletions
|
|
@ -67,7 +67,7 @@ from pyasn1.error import PyAsn1Error
|
|||
import fdroidserver.metadata
|
||||
import fdroidserver.lint
|
||||
from fdroidserver import _
|
||||
from fdroidserver.exception import FDroidException, VCSException, NoSubmodulesException,\
|
||||
from fdroidserver.exception import FDroidException, VCSException, NoSubmodulesException, \
|
||||
BuildException, VerificationException, MetaDataException
|
||||
from .asynchronousfilereader import AsynchronousFileReader
|
||||
from .looseversion import LooseVersion
|
||||
|
|
@ -482,8 +482,10 @@ def read_config(opts=None):
|
|||
|
||||
if 'servergitmirrors' in config:
|
||||
if isinstance(config['servergitmirrors'], str):
|
||||
roots = [config['servergitmirrors']]
|
||||
roots = [{"url": config['servergitmirrors']}]
|
||||
elif all(isinstance(item, str) for item in config['servergitmirrors']):
|
||||
roots = [{'url': i} for i in config['servergitmirrors']]
|
||||
elif all(isinstance(item, dict) for item in config['servergitmirrors']):
|
||||
roots = config['servergitmirrors']
|
||||
else:
|
||||
raise TypeError(_('only accepts strings, lists, and tuples'))
|
||||
|
|
|
|||
|
|
@ -47,6 +47,19 @@ AUTO_S3CFG = '.fdroid-deploy-s3cfg'
|
|||
USER_S3CFG = 's3cfg'
|
||||
REMOTE_HOSTNAME_REGEX = re.compile(r'\W*\w+\W+(\w+).*')
|
||||
|
||||
INDEX_FILES = [
|
||||
"entry.jar",
|
||||
"entry.json",
|
||||
"entry.json.asc",
|
||||
"index-v1.jar",
|
||||
"index-v1.json",
|
||||
"index-v1.json.asc",
|
||||
"index-v2.json",
|
||||
"index-v2.json.asc",
|
||||
"index.jar",
|
||||
"index.xml",
|
||||
]
|
||||
|
||||
|
||||
def _get_index_excludes(repo_section):
|
||||
"""Return the list of files to be synced last, since they finalize the deploy.
|
||||
|
|
@ -447,7 +460,8 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
|||
repo = git.Repo.init(git_mirror_path, initial_branch=GIT_BRANCH)
|
||||
|
||||
enabled_remotes = []
|
||||
for remote_url in servergitmirrors:
|
||||
for d in servergitmirrors:
|
||||
remote_url = d['url']
|
||||
name = REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url)
|
||||
enabled_remotes.append(name)
|
||||
r = git.remote.Remote(repo, name)
|
||||
|
|
@ -840,10 +854,9 @@ def main():
|
|||
update_serverwebroots(
|
||||
config['serverwebroot'], repo_section, standardwebroot
|
||||
)
|
||||
if config.get('servergitmirrors', []):
|
||||
if config.get('servergitmirrors'):
|
||||
# update_servergitmirrors will take care of multiple mirrors so don't need a foreach
|
||||
servergitmirrors = config.get('servergitmirrors', [])
|
||||
update_servergitmirrors(servergitmirrors, repo_section)
|
||||
update_servergitmirrors(config['servergitmirrors'], repo_section)
|
||||
if config.get('awsbucket'):
|
||||
update_awsbucket(repo_section)
|
||||
if config.get('androidobservatory'):
|
||||
|
|
|
|||
|
|
@ -1478,7 +1478,7 @@ def add_mirrors_to_repodict(repo_section, repodict):
|
|||
repodict['mirrors'].insert(0, {'isPrimary': True, 'url': repodict['address']})
|
||||
|
||||
|
||||
def get_mirror_service_urls(url):
|
||||
def get_mirror_service_urls(mirror):
|
||||
"""Get direct URLs from git service for use by fdroidclient.
|
||||
|
||||
Via 'servergitmirrors', fdroidserver can create and push a mirror
|
||||
|
|
@ -1496,6 +1496,7 @@ def get_mirror_service_urls(url):
|
|||
information about the repo available to end user.
|
||||
|
||||
"""
|
||||
url = mirror['url']
|
||||
if url.startswith('git@'):
|
||||
url = re.sub(r'^git@([^:]+):(.+)', r'https://\1/\2', url)
|
||||
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
|
|||
'archive_url': repo_base + '/archive',
|
||||
'archive_description': 'Old nightly builds that have been archived.',
|
||||
'archive_older': options.archive_older,
|
||||
'servergitmirrors': servergitmirror,
|
||||
'servergitmirrors': [{"url": servergitmirror}],
|
||||
'keystore': KEYSTORE_FILE,
|
||||
'repo_keyalias': KEY_ALIAS,
|
||||
'keystorepass': PASSWORD,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue