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

Side by Side Diff: packagerChrome.py

Issue 30062555: Noissue - Add '.revision'-file to devbuilds
Patch Set: Created Oct. 10, 2019, 3:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 addRevisionFile(files):
358 try:
359 cmd = ['git', 'rev-parse', 'HEAD']
360 files['.revision'] = subprocess.check_output(cmd).strip()
361 except subprocess.CalledProcessError:
362 pass
363
364
357 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): 365 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False):
358 metadata = readMetadata(baseDir, type) 366 metadata = readMetadata(baseDir, type)
359 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 367 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
360 368
361 if outFile == None: 369 if outFile == None:
362 file_extension = get_extension(type, keyFile is not None) 370 file_extension = get_extension(type, keyFile is not None)
363 outFile = getDefaultFileName(metadata, version, file_extension) 371 outFile = getDefaultFileName(metadata, version, file_extension)
364 372
365 params = { 373 params = {
366 'type': type, 374 'type': type,
(...skipping 18 matching lines...) Expand all
385 if metadata.has_section('preprocess'): 393 if metadata.has_section('preprocess'):
386 files.preprocess( 394 files.preprocess(
387 [f for f, _ in metadata.items('preprocess')], 395 [f for f, _ in metadata.items('preprocess')],
388 {'needsExt': True}, 396 {'needsExt': True},
389 ) 397 )
390 398
391 if metadata.has_section('import_locales'): 399 if metadata.has_section('import_locales'):
392 import_locales(params, files) 400 import_locales(params, files)
393 401
394 files['manifest.json'] = createManifest(params, files) 402 files['manifest.json'] = createManifest(params, files)
403
404 if not releaseBuild and not devenv:
405 addRevisionFile(files)
406
395 if type == 'chrome': 407 if type == 'chrome':
396 fix_translations_for_chrome(files) 408 fix_translations_for_chrome(files)
397 409
398 if devenv: 410 if devenv:
399 add_devenv_requirements(files, metadata, params) 411 add_devenv_requirements(files, metadata, params)
400 412
401 zipdata = files.zipToString() 413 zipdata = files.zipToString()
402 signature = None 414 signature = None
403 pubkey = None 415 pubkey = None
404 if keyFile != None: 416 if keyFile != None:
405 signature = signBinary(zipdata, keyFile) 417 signature = signBinary(zipdata, keyFile)
406 pubkey = getPublicKey(keyFile) 418 pubkey = getPublicKey(keyFile)
407 writePackage(outFile, pubkey, signature, zipdata) 419 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld