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

Delta Between Two Patch Sets: packagerChrome.py

Issue 30062555: Noissue - Add '.revision'-file to devbuilds
Left Patch Set: Created Oct. 11, 2019, 11:48 a.m.
Right Patch Set: Created Oct. 14, 2019, 12:13 p.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 | « no previous file | no next file » | 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 ConfigParser 5 import ConfigParser
6 import errno 6 import errno
7 import glob 7 import glob
8 import io 8 import io
9 import json 9 import json
10 import os 10 import os
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 relpath='devenvPoller__.js', 347 relpath='devenvPoller__.js',
348 ) 348 )
349 files['devenvVersion__'] = str(random.random()) 349 files['devenvVersion__'] = str(random.random())
350 350
351 if metadata.has_option('general', 'testScripts'): 351 if metadata.has_option('general', 'testScripts'):
352 files['qunit/index.html'] = createScriptPage( 352 files['qunit/index.html'] = createScriptPage(
353 params, 'testIndex.html.tmpl', ('general', 'testScripts'), 353 params, 'testIndex.html.tmpl', ('general', 'testScripts'),
354 ) 354 )
355 355
356 356
357 def add_revision_file(base_dir, files):
358 if os.path.exists(os.path.join(base_dir, '.git')):
359 cmd = ['git', 'rev-parse', 'HEAD']
360 files['.revision'] = subprocess.check_output(cmd, cwd=base_dir).strip()
361
362
363 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): 357 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False):
364 metadata = readMetadata(baseDir, type) 358 metadata = readMetadata(baseDir, type)
365 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 359 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
366 360
367 if outFile == None: 361 if outFile == None:
368 file_extension = get_extension(type, keyFile is not None) 362 file_extension = get_extension(type, keyFile is not None)
369 outFile = getDefaultFileName(metadata, version, file_extension) 363 outFile = getDefaultFileName(metadata, version, file_extension)
370 364
371 params = { 365 params = {
372 'type': type, 366 'type': type,
(...skipping 18 matching lines...) Expand all
391 if metadata.has_section('preprocess'): 385 if metadata.has_section('preprocess'):
392 files.preprocess( 386 files.preprocess(
393 [f for f, _ in metadata.items('preprocess')], 387 [f for f, _ in metadata.items('preprocess')],
394 {'needsExt': True}, 388 {'needsExt': True},
395 ) 389 )
396 390
397 if metadata.has_section('import_locales'): 391 if metadata.has_section('import_locales'):
398 import_locales(params, files) 392 import_locales(params, files)
399 393
400 files['manifest.json'] = createManifest(params, files) 394 files['manifest.json'] = createManifest(params, files)
401 395 building_from_git = os.path.exists(os.path.join(baseDir, '.git'))
402 if not releaseBuild and not devenv: 396 if not releaseBuild and not devenv and building_from_git:
403 add_revision_file(baseDir, files) 397 cmd = ['git', 'rev-parse', 'HEAD']
Sebastian Noack 2019/10/11 21:18:43 Splitting this out into a function seems unnecessa
tlucas 2019/10/14 12:14:54 Done.
398 files['.revision'] = subprocess.check_output(cmd, cwd=baseDir)
404 399
405 if type == 'chrome': 400 if type == 'chrome':
406 fix_translations_for_chrome(files) 401 fix_translations_for_chrome(files)
407 402
408 if devenv: 403 if devenv:
409 add_devenv_requirements(files, metadata, params) 404 add_devenv_requirements(files, metadata, params)
410 405
411 zipdata = files.zipToString() 406 zipdata = files.zipToString()
412 signature = None 407 signature = None
413 pubkey = None 408 pubkey = None
414 if keyFile != None: 409 if keyFile != None:
415 signature = signBinary(zipdata, keyFile) 410 signature = signBinary(zipdata, keyFile)
416 pubkey = getPublicKey(keyFile) 411 pubkey = getPublicKey(keyFile)
417 writePackage(outFile, pubkey, signature, zipdata) 412 writePackage(outFile, pubkey, signature, zipdata)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld