mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
server: git push for binary transparency in fdroid server update
Since `fdroid server update` is the place where all uploads to servers happens, it makes sense to also handle the git push for the binary transparency log here instead of `fdroid btlog`
This commit is contained in:
parent
e3152e9ef0
commit
299ba86948
4 changed files with 22 additions and 30 deletions
|
|
@ -281,20 +281,20 @@ def upload_to_virustotal(repo_section, vt_apikey):
|
|||
logging.info(response['verbose_msg'] + " " + response['permalink'])
|
||||
|
||||
|
||||
def push_binary_transparency(binary_transparency_remote):
|
||||
def push_binary_transparency(git_repo_path, git_remote):
|
||||
'''push the binary transparency git repo to the specifed remote'''
|
||||
import git
|
||||
|
||||
repo = git.Repo('binary_transparency_log')
|
||||
pushremote = None
|
||||
for remote in repo.remotes:
|
||||
if remote.url == binary_transparency_remote:
|
||||
pushremote = remote
|
||||
break
|
||||
|
||||
if not pushremote:
|
||||
pushremote = repo.create_remote('fdroid_server_update', binary_transparency_remote)
|
||||
pushremote.push('master')
|
||||
logging.info('Pushing binary transparency log to ' + git_remote)
|
||||
gitrepo = git.Repo(git_repo_path)
|
||||
origin = git.remote.Remote(gitrepo, 'origin')
|
||||
if origin in gitrepo.remotes:
|
||||
origin = gitrepo.remote('origin')
|
||||
if 'set_url' in dir(origin): # added in GitPython 2.x
|
||||
origin.set_url(git_remote)
|
||||
else:
|
||||
origin = gitrepo.create_remote('origin', git_remote)
|
||||
origin.push('master')
|
||||
|
||||
|
||||
def main():
|
||||
|
|
@ -377,10 +377,11 @@ def main():
|
|||
and not config.get('serverwebroot') \
|
||||
and not config.get('servergitmirrors') \
|
||||
and not config.get('androidobservatory') \
|
||||
and not config.get('binary_transparency_remote') \
|
||||
and not config.get('virustotal_apikey') \
|
||||
and local_copy_dir is None:
|
||||
logging.warn('No option set! Edit your config.py to set at least one among:\n'
|
||||
+ 'serverwebroot, servergitmirrors, local_copy_dir, awsbucket, virustotal_apikey or androidobservatory')
|
||||
+ 'serverwebroot, servergitmirrors, local_copy_dir, awsbucket, virustotal_apikey, androidobservatory, or binary_transparency_remote')
|
||||
sys.exit(1)
|
||||
|
||||
repo_sections = ['repo']
|
||||
|
|
@ -435,7 +436,7 @@ def main():
|
|||
|
||||
binary_transparency_remote = config.get('binary_transparency_remote')
|
||||
if binary_transparency_remote:
|
||||
push_binary_transparency(binary_transparency_remote)
|
||||
push_binary_transparency('binary_transparency', binary_transparency_remote)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue