From c5c244ccbdb9802c97e042391df379d0c5222eb2 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 14 Dec 2016 15:54:01 +0100 Subject: [PATCH] generate HTML diff from verify using diffoscope If diffoscope is installed, then use it to generate HTML diffs of all verification builds. --- fdroidserver/common.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index b8a506a5..bad34a96 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1998,6 +1998,23 @@ def compare_apks(apk1, apk2, tmp_dir): trying to do the comparison. """ + absapk1 = os.path.abspath(apk1) + absapk2 = os.path.abspath(apk2) + + # try to find diffoscope in the path, if it hasn't been manually configed + if 'diffoscope' not in config: + tmp = find_command('diffoscope') + if tmp is not None: + config['diffoscope'] = tmp + if 'diffoscope' in config: + htmlfile = absapk1 + '.diffoscope.html' + textfile = absapk1 + '.diffoscope.txt' + if subprocess.call([config['diffoscope'], + '--max-report-size', '12345678', '--max-diff-block-lines', '100', + '--html', htmlfile, '--text', textfile, + absapk1, absapk2]) != 0: + return("Failed to unpack " + apk1) + apk1dir = os.path.join(tmp_dir, apk_badchars.sub('_', apk1[0:-4])) # trim .apk apk2dir = os.path.join(tmp_dir, apk_badchars.sub('_', apk2[0:-4])) # trim .apk for d in [apk1dir, apk2dir]: