Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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) |
85 | 86 |
86 target_manifest_path = re.sub(r".apk$", ".json", target_apk_path) | 87 target_manifest_path = re.sub(r".apk$", ".json", target_apk_path) |
René Jeschke
2015/11/13 12:50:46
`re` is not imported yet.
Felix Dahlke
2015/11/13 12:53:30
Damn, that's what I get for not doing a proper int
| |
87 shutil.copyfile(manifest_path, target_manifest_path) | 88 shutil.copyfile(manifest_path, target_manifest_path) |
88 | 89 |
89 return target_apk_path | 90 return target_apk_path |
90 | 91 |
91 def sign(apk_path, key_store, key_name): | 92 def sign(apk_path, key_store, key_name): |
92 temp_apk_path = tempfile.NamedTemporaryFile().name | 93 temp_apk_path = tempfile.NamedTemporaryFile().name |
93 shutil.copyfile(apk_path, temp_apk_path) | 94 shutil.copyfile(apk_path, temp_apk_path) |
94 try: | 95 try: |
95 subprocess.check_call(["jarsigner", "-verbose", "-sigalg", "SHA1withRSA", | 96 subprocess.check_call(["jarsigner", "-verbose", "-sigalg", "SHA1withRSA", |
96 "-digestalg", "SHA1", "-keystore", key_store, | 97 "-digestalg", "SHA1", "-keystore", key_store, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 print >>sys.stderr, "Invalid build mode, check config.py" | 132 print >>sys.stderr, "Invalid build mode, check config.py" |
132 sys.exit(5) | 133 sys.exit(5) |
133 | 134 |
134 if do_build: | 135 if do_build: |
135 apk_path = build(distribution_mode, build_mode, config.ANDROID_SDK_PATH, | 136 apk_path = build(distribution_mode, build_mode, config.ANDROID_SDK_PATH, |
136 config.ANDROID_NDK_PATH) | 137 config.ANDROID_NDK_PATH) |
137 if do_sign: | 138 if do_sign: |
138 sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) | 139 sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |
139 else: | 140 else: |
140 print apk_path | 141 print apk_path |
LEFT | RIGHT |