1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-01 00:30:13 +02:00

deploy: upload to VirusTotal using index-v1.json or index-v1.jar

* A mirror of the repo will have only index-v1.jar.
* A buildserver with separate signing might have only index-v1.json
This commit is contained in:
Hans-Christoph Steiner 2018-12-17 14:33:02 +01:00
parent 869cc114a3
commit 33b097a3aa

View File

@ -31,6 +31,7 @@ import shutil
from . import _ from . import _
from . import common from . import common
from . import index
from .exception import FDroidException from .exception import FDroidException
config = None config = None
@ -478,9 +479,14 @@ def upload_to_virustotal(repo_section, vt_apikey):
if repo_section == 'repo': if repo_section == 'repo':
if not os.path.exists('virustotal'): if not os.path.exists('virustotal'):
os.mkdir('virustotal') os.mkdir('virustotal')
with open(os.path.join(repo_section, 'index-v1.json')) as fp:
index = json.load(fp) if os.path.exists(os.path.join(repo_section, 'index-v1.json')):
for packageName, packages in index['packages'].items(): with open(os.path.join(repo_section, 'index-v1.json')) as fp:
data = json.load(fp)
else:
data, _ignored, _ignored = index.get_index_from_jar(os.path.join(repo_section, 'index-v1.jar'))
for packageName, packages in data['packages'].items():
for package in packages: for package in packages:
outputfilename = os.path.join('virustotal', outputfilename = os.path.join('virustotal',
packageName + '_' + str(package.get('versionCode')) packageName + '_' + str(package.get('versionCode'))