Merge branch 'bug-fixes' into 'master'

status JSON and --scan-binary should not exit with error when apkanalyzer fails

Closes #825

See merge request fdroid/fdroidserver!886
This commit is contained in:
Sylvia van Os 2021-03-15 10:33:31 +00:00
commit d5a3182ce9
3 changed files with 17 additions and 4 deletions

View file

@ -1052,8 +1052,10 @@ def main():
# Build applications... # Build applications...
failed_builds = [] failed_builds = []
build_succeeded = [] build_succeeded = []
build_succeeded_ids = []
status_output['failedBuilds'] = failed_builds status_output['failedBuilds'] = failed_builds
status_output['successfulBuilds'] = build_succeeded status_output['successfulBuilds'] = build_succeeded
status_output['successfulBuildIds'] = build_succeeded_ids
# Only build for 72 hours, then stop gracefully. # Only build for 72 hours, then stop gracefully.
endtime = time.time() + 72 * 60 * 60 endtime = time.time() + 72 * 60 * 60
max_build_time_reached = False max_build_time_reached = False
@ -1167,6 +1169,7 @@ def main():
'successfully') 'successfully')
build_succeeded.append(app) build_succeeded.append(app)
build_succeeded_ids.append([app['id'], build.versionCode])
wikilog = "Build succeeded" wikilog = "Build succeeded"
except VCSException as vcse: except VCSException as vcse:

View file

@ -103,12 +103,20 @@ def get_gradle_compile_commands(build):
def scan_binary(apkfile): def scan_binary(apkfile):
logging.info("Scanning APK for known non-free classes.") """Scan output of apkanalyzer for known non-free classes
apkanalyzer produces useful output when it can run, but it does
not support all recent JDK versions, and also some DEX versions,
so this cannot count on it to always produce useful output or even
to run without exiting with an error.
"""
logging.info(_('Scanning APK with apkanalyzer for known non-free classes.'))
result = common.SdkToolsPopen(["apkanalyzer", "dex", "packages", "--defined-only", apkfile], output=False) result = common.SdkToolsPopen(["apkanalyzer", "dex", "packages", "--defined-only", apkfile], output=False)
problems = 0
if result.returncode != 0: if result.returncode != 0:
problems += 1 logging.warning(_('scanner not cleanly run apkanalyzer: %s') % result.output)
logging.error(result.output) problems = 0
for suspect, regexp in CODE_SIGNATURES.items(): for suspect, regexp in CODE_SIGNATURES.items():
matches = regexp.findall(result.output) matches = regexp.findall(result.output)
if matches: if matches:

View file

@ -569,6 +569,8 @@ def main():
for d in ('.m2', '.gradle/caches', '.gradle/wrapper', '.pip_download_cache'): for d in ('.m2', '.gradle/caches', '.gradle/wrapper', '.pip_download_cache'):
fullpath = os.path.join(os.getenv('HOME'), d) fullpath = os.path.join(os.getenv('HOME'), d)
os.system('date')
print('rsyncing', fullpath, 'into VM')
if os.path.isdir(fullpath): if os.path.isdir(fullpath):
ssh_command = ' '.join(('ssh -i {0} -p {1}'.format(key, port), ssh_command = ' '.join(('ssh -i {0} -p {1}'.format(key, port),
'-o StrictHostKeyChecking=no', '-o StrictHostKeyChecking=no',