Left: | ||
Right: |
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 shutil | 6 import shutil |
7 import string | 7 import string |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 manifest = json.load(manifest_file) | 75 manifest = json.load(manifest_file) |
76 | 76 |
77 apk_path = os.path.join(DIST_PATH, "gecko-unsigned-unaligned.apk") | 77 apk_path = os.path.join(DIST_PATH, "gecko-unsigned-unaligned.apk") |
78 if build_mode == "release": | 78 if build_mode == "release": |
79 target_apk_name = "adblockbrowser-%s-arm.apk" % manifest["moz_app_version"] | 79 target_apk_name = "adblockbrowser-%s-arm.apk" % manifest["moz_app_version"] |
80 else: | 80 else: |
81 target_apk_name = "adblockbrowser-%s.%s-arm.apk" % ( | 81 target_apk_name = "adblockbrowser-%s.%s-arm.apk" % ( |
82 manifest["moz_app_version"], manifest["buildid"]) | 82 manifest["moz_app_version"], manifest["buildid"]) |
83 target_apk_path = os.path.join(DIST_PATH, target_apk_name) | 83 target_apk_path = os.path.join(DIST_PATH, target_apk_name) |
84 shutil.copyfile(apk_path, target_apk_path) | 84 shutil.copyfile(apk_path, target_apk_path) |
85 | |
86 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 | |
85 return target_apk_path | 89 return target_apk_path |
86 | 90 |
87 def sign(apk_path, key_store, key_name): | 91 def sign(apk_path, key_store, key_name): |
88 temp_apk_path = tempfile.NamedTemporaryFile().name | 92 temp_apk_path = tempfile.NamedTemporaryFile().name |
89 shutil.copyfile(apk_path, temp_apk_path) | 93 shutil.copyfile(apk_path, temp_apk_path) |
90 try: | 94 try: |
91 subprocess.check_call(["jarsigner", "-verbose", "-sigalg", "SHA1withRSA", | 95 subprocess.check_call(["jarsigner", "-verbose", "-sigalg", "SHA1withRSA", |
92 "-digestalg", "SHA1", "-keystore", key_store, | 96 "-digestalg", "SHA1", "-keystore", key_store, |
93 temp_apk_path, key_name]) | 97 temp_apk_path, key_name]) |
94 os.remove(apk_path) | 98 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" | 131 print >>sys.stderr, "Invalid build mode, check config.py" |
128 sys.exit(5) | 132 sys.exit(5) |
129 | 133 |
130 if do_build: | 134 if do_build: |
131 apk_path = build(distribution_mode, build_mode, config.ANDROID_SDK_PATH, | 135 apk_path = build(distribution_mode, build_mode, config.ANDROID_SDK_PATH, |
132 config.ANDROID_NDK_PATH) | 136 config.ANDROID_NDK_PATH) |
133 if do_sign: | 137 if do_sign: |
134 sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) | 138 sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |
135 else: | 139 else: |
136 print apk_path | 140 print apk_path |
OLD | NEW |