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 shutil | 6 import shutil |
7 import subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 import tempfile | 9 import tempfile |
10 | 10 |
11 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 11 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
12 ENSURE_DEPENDENCIES_PATH = os.path.join(BASE_DIR, "ensure_dependencies.py") | 12 ENSURE_DEPENDENCIES_PATH = os.path.join(BASE_DIR, "ensure_dependencies.py") |
13 MACH_PATH = os.path.join(BASE_DIR, "mach") | 13 MACH_PATH = os.path.join(BASE_DIR, "mach") |
14 DIST_PATH = os.path.join(BASE_DIR, "obj-arm-linux-androideabi", "dist") | 14 DIST_PATH = os.path.join(BASE_DIR, "obj-arm-linux-androideabi", "dist") |
15 | 15 |
16 def print_usage(): | 16 def print_usage(): |
17 print "Usage: %s devbuild|release KEY_STORE KEY_NAME" % \ | 17 print >>sys.stderr, "Usage: %s devbuild|release KEY_STORE KEY_NAME" % \ |
18 os.path.basename(sys.argv[0]) | 18 os.path.basename(sys.argv[0]) |
19 | 19 |
20 def check_mozconfig(path, mode): | 20 def check_mozconfig(path, mode): |
21 if not os.path.exists(path): | 21 if not os.path.exists(path): |
22 raise Exception("'%s' doesn't exist, please create it." % path) | 22 raise Exception("'%s' doesn't exist, please create it." % path) |
23 | 23 |
24 with open(path) as file: | 24 with open(path) as file: |
25 contents = file.read() | 25 contents = file.read() |
| 26 |
| 27 # This check can be removed once https://issues.adblockplus.org/ticket/2490 is |
| 28 # done. |
| 29 if "--disable-crashreporter" not in contents: |
| 30 raise Exception( |
| 31 "'%s' doesn't seem to set --disable-crashreporter, please do." % path) |
| 32 |
| 33 if "export MOZILLA_OFFICIAL=1" not in contents: |
| 34 raise Exception( |
| 35 "'%s' doesn't seem to export MOZILLA_OFFICIAL=1, please do." % path) |
| 36 |
26 updater_disabled = "--disable-updater" in contents | 37 updater_disabled = "--disable-updater" in contents |
27 | |
28 if updater_disabled and mode == "devbuild": | 38 if updater_disabled and mode == "devbuild": |
29 raise Exception("'%s' seems to set --disable-updater, please don't." % path) | 39 raise Exception("'%s' seems to set --disable-updater, please don't." % path) |
30 elif not updater_disabled and mode == "release": | 40 elif not updater_disabled and mode == "release": |
31 raise Exception( | 41 raise Exception( |
32 "'%s' doesn't seem to set --disable-updater, please do." % path) | 42 "'%s' doesn't seem to set --disable-updater, please do." % path) |
33 | 43 |
34 def find_mozconfig(mode): | 44 def find_mozconfig(mode): |
35 mozconfig_path = os.path.join(BASE_DIR, ".mozconfig-" + mode) | 45 mozconfig_path = os.path.join(BASE_DIR, ".mozconfig-" + mode) |
36 check_mozconfig(mozconfig_path, mode) | 46 check_mozconfig(mozconfig_path, mode) |
37 return mozconfig_path | 47 return mozconfig_path |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if __name__ == "__main__": | 83 if __name__ == "__main__": |
74 if len(sys.argv) < 4: | 84 if len(sys.argv) < 4: |
75 print_usage() | 85 print_usage() |
76 sys.exit(1) | 86 sys.exit(1) |
77 | 87 |
78 mode, key_store, key_name = sys.argv[1:] | 88 mode, key_store, key_name = sys.argv[1:] |
79 if mode not in ("devbuild", "release"): | 89 if mode not in ("devbuild", "release"): |
80 print_usage() | 90 print_usage() |
81 sys.exit(2) | 91 sys.exit(2) |
82 | 92 |
83 subprocess.call([ENSURE_DEPENDENCIES_PATH]) | 93 subprocess.check_call([ENSURE_DEPENDENCIES_PATH]) |
84 apk_path = build(mode) | 94 apk_path = build(mode) |
85 sign(apk_path, key_store, key_name) | 95 sign(apk_path, key_store, key_name) |
LEFT | RIGHT |