mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-05 17:01:06 +03:00
Merge branch '148-no-verify-logs-on-split-build-publish-infrastructure' into 'master'
compare apk with Binaries from metadata right after building Closes #148 See merge request !247
This commit is contained in:
commit
591bfc4474
5 changed files with 44 additions and 8 deletions
|
@ -9,5 +9,5 @@ ndk_paths = {
|
||||||
}
|
}
|
||||||
qt_sdk_path = "/home/vagrant/qt-sdk/5.7.0/5.7"
|
qt_sdk_path = "/home/vagrant/qt-sdk/5.7.0/5.7"
|
||||||
java_paths = {
|
java_paths = {
|
||||||
'8': "/usr/lib/jvm/java-8-openjdk-i386",
|
'8': "/usr/lib/jvm/java-8-openjdk-amd64",
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import traceback
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
import tempfile
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
import logging
|
import logging
|
||||||
|
@ -1211,15 +1212,50 @@ def main():
|
||||||
url = url.replace('%v', build.versionName)
|
url = url.replace('%v', build.versionName)
|
||||||
url = url.replace('%c', str(build.versionCode))
|
url = url.replace('%c', str(build.versionCode))
|
||||||
logging.info("...retrieving " + url)
|
logging.info("...retrieving " + url)
|
||||||
of = "{0}_{1}.apk.binary".format(app.id, build.versionCode)
|
of = common.get_release_filename(app, build) + '.binary'
|
||||||
of = os.path.join(output_dir, of)
|
of = os.path.join(output_dir, of)
|
||||||
try:
|
try:
|
||||||
net.download_file(url, local_filename=of)
|
net.download_file(url, local_filename=of)
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
raise FDroidException('downloading Binaries from %s failed' % url) from e
|
raise FDroidException('downloading Binaries from %s failed' % url) from e
|
||||||
|
|
||||||
|
# Now we check weather the build can be verified to
|
||||||
|
# match the supplied binary or not. Should the
|
||||||
|
# comparison fail, we mark this build as a failure
|
||||||
|
# and remove everything from the unsigend folder.
|
||||||
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
unsigned_apk = \
|
||||||
|
common.get_release_filename(app, build)
|
||||||
|
unsigned_apk = \
|
||||||
|
os.path.join(output_dir, unsigned_apk)
|
||||||
|
compare_result = \
|
||||||
|
common.verify_apks(of, unsigned_apk, tmpdir)
|
||||||
|
if compare_result:
|
||||||
|
logging.debug('removing %s', unsigned_apk)
|
||||||
|
os.remove(unsigned_apk)
|
||||||
|
logging.debug('removing %s', of)
|
||||||
|
os.remove(of)
|
||||||
|
compare_result = compare_result.split('\n')
|
||||||
|
line_count = len(compare_result)
|
||||||
|
compare_result = compare_result[:299]
|
||||||
|
if line_count > len(compare_result):
|
||||||
|
line_difference = \
|
||||||
|
line_count - len(compare_result)
|
||||||
|
compare_result.append('%d more lines ...' %
|
||||||
|
line_difference)
|
||||||
|
compare_result = '\n'.join(compare_result)
|
||||||
|
raise FDroidException('compared built binary '
|
||||||
|
'to supplied reference '
|
||||||
|
'binary but failed',
|
||||||
|
compare_result)
|
||||||
|
else:
|
||||||
|
logging.info('compared built binary to '
|
||||||
|
'supplied reference binary '
|
||||||
|
'successfully')
|
||||||
|
|
||||||
build_succeeded.append(app)
|
build_succeeded.append(app)
|
||||||
wikilog = "Build succeeded"
|
wikilog = "Build succeeded"
|
||||||
|
|
||||||
except VCSException as vcse:
|
except VCSException as vcse:
|
||||||
reason = str(vcse).split('\n', 1)[0] if options.verbose else str(vcse)
|
reason = str(vcse).split('\n', 1)[0] if options.verbose else str(vcse)
|
||||||
logging.error("VCS error while building app %s: %s" % (
|
logging.error("VCS error while building app %s: %s" % (
|
||||||
|
|
|
@ -2020,7 +2020,8 @@ def verify_apks(signed_apk, unsigned_apk, tmp_dir):
|
||||||
|
|
||||||
if not verified:
|
if not verified:
|
||||||
logging.info("...NOT verified - {0}".format(tmp_apk))
|
logging.info("...NOT verified - {0}".format(tmp_apk))
|
||||||
return compare_apks(signed_apk, tmp_apk, tmp_dir, os.path.dirname(unsigned_apk))
|
return compare_apks(signed_apk, tmp_apk, tmp_dir,
|
||||||
|
os.path.dirname(unsigned_apk))
|
||||||
|
|
||||||
logging.info("...successfully verified")
|
logging.info("...successfully verified")
|
||||||
return None
|
return None
|
||||||
|
@ -2101,9 +2102,8 @@ def compare_apks(apk1, apk2, tmp_dir, log_dir=None):
|
||||||
p = FDroidPopen(['diff', '-r', apk1dir, apk2dir], output=False)
|
p = FDroidPopen(['diff', '-r', apk1dir, apk2dir], output=False)
|
||||||
lines = p.output.splitlines()
|
lines = p.output.splitlines()
|
||||||
if len(lines) != 1 or 'META-INF' not in lines[0]:
|
if len(lines) != 1 or 'META-INF' not in lines[0]:
|
||||||
meld = find_command('meld')
|
if set_command_in_config('meld'):
|
||||||
if meld is not None:
|
p = FDroidPopen([config['meld'], apk1dir, apk2dir], output=False)
|
||||||
p = FDroidPopen(['meld', apk1dir, apk2dir], output=False)
|
|
||||||
return("Unexpected diff output - " + p.output)
|
return("Unexpected diff output - " + p.output)
|
||||||
|
|
||||||
# since everything verifies, delete the comparison to keep cruft down
|
# since everything verifies, delete the comparison to keep cruft down
|
||||||
|
|
|
@ -467,7 +467,7 @@ def main():
|
||||||
for build in app.builds:
|
for build in app.builds:
|
||||||
apks = []
|
apks = []
|
||||||
for f in os.listdir(options.repo_path):
|
for f in os.listdir(options.repo_path):
|
||||||
n = "%v_%v.apk".format(app_id, build.versionCode)
|
n = common.get_release_filename(app, build)
|
||||||
if f == n:
|
if f == n:
|
||||||
apks.append(f)
|
apks.append(f)
|
||||||
for apk in sorted(apks):
|
for apk in sorted(apks):
|
||||||
|
|
|
@ -319,7 +319,7 @@ def delete_disabled_builds(apps, apkcache, repodirs):
|
||||||
for build in app['builds']:
|
for build in app['builds']:
|
||||||
if not build.disable:
|
if not build.disable:
|
||||||
continue
|
continue
|
||||||
apkfilename = appid + '_' + str(build.versionCode) + '.apk'
|
apkfilename = common.get_release_filename(app, build)
|
||||||
iconfilename = "%s.%s.png" % (
|
iconfilename = "%s.%s.png" % (
|
||||||
appid,
|
appid,
|
||||||
build.versionCode)
|
build.versionCode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue