mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
check meld config for manual apk diffs
This commit is contained in:
parent
4044e06e7b
commit
62af9b8e3d
2 changed files with 6 additions and 12 deletions
|
@ -1230,8 +1230,7 @@ def main():
|
||||||
unsigned_apk = os.path.join(output_dir,
|
unsigned_apk = os.path.join(output_dir,
|
||||||
unsigned_apk)
|
unsigned_apk)
|
||||||
compare_result = \
|
compare_result = \
|
||||||
common.verify_apks(of, unsigned_apk, tmpdir,
|
common.verify_apks(of, unsigned_apk, tmpdir)
|
||||||
skip_manual_diff=True)
|
|
||||||
if compare_result:
|
if compare_result:
|
||||||
compare_result = compare_result.split('\n')
|
compare_result = compare_result.split('\n')
|
||||||
line_count = len(compare_result)
|
line_count = len(compare_result)
|
||||||
|
|
|
@ -1968,7 +1968,7 @@ def place_srclib(root_dir, number, libpath):
|
||||||
apk_sigfile = re.compile(r'META-INF/[0-9A-Za-z]+\.(SF|RSA|DSA|EC)')
|
apk_sigfile = re.compile(r'META-INF/[0-9A-Za-z]+\.(SF|RSA|DSA|EC)')
|
||||||
|
|
||||||
|
|
||||||
def verify_apks(signed_apk, unsigned_apk, tmp_dir, skip_manual_diff=False):
|
def verify_apks(signed_apk, unsigned_apk, tmp_dir):
|
||||||
"""Verify that two apks are the same
|
"""Verify that two apks are the same
|
||||||
|
|
||||||
One of the inputs is signed, the other is unsigned. The signature metadata
|
One of the inputs is signed, the other is unsigned. The signature metadata
|
||||||
|
@ -1987,8 +1987,6 @@ def verify_apks(signed_apk, unsigned_apk, tmp_dir, skip_manual_diff=False):
|
||||||
:param signed_apk: Path to a signed apk file
|
:param signed_apk: Path to a signed apk file
|
||||||
:param unsigned_apk: Path to an unsigned apk file expected to match it
|
:param unsigned_apk: Path to an unsigned apk file expected to match it
|
||||||
:param tmp_dir: Path to directory for temporary files
|
:param tmp_dir: Path to directory for temporary files
|
||||||
:param skip_manual_diff: Skipping to displaying defferences between apks
|
|
||||||
with meld, kdiff, etc.
|
|
||||||
:returns: None if the verification is successful, otherwise a string
|
:returns: None if the verification is successful, otherwise a string
|
||||||
describing what went wrong.
|
describing what went wrong.
|
||||||
"""
|
"""
|
||||||
|
@ -2023,8 +2021,7 @@ def verify_apks(signed_apk, unsigned_apk, tmp_dir, skip_manual_diff=False):
|
||||||
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,
|
return compare_apks(signed_apk, tmp_apk, tmp_dir,
|
||||||
os.path.dirname(unsigned_apk),
|
os.path.dirname(unsigned_apk))
|
||||||
skip_manual_diff=skip_manual_diff)
|
|
||||||
|
|
||||||
logging.info("...successfully verified")
|
logging.info("...successfully verified")
|
||||||
return None
|
return None
|
||||||
|
@ -2053,7 +2050,7 @@ def verify_apk_signature(apk, jar=False):
|
||||||
apk_badchars = re.compile('''[/ :;'"]''')
|
apk_badchars = re.compile('''[/ :;'"]''')
|
||||||
|
|
||||||
|
|
||||||
def compare_apks(apk1, apk2, tmp_dir, log_dir=None, skip_manual_diff=False):
|
def compare_apks(apk1, apk2, tmp_dir, log_dir=None):
|
||||||
"""Compare two apks
|
"""Compare two apks
|
||||||
|
|
||||||
Returns None if the apk content is the same (apart from the signing key),
|
Returns None if the apk content is the same (apart from the signing key),
|
||||||
|
@ -2105,10 +2102,8 @@ def compare_apks(apk1, apk2, tmp_dir, log_dir=None, skip_manual_diff=False):
|
||||||
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]:
|
||||||
if not skip_manual_diff:
|
if set_command_in_config('meld'):
|
||||||
meld = find_command('meld')
|
p = FDroidPopen([config['meld'], apk1dir, apk2dir], output=False)
|
||||||
if meld is not None:
|
|
||||||
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue