mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-07 16:00:28 +03:00
make resulting dirs of compare_apks() have clearer dir names
This makes it a lot easier to remember which APK is which when trying to make sense of the differences.
This commit is contained in:
parent
a14f82c49e
commit
b53746dc7b
1 changed files with 7 additions and 7 deletions
|
|
@ -1879,24 +1879,24 @@ def compare_apks(apk1, apk2, tmp_dir):
|
||||||
trying to do the comparison.
|
trying to do the comparison.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
thisdir = os.path.join(tmp_dir, 'this_apk')
|
badchars = re.compile('''[/ :;'"]''')
|
||||||
thatdir = os.path.join(tmp_dir, 'that_apk')
|
apk1dir = os.path.join(tmp_dir, badchars.sub('_', apk1[0:-4])) # trim .apk
|
||||||
for d in [thisdir, thatdir]:
|
apk2dir = os.path.join(tmp_dir, badchars.sub('_', apk2[0:-4])) # trim .apk
|
||||||
|
for d in [apk1dir, apk2dir]:
|
||||||
if os.path.exists(d):
|
if os.path.exists(d):
|
||||||
shutil.rmtree(d)
|
shutil.rmtree(d)
|
||||||
os.mkdir(d)
|
os.mkdir(d)
|
||||||
|
|
||||||
if subprocess.call(['jar', 'xf',
|
if subprocess.call(['jar', 'xf',
|
||||||
os.path.abspath(apk1)],
|
os.path.abspath(apk1)],
|
||||||
cwd=thisdir) != 0:
|
cwd=apk1dir) != 0:
|
||||||
return("Failed to unpack " + apk1)
|
return("Failed to unpack " + apk1)
|
||||||
if subprocess.call(['jar', 'xf',
|
if subprocess.call(['jar', 'xf',
|
||||||
os.path.abspath(apk2)],
|
os.path.abspath(apk2)],
|
||||||
cwd=thatdir) != 0:
|
cwd=apk2dir) != 0:
|
||||||
return("Failed to unpack " + apk2)
|
return("Failed to unpack " + apk2)
|
||||||
|
|
||||||
p = FDroidPopen(['diff', '-r', 'this_apk', 'that_apk'], cwd=tmp_dir,
|
p = FDroidPopen(['diff', '-r', apk1dir, apk2dir], output=False)
|
||||||
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]:
|
||||||
return("Unexpected diff output - " + p.output)
|
return("Unexpected diff output - " + p.output)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue