Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: packagerChrome.py

Issue 29501558: Issue 5383 - Add tests for the Chrome and Firefox packagers (Closed)
Left Patch Set: Addressing Dave's comments Created Oct. 17, 2017, 12:41 p.m.
Right Patch Set: Addressing Vasily's comments Created Oct. 22, 2017, 11:11 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « package.json ('k') | tests/README.md » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 import struct 11 import struct
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import random
14 15
15 from packager import (readMetadata, getDefaultFileName, getBuildVersion, 16 from packager import (readMetadata, getDefaultFileName, getBuildVersion,
16 getTemplate, Files) 17 getTemplate, Files)
17 18
18 defaultLocale = 'en_US' 19 defaultLocale = 'en_US'
19 20
20 21
21 def getIgnoredFiles(params): 22 def getIgnoredFiles(params):
22 return {'store.description'} 23 return {'store.description'}
23 24
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 file = open(outputFile, 'wb') 314 file = open(outputFile, 'wb')
314 else: 315 else:
315 file = outputFile 316 file = outputFile
316 if pubkey != None and signature != None: 317 if pubkey != None and signature != None:
317 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)) ) 318 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)) )
318 file.write(pubkey) 319 file.write(pubkey)
319 file.write(signature) 320 file.write(signature)
320 file.write(zipdata) 321 file.write(zipdata)
321 322
322 323
324 def add_devenv_requirements(files, metadata, params):
325 files.read(
326 os.path.join(os.path.dirname(__file__), 'chromeDevenvPoller__.js'),
327 relpath='devenvPoller__.js',
328 )
329 files['devenvVersion__'] = str(random.random())
330
331 if metadata.has_option('general', 'testScripts'):
332 files['qunit/index.html'] = createScriptPage(
333 params, 'testIndex.html.tmpl', ('general', 'testScripts')
334 )
335
336
323 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): 337 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False):
324 metadata = readMetadata(baseDir, type) 338 metadata = readMetadata(baseDir, type)
325 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 339 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
326 340
327 if outFile == None: 341 if outFile == None:
328 if type == 'gecko': 342 if type == 'gecko':
329 file_extension = 'xpi' 343 file_extension = 'xpi'
330 else: 344 else:
331 file_extension = 'crx' if keyFile else 'zip' 345 file_extension = 'crx' if keyFile else 'zip'
332 outFile = getDefaultFileName(metadata, version, file_extension) 346 outFile = getDefaultFileName(metadata, version, file_extension)
(...skipping 24 matching lines...) Expand all
357 ) 371 )
358 372
359 if metadata.has_section('import_locales'): 373 if metadata.has_section('import_locales'):
360 import_locales(params, files) 374 import_locales(params, files)
361 375
362 files['manifest.json'] = createManifest(params, files) 376 files['manifest.json'] = createManifest(params, files)
363 if type == 'chrome': 377 if type == 'chrome':
364 fix_translations_for_chrome(files) 378 fix_translations_for_chrome(files)
365 379
366 if devenv: 380 if devenv:
367 import buildtools 381 add_devenv_requirements(files, metadata, params)
368 import random
369 files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js '), relpath='devenvPoller__.js')
370 files['devenvVersion__'] = str(random.random())
371
372 if metadata.has_option('general', 'testScripts'):
373 files['qunit/index.html'] = createScriptPage(
374 params, 'testIndex.html.tmpl', ('general', 'testScripts')
375 )
376 382
377 zipdata = files.zipToString() 383 zipdata = files.zipToString()
378 signature = None 384 signature = None
379 pubkey = None 385 pubkey = None
380 if keyFile != None: 386 if keyFile != None:
381 signature = signBinary(zipdata, keyFile) 387 signature = signBinary(zipdata, keyFile)
382 pubkey = getPublicKey(keyFile) 388 pubkey = getPublicKey(keyFile)
383 writePackage(outFile, pubkey, signature, zipdata) 389 writePackage(outFile, pubkey, signature, zipdata)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld