[tbb-commits] [tor-browser/tor-browser-31.3.0esr-4.5-1] Bug 902761 - Build configuration for turning .der files into .h files. r=rstrong
brade at torproject.org
brade at torproject.org
Wed Dec 17 22:06:24 UTC 2014
commit 7d87311b58709d8ab2a8ec052e0613b574b19a7b
Author: Brian R. Bondy <netzen at gmail.com>
Date: Wed Oct 15 23:00:23 2014 -0400
Bug 902761 - Build configuration for turning .der files into .h files. r=rstrong
---
toolkit/mozapps/update/updater/Makefile.in | 16 +++++++++++++
toolkit/mozapps/update/updater/gen_cert_header.py | 25 +++++++++++++++++++++
toolkit/mozapps/update/updater/moz.build | 4 ----
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/toolkit/mozapps/update/updater/Makefile.in b/toolkit/mozapps/update/updater/Makefile.in
index d4c06b9..bd6716b 100644
--- a/toolkit/mozapps/update/updater/Makefile.in
+++ b/toolkit/mozapps/update/updater/Makefile.in
@@ -44,6 +44,22 @@ endif
include $(topsrcdir)/config/rules.mk
+ifneq (,$(filter beta release esr,$(MOZ_UPDATE_CHANNEL)))
+ PRIMARY_CERT = release_primary.der
+ SECONDARY_CERT = release_secondary.der
+else ifneq (,$(filter nightly aurora nightly-elm nightly-profiling nightly-oak nightly-ux,$(MOZ_UPDATE_CHANNEL)))
+ PRIMARY_CERT = nightly_aurora_level3_primary.der
+ SECONDARY_CERT = nightly_aurora_level3_secondary.der
+else
+ PRIMARY_CERT = dep1.der
+ SECONDARY_CERT = dep2.der
+endif
+
+export::
+ $(PYTHON) $(srcdir)/gen_cert_header.py primaryCertData $(srcdir)/$(PRIMARY_CERT) > primaryCert.h
+ $(PYTHON) $(srcdir)/gen_cert_header.py secondaryCertData $(srcdir)/$(SECONDARY_CERT) > secondaryCert.h
+ $(PYTHON) $(srcdir)/gen_cert_header.py xpcshellCertData $(srcdir)/xpcshellCertificate.der > xpcshellCert.h
+
ifdef MOZ_WIDGET_GTK
libs:: updater.png
$(NSINSTALL) -D $(DIST)/bin/icons
diff --git a/toolkit/mozapps/update/updater/gen_cert_header.py b/toolkit/mozapps/update/updater/gen_cert_header.py
new file mode 100644
index 0000000..182e98b
--- /dev/null
+++ b/toolkit/mozapps/update/updater/gen_cert_header.py
@@ -0,0 +1,25 @@
+import sys
+import binascii
+
+def file_byte_generator(filename, block_size = 512):
+ with open(filename, "rb") as f:
+ while True:
+ block = f.read(block_size)
+ if block:
+ for byte in block:
+ yield byte
+ else:
+ break
+
+def create_header(array_name, in_filename):
+ hexified = ["0x" + binascii.hexlify(byte) for byte in file_byte_generator(in_filename)]
+ print "const uint8_t " + array_name + "[] = {"
+ print ", ".join(hexified)
+ print "};"
+ return 0
+
+if __name__ == '__main__':
+ if len(sys.argv) < 3:
+ print 'ERROR: usage: gen_cert_header.py array_name in_filename'
+ sys.exit(1);
+ sys.exit(create_header(sys.argv[1], sys.argv[2]))
diff --git a/toolkit/mozapps/update/updater/moz.build b/toolkit/mozapps/update/updater/moz.build
index ba1c088..833164a 100644
--- a/toolkit/mozapps/update/updater/moz.build
+++ b/toolkit/mozapps/update/updater/moz.build
@@ -78,7 +78,3 @@ if CONFIG['_MSC_VER']:
elif CONFIG['OS_ARCH'] == 'WINNT':
WIN32_EXE_LDFLAGS += ['-municode']
-if CONFIG['MOZ_UPDATE_CHANNEL'] in ('beta', 'release', 'esr'):
- DEFINES['MAR_SIGNING_RELEASE_BETA'] = '1'
-elif CONFIG['MOZ_UPDATE_CHANNEL'] in ('nightly', 'aurora', 'nightly-elm', 'nightly-profiling', 'nightly-oak', 'nightly-ux'):
- DEFINES['MAR_SIGNING_AURORA_NIGHTLY'] = '1'
More information about the tbb-commits
mailing list