| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 import glob | 3 import glob |
| 4 import json | 4 import json |
| 5 import os | 5 import os |
| 6 import re |
| 6 import shutil | 7 import shutil |
| 7 import string | 8 import string |
| 8 import subprocess | 9 import subprocess |
| 9 import sys | 10 import sys |
| 10 import tempfile | 11 import tempfile |
| 11 | 12 |
| 12 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 13 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 13 ENSURE_DEPENDENCIES_PATH = os.path.join(BASE_DIR, "ensure_dependencies.py") | 14 ENSURE_DEPENDENCIES_PATH = os.path.join(BASE_DIR, "ensure_dependencies.py") |
| 14 MULTI_L10N_PATH = os.path.join(BASE_DIR, "mozharness", "scripts", | 15 MULTI_L10N_PATH = os.path.join(BASE_DIR, "mozharness", "scripts", |
| 15 "multil10n.py") | 16 "multil10n.py") |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 manifest = json.load(manifest_file) | 76 manifest = json.load(manifest_file) |
| 76 | 77 |
| 77 apk_path = os.path.join(DIST_PATH, "gecko-unsigned-unaligned.apk") | 78 apk_path = os.path.join(DIST_PATH, "gecko-unsigned-unaligned.apk") |
| 78 if build_mode == "release": | 79 if build_mode == "release": |
| 79 target_apk_name = "adblockbrowser-%s-arm.apk" % manifest["moz_app_version"] | 80 target_apk_name = "adblockbrowser-%s-arm.apk" % manifest["moz_app_version"] |
| 80 else: | 81 else: |
| 81 target_apk_name = "adblockbrowser-%s.%s-arm.apk" % ( | 82 target_apk_name = "adblockbrowser-%s.%s-arm.apk" % ( |
| 82 manifest["moz_app_version"], manifest["buildid"]) | 83 manifest["moz_app_version"], manifest["buildid"]) |
| 83 target_apk_path = os.path.join(DIST_PATH, target_apk_name) | 84 target_apk_path = os.path.join(DIST_PATH, target_apk_name) |
| 84 shutil.copyfile(apk_path, target_apk_path) | 85 shutil.copyfile(apk_path, target_apk_path) |
| 86 |
| 87 target_manifest_path = re.sub(r".apk$", ".json", target_apk_path) |
| 88 shutil.copyfile(manifest_path, target_manifest_path) |
| 89 |
| 85 return target_apk_path | 90 return target_apk_path |
| 86 | 91 |
| 87 def sign(apk_path, key_store, key_name): | 92 def sign(apk_path, key_store, key_name): |
| 88 temp_apk_path = tempfile.NamedTemporaryFile().name | 93 temp_apk_path = tempfile.NamedTemporaryFile().name |
| 89 shutil.copyfile(apk_path, temp_apk_path) | 94 shutil.copyfile(apk_path, temp_apk_path) |
| 90 try: | 95 try: |
| 91 subprocess.check_call(["jarsigner", "-verbose", "-sigalg", "SHA1withRSA", | 96 subprocess.check_call(["jarsigner", "-verbose", "-sigalg", "SHA1withRSA", |
| 92 "-digestalg", "SHA1", "-keystore", key_store, | 97 "-digestalg", "SHA1", "-keystore", key_store, |
| 93 temp_apk_path, key_name]) | 98 temp_apk_path, key_name]) |
| 94 os.remove(apk_path) | 99 os.remove(apk_path) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 print >>sys.stderr, "Invalid build mode, check config.py" | 132 print >>sys.stderr, "Invalid build mode, check config.py" |
| 128 sys.exit(5) | 133 sys.exit(5) |
| 129 | 134 |
| 130 if do_build: | 135 if do_build: |
| 131 apk_path = build(distribution_mode, build_mode, config.ANDROID_SDK_PATH, | 136 apk_path = build(distribution_mode, build_mode, config.ANDROID_SDK_PATH, |
| 132 config.ANDROID_NDK_PATH) | 137 config.ANDROID_NDK_PATH) |
| 133 if do_sign: | 138 if do_sign: |
| 134 sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) | 139 sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |
| 135 else: | 140 else: |
| 136 print apk_path | 141 print apk_path |
| OLD | NEW |