From 33b097a3aa347a34c63c9c8e3dbc4766b88929ee Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 17 Dec 2018 14:33:02 +0100 Subject: [PATCH] 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 --- fdroidserver/server.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fdroidserver/server.py b/fdroidserver/server.py index 5f1720b1..ac9cba03 100644 --- a/fdroidserver/server.py +++ b/fdroidserver/server.py @@ -31,6 +31,7 @@ import shutil from . import _ from . import common +from . import index from .exception import FDroidException config = None @@ -478,9 +479,14 @@ def upload_to_virustotal(repo_section, vt_apikey): if repo_section == 'repo': if not os.path.exists('virustotal'): os.mkdir('virustotal') - with open(os.path.join(repo_section, 'index-v1.json')) as fp: - index = json.load(fp) - for packageName, packages in index['packages'].items(): + + if os.path.exists(os.path.join(repo_section, 'index-v1.json')): + 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: outputfilename = os.path.join('virustotal', packageName + '_' + str(package.get('versionCode'))