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. 11, 2019, 11:48 a.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 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
357 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): 363 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False):
358 metadata = readMetadata(baseDir, type) 364 metadata = readMetadata(baseDir, type)
359 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 365 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
360 366
361 if outFile == None: 367 if outFile == None:
362 file_extension = get_extension(type, keyFile is not None) 368 file_extension = get_extension(type, keyFile is not None)
363 outFile = getDefaultFileName(metadata, version, file_extension) 369 outFile = getDefaultFileName(metadata, version, file_extension)
364 370
365 params = { 371 params = {
366 'type': type, 372 'type': type,
(...skipping 18 matching lines...) Expand all
385 if metadata.has_section('preprocess'): 391 if metadata.has_section('preprocess'):
386 files.preprocess( 392 files.preprocess(
387 [f for f, _ in metadata.items('preprocess')], 393 [f for f, _ in metadata.items('preprocess')],
388 {'needsExt': True}, 394 {'needsExt': True},
389 ) 395 )
390 396
391 if metadata.has_section('import_locales'): 397 if metadata.has_section('import_locales'):
392 import_locales(params, files) 398 import_locales(params, files)
393 399
394 files['manifest.json'] = createManifest(params, files) 400 files['manifest.json'] = createManifest(params, files)
401
402 if not releaseBuild and not devenv:
403 add_revision_file(baseDir, files)
Sebastian Noack 2019/10/11 21:18:43 Splitting this out into a function seems unnecessa
tlucas 2019/10/14 12:14:54 Done.
404
395 if type == 'chrome': 405 if type == 'chrome':
396 fix_translations_for_chrome(files) 406 fix_translations_for_chrome(files)
397 407
398 if devenv: 408 if devenv:
399 add_devenv_requirements(files, metadata, params) 409 add_devenv_requirements(files, metadata, params)
400 410
401 zipdata = files.zipToString() 411 zipdata = files.zipToString()
402 signature = None 412 signature = None
403 pubkey = None 413 pubkey = None
404 if keyFile != None: 414 if keyFile != None:
405 signature = signBinary(zipdata, keyFile) 415 signature = signBinary(zipdata, keyFile)
406 pubkey = getPublicKey(keyFile) 416 pubkey = getPublicKey(keyFile)
407 writePackage(outFile, pubkey, signature, zipdata) 417 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