| LEFT | RIGHT | 
|    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 errno |    5 import errno | 
|    6 import glob |    6 import glob | 
|    7 import io |    7 import io | 
|    8 import json |    8 import json | 
|    9 import os |    9 import os | 
|   10 import re |   10 import re | 
|   11 from StringIO import StringIO |   11 from StringIO import StringIO | 
|   12 import struct |   12 import struct | 
|   13 import subprocess |   13 import subprocess | 
|   14 import sys |   14 import sys | 
 |   15 import random | 
|   15  |   16  | 
|   16 from packager import (readMetadata, getDefaultFileName, getBuildVersion, |   17 from packager import (readMetadata, getDefaultFileName, getBuildVersion, | 
|   17                       getTemplate, Files) |   18                       getTemplate, Files) | 
|   18  |   19  | 
|   19 defaultLocale = 'en_US' |   20 defaultLocale = 'en_US' | 
|   20  |   21  | 
|   21  |   22  | 
|   22 def getIgnoredFiles(params): |   23 def getIgnoredFiles(params): | 
|   23     return {'store.description'} |   24     return {'store.description'} | 
|   24  |   25  | 
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  313     else: |  314     else: | 
|  314         file = outputFile |  315         file = outputFile | 
|  315     if pubkey != None and signature != None: |  316     if pubkey != None and signature != None: | 
|  316         file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature))
     ) |  317         file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature))
     ) | 
|  317         file.write(pubkey) |  318         file.write(pubkey) | 
|  318         file.write(signature) |  319         file.write(signature) | 
|  319     file.write(zipdata) |  320     file.write(zipdata) | 
|  320  |  321  | 
|  321  |  322  | 
|  322 def add_devenv_requirements(files, metadata, params): |  323 def add_devenv_requirements(files, metadata, params): | 
|  323     import buildtools |  324     files.read( | 
|  324     import random |  325         os.path.join(os.path.dirname(__file__), 'chromeDevenvPoller__.js'), | 
|  325     files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js'), |  326         relpath='devenvPoller__.js', | 
|  326                relpath='devenvPoller__.js') |  327     ) | 
|  327     files['devenvVersion__'] = str(random.random()) |  328     files['devenvVersion__'] = str(random.random()) | 
|  328  |  329  | 
|  329     if metadata.has_option('general', 'testScripts'): |  330     if metadata.has_option('general', 'testScripts'): | 
|  330         files['qunit/index.html'] = createScriptPage( |  331         files['qunit/index.html'] = createScriptPage( | 
|  331             params, 'testIndex.html.tmpl', ('general', 'testScripts') |  332             params, 'testIndex.html.tmpl', ('general', 'testScripts') | 
|  332         ) |  333         ) | 
|  333  |  334  | 
|  334  |  335  | 
|  335 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
     d=False, keyFile=None, devenv=False): |  336 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
     d=False, keyFile=None, devenv=False): | 
|  336     metadata = readMetadata(baseDir, type) |  337     metadata = readMetadata(baseDir, type) | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  378     if devenv: |  379     if devenv: | 
|  379         add_devenv_requirements(files, metadata, params) |  380         add_devenv_requirements(files, metadata, params) | 
|  380  |  381  | 
|  381     zipdata = files.zipToString() |  382     zipdata = files.zipToString() | 
|  382     signature = None |  383     signature = None | 
|  383     pubkey = None |  384     pubkey = None | 
|  384     if keyFile != None: |  385     if keyFile != None: | 
|  385         signature = signBinary(zipdata, keyFile) |  386         signature = signBinary(zipdata, keyFile) | 
|  386         pubkey = getPublicKey(keyFile) |  387         pubkey = getPublicKey(keyFile) | 
|  387     writePackage(outFile, pubkey, signature, zipdata) |  388     writePackage(outFile, pubkey, signature, zipdata) | 
| LEFT | RIGHT |