mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Support for publishing signed binaries from elsewhere
Done after verifying that they match ones built using a recipe. Everything in the metadata should be the same as normal, with the addition of the Binaries: directive to specify where (with pattern substitution) to get the binaries from. Publishing only takes place if there is a proper match. (Which seems very unlikely to be the case unless the exact same toolchain is used, so I would imagine that unless the person building and signing the incoming binaries uses fdroidserver to build them, probably the exact same buildserver id, they will not match. But at least we have the functionality to support that.)
This commit is contained in:
parent
311ec604f8
commit
8568805866
4 changed files with 154 additions and 72 deletions
|
@ -1785,3 +1785,40 @@ def place_srclib(root_dir, number, libpath):
|
|||
o.write(line)
|
||||
if not placed:
|
||||
o.write('android.library.reference.%d=%s\n' % (number, relpath))
|
||||
|
||||
|
||||
def compare_apks(apk1, apk2, tmp_dir):
|
||||
"""Compare two apks
|
||||
|
||||
Returns None if the apk content is the same (apart from the signing key),
|
||||
otherwise a string describing what's different, or what went wrong when
|
||||
trying to do the comparison.
|
||||
"""
|
||||
|
||||
thisdir = os.path.join(tmp_dir, 'this_apk')
|
||||
thatdir = os.path.join(tmp_dir, 'that_apk')
|
||||
for d in [thisdir, thatdir]:
|
||||
if os.path.exists(d):
|
||||
shutil.rmtree(d)
|
||||
os.mkdir(d)
|
||||
|
||||
if subprocess.call(['jar', 'xf',
|
||||
os.path.abspath(apk1)],
|
||||
cwd=thisdir) != 0:
|
||||
return("Failed to unpack " + apk1)
|
||||
if subprocess.call(['jar', 'xf',
|
||||
os.path.abspath(apk2)],
|
||||
cwd=thatdir) != 0:
|
||||
return("Failed to unpack " + apk2)
|
||||
|
||||
p = FDroidPopen(['diff', '-r', 'this_apk', 'that_apk'], cwd=tmp_dir,
|
||||
output=False)
|
||||
lines = p.output.splitlines()
|
||||
if len(lines) != 1 or 'META-INF' not in lines[0]:
|
||||
return("Unexpected diff output - " + p.output)
|
||||
|
||||
# If we get here, it seems like they're the same!
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue