From 98448e0481b55b8b8147dd8d47b1f21f51a4d3b0 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 22 Feb 2023 14:22:29 +0100 Subject: [PATCH] purge all references to zipalign, that is delegated to other things Things like apksigner and @obfusk's tools handle this now. jarsigner is used in the test, since that's the most common use of `common.find_sdk_tools_cmd()`. closes #1100 --- .gitlab-ci.yml | 1 - fdroidserver/common.py | 16 +--------------- fdroidserver/publish.py | 2 +- tests/common.TestCase | 2 +- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e20f7ddd..2d126321 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,7 +96,6 @@ debian_testing: ipfs-cid python3-defusedxml python3-setuptools - zipalign - python3 -c 'import fdroidserver' - python3 -c 'import androguard' - cd tests diff --git a/fdroidserver/common.py b/fdroidserver/common.py index a906c1f1..7160809e 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -3230,20 +3230,6 @@ def apk_strip_v1_signatures(signed_apk, strip_manifest=False): out_apk.writestr(ClonedZipInfo(info), buf) -def _zipalign(unsigned_apk, aligned_apk): - """Run 'zipalign' using standard flags used by Gradle Android Plugin. - - -p was added in build-tools-23.0.0 - - References - ---------- - https://developer.android.com/studio/publish/app-signing#sign-manually - """ - p = SdkToolsPopen(['zipalign', '-v', '-p', '4', unsigned_apk, aligned_apk]) - if p.returncode != 0: - raise BuildException("Failed to align application") - - def apk_implant_signatures(apkpath, outpath, manifest): """Implant a signature from metadata into an APK. @@ -3322,7 +3308,7 @@ def get_apksigner_smartcardoptions(smartcardoptions): def sign_apk(unsigned_path, signed_path, keyalias): - """Sign and zipalign an unsigned APK, then save to a new file, deleting the unsigned. + """Sign an unsigned APK, then save to a new file, deleting the unsigned. NONE is a Java keyword used to configure smartcards as the keystore. Otherwise, the keystore is a local file. diff --git a/fdroidserver/publish.py b/fdroidserver/publish.py index 68e8c907..07b9c7b7 100644 --- a/fdroidserver/publish.py +++ b/fdroidserver/publish.py @@ -431,7 +431,7 @@ def main(): unsigned_dir, output_dir)) - # Sign and zipalign the application... + # Sign the application... common.sign_apk(apkfile, signed_apk_path, keyalias) if appid not in signed_apks: signed_apks[appid] = [] diff --git a/tests/common.TestCase b/tests/common.TestCase index 29b9bdc2..d4658308 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -118,7 +118,7 @@ class CommonTest(unittest.TestCase): return False def _find_all(self): - tools = ['aapt', 'adb', 'zipalign'] + tools = ['aapt', 'adb', 'jarsigner'] if os.path.exists(os.path.join(os.getenv('ANDROID_HOME'), 'tools', 'android')): tools.append('android') for cmd in tools: