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

Side by Side Diff: build.py

Issue 29508667: Issue 4354, 4355 - handle dirty/outdated repos on release (Closed)
Patch Set: Created Aug. 7, 2017, 2:13 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 | releaseAutomation.py » ('j') | 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 os 5 import os
6 import sys 6 import sys
7 import re 7 import re
8 import subprocess 8 import subprocess
9 import shutil 9 import shutil
10 import buildtools 10 import buildtools
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 stderr = process.communicate()[1] 417 stderr = process.communicate()[1]
418 retcode = process.poll() 418 retcode = process.poll()
419 if retcode: 419 if retcode:
420 sys.stderr.write(stderr) 420 sys.stderr.write(stderr)
421 raise subprocess.CalledProcessError(command, retcode) 421 raise subprocess.CalledProcessError(command, retcode)
422 else: 422 else:
423 subprocess.check_call(command) 423 subprocess.check_call(command)
424 424
425 425
426 def runReleaseAutomation(baseDir, scriptName, opts, args, type): 426 def runReleaseAutomation(baseDir, scriptName, opts, args, type):
427 path = 'default'
kzar 2017/08/07 14:59:59 This change seems unrelated?
tlucas 2017/08/07 15:42:06 Acknowledged.
427 keyFile = None 428 keyFile = None
428 downloadsRepo = os.path.join(baseDir, '..', 'downloads') 429 downloadsRepo = os.path.join(baseDir, '..', 'downloads')
429 for option, value in opts: 430 for option, value in opts:
430 if option in ('-k', '--key'): 431 if option in ('-k', '--key'):
431 keyFile = value 432 keyFile = value
432 elif option in ('-d', '--downloads'): 433 elif option in ('-d', '--downloads'):
433 downloadsRepo = value 434 downloadsRepo = value
435 elif option in ('-p', '--path'):
436 path = value
434 437
435 if len(args) == 0: 438 if len(args) == 0:
436 print 'No version number specified for the release' 439 print 'No version number specified for the release'
437 usage(scriptName, type, 'release') 440 usage(scriptName, type, 'release')
438 return 441 return
439 version = args[0] 442 version = args[0]
440 if re.search(r'[^\d\.]', version): 443 if re.search(r'[^\d\.]', version):
441 print 'Wrong version number format' 444 print 'Wrong version number format'
442 usage(scriptName, type, 'release') 445 usage(scriptName, type, 'release')
443 return 446 return
444 447
445 if type in {'chrome', 'safari'} and keyFile is None: 448 if type in {'chrome', 'safari'} and keyFile is None:
446 print >>sys.stderr, 'Error: you must specify a key file for this release ' 449 print >>sys.stderr, 'Error: you must specify a key file for this release '
447 usage(scriptName, type, 'release') 450 usage(scriptName, type, 'release')
448 return 451 return
449 452
450 import buildtools.releaseAutomation as releaseAutomation 453 import buildtools.releaseAutomation as releaseAutomation
451 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) 454 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo, path)
452 455
453 456
454 def updatePSL(baseDir, scriptName, opts, args, type): 457 def updatePSL(baseDir, scriptName, opts, args, type):
455 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater 458 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater
456 publicSuffixListUpdater.updatePSL(baseDir) 459 publicSuffixListUpdater.updatePSL(baseDir)
457 460
458 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: 461 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command:
459 command.shortDescription = 'Show this message' 462 command.shortDescription = 'Show this message'
460 463
461 with addCommand(runBuild, 'build') as command: 464 with addCommand(runBuild, 'build') as command:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 command.description = 'Generate documentation files and write them into the specified directory. This operation requires JsDoc 3 to be installed.' 520 command.description = 'Generate documentation files and write them into the specified directory. This operation requires JsDoc 3 to be installed.'
518 command.addOption('Suppress JsDoc output', short='q', long='quiet') 521 command.addOption('Suppress JsDoc output', short='q', long='quiet')
519 command.params = '[options] <directory>' 522 command.params = '[options] <directory>'
520 command.supportedTypes = ('gecko', 'chrome') 523 command.supportedTypes = ('gecko', 'chrome')
521 524
522 with addCommand(runReleaseAutomation, 'release') as command: 525 with addCommand(runReleaseAutomation, 'release') as command:
523 command.shortDescription = 'Run release automation' 526 command.shortDescription = 'Run release automation'
524 command.description = 'Note: If you are not the project owner then you ' "probably don't want to run this!\n\n" 'Runs release automation: crea tes downloads for the new version, tags ' 'source code repository as well as downloads and buildtools repository.' 527 command.description = 'Note: If you are not the project owner then you ' "probably don't want to run this!\n\n" 'Runs release automation: crea tes downloads for the new version, tags ' 'source code repository as well as downloads and buildtools repository.'
525 command.addOption('File containing private key and certificates required to sign the release.', short='k', long='key', value='file', types=('chrome', 'safar i', 'edge')) 528 command.addOption('File containing private key and certificates required to sign the release.', short='k', long='key', value='file', types=('chrome', 'safar i', 'edge'))
526 command.addOption('Directory containing downloads repository (if omitted ../ downloads is assumed)', short='d', long='downloads', value='dir') 529 command.addOption('Directory containing downloads repository (if omitted ../ downloads is assumed)', short='d', long='downloads', value='dir')
530 command.addOption('Name of the path to use (if omitted "default" os assumed) ', short='p', long='path', value='path')
527 command.params = '[options] <version>' 531 command.params = '[options] <version>'
528 command.supportedTypes = ('gecko', 'chrome', 'safari', 'edge') 532 command.supportedTypes = ('gecko', 'chrome', 'safari', 'edge')
529 533
530 with addCommand(updatePSL, 'updatepsl') as command: 534 with addCommand(updatePSL, 'updatepsl') as command:
531 command.shortDescription = 'Updates Public Suffix List' 535 command.shortDescription = 'Updates Public Suffix List'
532 command.description = 'Downloads Public Suffix List (see http://publicsuffix .org/) and generates lib/publicSuffixList.js from it.' 536 command.description = 'Downloads Public Suffix List (see http://publicsuffix .org/) and generates lib/publicSuffixList.js from it.'
533 command.supportedTypes = ('chrome',) 537 command.supportedTypes = ('chrome',)
534 538
535 539
536 def getType(baseDir, scriptName, args): 540 def getType(baseDir, scriptName, args):
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if option in ('-h', '--help'): 602 if option in ('-h', '--help'):
599 usage(scriptName, type, command) 603 usage(scriptName, type, command)
600 sys.exit() 604 sys.exit()
601 commands[command](baseDir, scriptName, opts, args, type) 605 commands[command](baseDir, scriptName, opts, args, type)
602 else: 606 else:
603 print 'Command %s is not supported for this application type' % comm and 607 print 'Command %s is not supported for this application type' % comm and
604 usage(scriptName, type) 608 usage(scriptName, type)
605 else: 609 else:
606 print 'Command %s is unrecognized' % command 610 print 'Command %s is unrecognized' % command
607 usage(scriptName, type) 611 usage(scriptName, type)
OLDNEW
« no previous file with comments | « no previous file | releaseAutomation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld