| 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 shutil | 6 import shutil |
| 7 import subprocess | 7 import subprocess |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 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 | 26 |
| 27 # This check can be removed once https://issues.adblockplus.org/ticket/2490 is | 27 # This check can be removed once https://issues.adblockplus.org/ticket/2490 is |
| 28 # done. | 28 # done. |
| 29 if "--disable-crashreporter" not in contents: | 29 if "--disable-crashreporter" not in contents: |
| 30 raise Exception( | 30 raise Exception( |
| 31 "'%s' doesn't seem to set --disable-crashreporter, please do." % path) | 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) | |
| 32 | 36 |
| 33 updater_disabled = "--disable-updater" in contents | 37 updater_disabled = "--disable-updater" in contents |
| 34 if updater_disabled and mode == "devbuild": | 38 if updater_disabled and mode == "devbuild": |
| 35 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) |
| 36 elif not updater_disabled and mode == "release": | 40 elif not updater_disabled and mode == "release": |
| 37 raise Exception( | 41 raise Exception( |
| 38 "'%s' doesn't seem to set --disable-updater, please do." % path) | 42 "'%s' doesn't seem to set --disable-updater, please do." % path) |
| 39 | 43 |
| 40 def find_mozconfig(mode): | 44 def find_mozconfig(mode): |
|
René Jeschke
2015/05/19 09:57:54
Nit: 'find_mozconfig' does not really 'search' for
Felix Dahlke
2015/05/19 15:54:35
Well, it looks for an appropriate mozconfig and co
| |
| 41 mozconfig_path = os.path.join(BASE_DIR, ".mozconfig-" + mode) | 45 mozconfig_path = os.path.join(BASE_DIR, ".mozconfig-" + mode) |
| 42 check_mozconfig(mozconfig_path, mode) | 46 check_mozconfig(mozconfig_path, mode) |
| 43 return mozconfig_path | 47 return mozconfig_path |
| 44 | 48 |
| 45 def build(mode): | 49 def build(mode): |
| 46 mach_environment = os.environ.copy() | 50 mach_environment = os.environ.copy() |
| 47 mach_environment["MOZCONFIG"] = find_mozconfig(mode) | 51 mach_environment["MOZCONFIG"] = find_mozconfig(mode) |
| 48 subprocess.check_call([MACH_PATH, "clobber"], env=mach_environment) | 52 subprocess.check_call([MACH_PATH, "clobber"], env=mach_environment) |
| 49 subprocess.check_call([MACH_PATH, "build"], env=mach_environment) | 53 subprocess.check_call([MACH_PATH, "build"], env=mach_environment) |
| 50 subprocess.check_call([MACH_PATH, "package"], env=mach_environment) | 54 subprocess.check_call([MACH_PATH, "package"], env=mach_environment) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 79 if __name__ == "__main__": | 83 if __name__ == "__main__": |
| 80 if len(sys.argv) < 4: | 84 if len(sys.argv) < 4: |
| 81 print_usage() | 85 print_usage() |
| 82 sys.exit(1) | 86 sys.exit(1) |
| 83 | 87 |
| 84 mode, key_store, key_name = sys.argv[1:] | 88 mode, key_store, key_name = sys.argv[1:] |
| 85 if mode not in ("devbuild", "release"): | 89 if mode not in ("devbuild", "release"): |
| 86 print_usage() | 90 print_usage() |
| 87 sys.exit(2) | 91 sys.exit(2) |
| 88 | 92 |
| 89 subprocess.call([ENSURE_DEPENDENCIES_PATH]) | 93 subprocess.check_call([ENSURE_DEPENDENCIES_PATH]) |
|
René Jeschke
2015/05/19 09:57:54
Shouldn't we use 'check_call' here, too? Or is a '
Felix Dahlke
2015/05/19 15:54:35
Yes you're right. I did this by design, but for a
| |
| 90 apk_path = build(mode) | 94 apk_path = build(mode) |
| 91 sign(apk_path, key_store, key_name) | 95 sign(apk_path, key_store, key_name) |
| LEFT | RIGHT |