Left: | ||
Right: |
OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import sys, os, re, subprocess | 3 import sys, os, re, subprocess |
4 | 4 |
5 def print_usage(): | 5 def print_usage(): |
6 print >>sys.stderr, "Usage: %s release|devbuild SIGNING_KEY_FILE" % (os.path.b asename(sys.argv[0])) | 6 print >>sys.stderr, "Usage: %s release|devbuild SIGNING_KEY_FILE" % (os.path.b asename(sys.argv[0])) |
7 | 7 |
8 if len(sys.argv) < 3: | 8 if len(sys.argv) < 3: |
9 print_usage() | 9 print_usage() |
10 sys.exit(1) | 10 sys.exit(1) |
11 | 11 |
12 basedir = os.path.dirname(os.path.abspath(sys.argv[0])) | 12 basedir = os.path.dirname(os.path.abspath(sys.argv[0])) |
13 build_type = sys.argv[1] | 13 build_type = sys.argv[1] |
14 | 14 |
15 if not build_type in ["release", "devbuild"]: | 15 if not build_type in ["release", "devbuild"]: |
16 print_usage() | 16 print_usage() |
17 sys.exit(2) | 17 sys.exit(2) |
18 | 18 |
19 key = sys.argv[2] | 19 key = sys.argv[2] |
20 | 20 |
21 def sign(*argv): | 21 def sign_command(*argv): |
22 subprocess.check_call([ | 22 return [ |
23 "signtool", | 23 "signtool.exe", |
24 "sign", "/v", | 24 "sign", "/v", |
25 "/d", "Adblock Plus", | 25 "/d", "Adblock Plus", |
26 "/du", "http://adblockplus.org/", | 26 "/du", "https://adblockplus.org/", |
27 "/f", key, | 27 "/f", key, |
28 "/tr", "http://www.startssl.com/timestamp" | 28 "/tr", "http://www.startssl.com/timestamp" |
29 ] + list(argv)) | 29 ] + list(argv) |
30 | |
31 def sign(*argv): | |
32 subprocess.check_call(sign_command(*argv)) | |
30 | 33 |
31 def read_macro_value(file, macro): | 34 def read_macro_value(file, macro): |
32 handle = open(file, 'rb') | 35 handle = open(file, 'rb') |
33 for line in handle: | 36 for line in handle: |
34 match = re.search(r"^\s*#define\s+%s\s+\w?\"(.*?)\"" % macro, line) | 37 match = re.search(r"^\s*#define\s+%s\s+\w?\"(.*?)\"" % macro, line) |
35 if match: | 38 if match: |
36 return match.group(1) | 39 return match.group(1) |
37 raise Exception("Macro %s not found in file %s" % (macro, file)) | 40 raise Exception("Macro %s not found in file %s" % (macro, file)) |
38 | 41 |
39 version = read_macro_value(os.path.join(basedir, "src", "shared", "Version.h"), "IEPLUGIN_VERSION"); | 42 version = read_macro_value(os.path.join(basedir, "src", "shared", "Version.h"), "IEPLUGIN_VERSION"); |
(...skipping 13 matching lines...) Expand all Loading... | |
53 os.path.join(basedir, "build", arch, "adblockplus.sln"), | 56 os.path.join(basedir, "build", arch, "adblockplus.sln"), |
54 "/p:Configuration=Release", "/target:AdblockPlus;AdblockPlusEngine", | 57 "/p:Configuration=Release", "/target:AdblockPlus;AdblockPlusEngine", |
55 ]) | 58 ]) |
56 | 59 |
57 sign(os.path.join(basedir, "build", arch, "Release", "AdblockPlus.dll"), | 60 sign(os.path.join(basedir, "build", arch, "Release", "AdblockPlus.dll"), |
58 os.path.join(basedir, "build", arch, "Release", "AdblockPlusEngine.exe")) | 61 os.path.join(basedir, "build", arch, "Release", "AdblockPlusEngine.exe")) |
59 | 62 |
60 installerParams = os.environ.copy() | 63 installerParams = os.environ.copy() |
61 installerParams["VERSION"] = version | 64 installerParams["VERSION"] = version |
62 subprocess.check_call(["nmake", "/A", "ia32", "x64"], env=installerParams, cwd=o s.path.join(basedir, "installer")) | 65 subprocess.check_call(["nmake", "/A", "ia32", "x64"], env=installerParams, cwd=o s.path.join(basedir, "installer")) |
63 sign(os.path.join(basedir, "build", "ia32", "adblockplusie-%s-en-us-ia32.msi" % version), | 66 sign(os.path.join(basedir, "installer", "build", "ia32", "adblockplusie-%s-multi language-ia32.msi" % version), |
64 os.path.join(basedir, "build", "x64", "adblockplusie-%s-en-us-x64.msi" % ver sion)) | 67 os.path.join(basedir, "installer", "build", "x64", "adblockplusie-%s-multila nguage-x64.msi" % version)) |
65 | 68 |
66 subprocess.check_call(["nmake", "/A", "setup"], env=installerParams, cwd=os.path .join(basedir, "installer")) | 69 # If this fails, please check if InnoSetup is installed and added to you PATH |
67 | 70 signparam = " ".join(map(lambda p: "$q%s$q" % p if " " in p else p, sign_command ("$f"))) |
68 # Do the signing dance described on http://wix.sourceforge.net/manual-wix3/insig nia.htm | 71 subprocess.check_call(["iscc", "/A", "/Ssigntool=%s" % signparam, "/Dversion=%s" % version, os.path.join(basedir, "installer", "src", "innosetup-exe", "64BitTwo Arch.iss")]) |
69 bundle = os.path.join(basedir, "build", "adblockplusie-%s.exe" % version) | |
Felix Dahlke
2014/08/07 15:15:04
Why don't we sign the individual .exes anymore? Is
Eric
2014/08/07 15:52:35
Wladimir figured out the signing issues a year ago
| |
70 engine = os.path.join(basedir, "build", "engine-%s.exe" % version) | |
71 subprocess.check_call(["insignia", "-ib", bundle, "-o", engine]) | |
72 sign(engine) | |
73 subprocess.check_call(["insignia", "-ab", engine, bundle, "-o", bundle]) | |
74 sign(bundle) | |
OLD | NEW |