OLD | NEW |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 import os | 5 import os |
6 import sys | 6 import sys |
7 import re | 7 import re |
8 import hashlib | 8 import hashlib |
9 import base64 | 9 import base64 |
10 import urllib | 10 import urllib |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 mime = M2Crypto.SMIME.SMIME() | 330 mime = M2Crypto.SMIME.SMIME() |
331 mime.load_key(keyFile) | 331 mime.load_key(keyFile) |
332 mime.set_x509_stack(stack) | 332 mime.set_x509_stack(stack) |
333 signature = mime.sign(M2Crypto.BIO.MemoryBuffer(files['META-INF/zigbert.sf']
.encode('utf-8')), M2Crypto.SMIME.PKCS7_DETACHED | M2Crypto.SMIME.PKCS7_BINARY) | 333 signature = mime.sign(M2Crypto.BIO.MemoryBuffer(files['META-INF/zigbert.sf']
.encode('utf-8')), M2Crypto.SMIME.PKCS7_DETACHED | M2Crypto.SMIME.PKCS7_BINARY) |
334 | 334 |
335 buffer = M2Crypto.BIO.MemoryBuffer() | 335 buffer = M2Crypto.BIO.MemoryBuffer() |
336 signature.write_der(buffer) | 336 signature.write_der(buffer) |
337 files['META-INF/zigbert.rsa'] = buffer.read() | 337 files['META-INF/zigbert.rsa'] = buffer.read() |
338 | 338 |
339 | 339 |
340 def createBuild(baseDir, type="gecko", outFile=None, locales=None, buildNum=None
, releaseBuild=False, keyFile=None, multicompartment=False): | 340 def createBuild(baseDir, type='gecko', outFile=None, locales=None, buildNum=None
, releaseBuild=False, keyFile=None, multicompartment=False): |
341 if locales == None: | 341 if locales == None: |
342 locales = getLocales(baseDir) | 342 locales = getLocales(baseDir) |
343 elif locales == 'all': | 343 elif locales == 'all': |
344 locales = getLocales(baseDir, True) | 344 locales = getLocales(baseDir, True) |
345 | 345 |
346 metadata = readMetadata(baseDir, type) | 346 metadata = readMetadata(baseDir, type) |
347 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 347 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
348 | 348 |
349 if outFile == None: | 349 if outFile == None: |
350 outFile = getDefaultFileName(metadata, version, 'xpi') | 350 outFile = getDefaultFileName(metadata, version, 'xpi') |
(...skipping 30 matching lines...) Expand all Loading... |
381 files.preprocess([f for f, _ in metadata.items('preprocess')]) | 381 files.preprocess([f for f, _ in metadata.items('preprocess')]) |
382 if keyFile: | 382 if keyFile: |
383 signFiles(files, keyFile) | 383 signFiles(files, keyFile) |
384 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else
x) | 384 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else
x) |
385 | 385 |
386 | 386 |
387 def autoInstall(baseDir, type, host, port, multicompartment=False): | 387 def autoInstall(baseDir, type, host, port, multicompartment=False): |
388 fileBuffer = StringIO() | 388 fileBuffer = StringIO() |
389 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multico
mpartment) | 389 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multico
mpartment) |
390 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue()) | 390 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue()) |
OLD | NEW |