force apksigcopier "AUTO" to select sigs by available files

This commit is contained in:
Hans-Christoph Steiner 2021-04-14 21:02:59 +02:00
parent 44d481768f
commit d28c1c0441
2 changed files with 6 additions and 8 deletions

View file

@ -3083,7 +3083,7 @@ def _zipalign(unsigned_apk, aligned_apk):
raise BuildException("Failed to align application") raise BuildException("Failed to align application")
def apk_implant_signatures(apkpath, outpath, manifest, v2_files): def apk_implant_signatures(apkpath, outpath, manifest):
"""Implants a signature from metadata into an APK. """Implants a signature from metadata into an APK.
:param apkpath: location of the unsigned apk :param apkpath: location of the unsigned apk
@ -3091,18 +3091,17 @@ def apk_implant_signatures(apkpath, outpath, manifest, v2_files):
""" """
sigdir = os.path.dirname(manifest) # FIXME sigdir = os.path.dirname(manifest) # FIXME
apksigcopier.do_patch(sigdir, apkpath, outpath, v1_only=v2_files is None) apksigcopier.do_patch(sigdir, apkpath, outpath, v1_only=None)
def apk_extract_signatures(apkpath, outdir, v1_only=None): def apk_extract_signatures(apkpath, outdir):
"""Extracts a signature files from APK and puts them into target directory. """Extracts a signature files from APK and puts them into target directory.
:param apkpath: location of the apk :param apkpath: location of the apk
:param outdir: folder where the extracted signature files will be stored :param outdir: folder where the extracted signature files will be stored
:param v1_only: True for v1-only signatures, False for v1 and v2 signatures,
or None for autodetection
""" """
apksigcopier.do_extract(apkpath, outdir, v1_only=v1_only) apksigcopier.do_extract(apkpath, outdir, v1_only=None)
def get_min_sdk_version(apk): def get_min_sdk_version(apk):

View file

@ -353,8 +353,7 @@ def main():
devsigned = '{}_{}_{}.apk'.format(appid, vercode, devfp) devsigned = '{}_{}_{}.apk'.format(appid, vercode, devfp)
devsignedtmp = os.path.join(tmp_dir, devsigned) devsignedtmp = os.path.join(tmp_dir, devsigned)
common.apk_implant_signatures(apkfile, devsignedtmp, manifest=manifest, common.apk_implant_signatures(apkfile, devsignedtmp, manifest=manifest)
v2_files=v2_files)
if common.verify_apk_signature(devsignedtmp): if common.verify_apk_signature(devsignedtmp):
shutil.move(devsignedtmp, os.path.join(output_dir, devsigned)) shutil.move(devsignedtmp, os.path.join(output_dir, devsigned))
else: else: