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

Delta Between Two Patch Sets: build.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Left Patch Set: Created Sept. 4, 2013, 8:03 a.m.
Right Patch Set: Created Oct. 31, 2013, 3:40 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 | « background.html.tmpl ('k') | imageConversion.py » ('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 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus build tools, 3 # This file is part of the Adblock Plus build tools,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b uildNum=buildNum, 195 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b uildNum=buildNum,
196 releaseBuild=releaseBuild, keyFile=keyFile, 196 releaseBuild=releaseBuild, keyFile=keyFile,
197 multicompartment=multicompartment) 197 multicompartment=multicompartment)
198 elif type == 'chrome' or type == 'opera': 198 elif type == 'chrome' or type == 'opera':
199 import buildtools.packagerChrome as packager 199 import buildtools.packagerChrome as packager
200 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, 200 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
201 releaseBuild=releaseBuild, keyFile=keyFile, 201 releaseBuild=releaseBuild, keyFile=keyFile,
202 experimentalAPI=experimentalAPI) 202 experimentalAPI=experimentalAPI)
203 elif type == 'safari': 203 elif type == 'safari':
204 import buildtools.packagerSafari as packager 204 import buildtools.packagerSafari as packager
205 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, releaseBuild=releaseBuild) 205 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
206 206 releaseBuild=releaseBuild, keyFile=keyFile)
207 207
208 208
209 def runAutoInstall(baseDir, scriptName, opts, args, type): 209 def runAutoInstall(baseDir, scriptName, opts, args, type):
210 if len(args) == 0: 210 if len(args) == 0:
211 print 'Port of the Extension Auto-Installer needs to be specified' 211 print 'Port of the Extension Auto-Installer needs to be specified'
212 usage(scriptName, type, 'autoinstall') 212 usage(scriptName, type, 'autoinstall')
213 return 213 return
214 214
215 multicompartment = False 215 multicompartment = False
216 for option, value in opts: 216 for option, value in opts:
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 def runReleaseAutomation(baseDir, scriptName, opts, args, type): 389 def runReleaseAutomation(baseDir, scriptName, opts, args, type):
390 keyFile = None 390 keyFile = None
391 downloadsRepo = os.path.join(baseDir, '..', 'downloads') 391 downloadsRepo = os.path.join(baseDir, '..', 'downloads')
392 for option, value in opts: 392 for option, value in opts:
393 if option in ('-k', '--key'): 393 if option in ('-k', '--key'):
394 keyFile = value 394 keyFile = value
395 elif option in ('-d', '--downloads'): 395 elif option in ('-d', '--downloads'):
396 downloadsRepo = value 396 downloadsRepo = value
397 397
398 if type == 'gecko': 398 if len(args) == 0:
399 if len(args) == 0: 399 print 'No version number specified for the release'
400 print 'No version number specified for the release' 400 usage(scriptName, type, 'release')
401 return
402 version = args[0]
403 if re.search(r'[^\d\.]', version):
404 print 'Wrong version number format'
405 usage(scriptName, type, 'release')
406 return
407
408 if keyFile == None:
409 if type == "gecko":
410 print >>sys.stderr, "Warning: no key file specified, creating an unsigned release build\n"
411 else:
412 print >>sys.stderr, "Error: key file is required for the release"
401 usage(scriptName, type, 'release') 413 usage(scriptName, type, 'release')
402 return 414 return
403 version = args[0] 415
404 if re.search(r'[^\w\.]', version): 416 import buildtools.releaseAutomation as releaseAutomation
405 print 'Wrong version number format' 417 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo)
406 usage(scriptName, type, 'release')
407 return
408
409 if keyFile == None:
410 print 'Warning: no key file specified, creating an unsigned release build\ n'
411
412 import buildtools.releaseAutomationGecko as releaseAutomation
413 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo)
414 418
415 def updatePSL(baseDir, scriptName, opts, args, type): 419 def updatePSL(baseDir, scriptName, opts, args, type):
416 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater 420 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater
417 publicSuffixListUpdater.updatePSL(baseDir) 421 publicSuffixListUpdater.updatePSL(baseDir)
418 422
419 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: 423 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command:
420 command.shortDescription = 'Show this message' 424 command.shortDescription = 'Show this message'
421 425
422 with addCommand(runBuild, 'build') as command: 426 with addCommand(runBuild, 'build') as command:
423 command.shortDescription = 'Create a build' 427 command.shortDescription = 'Create a build'
424 command.description = 'Creates an extension build with given file name. If out put_file is missing a default name will be chosen.' 428 command.description = 'Creates an extension build with given file name. If out put_file is missing a default name will be chosen.'
425 command.params = '[options] [output_file]' 429 command.params = '[options] [output_file]'
426 command.addOption('Only include the given locales (if omitted: all locales not marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('ge cko')) 430 command.addOption('Only include the given locales (if omitted: all locales not marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('ge cko'))
427 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') 431 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num')
428 command.addOption('File containing private key and certificates required to si gn the package', short='k', long='key', value='file', types=('gecko', 'chrome', 'opera')) 432 command.addOption('File containing private key and certificates required to si gn the package', short='k', long='key', value='file', types=('gecko', 'chrome', 'opera', 'safari'))
429 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment', types=('gecko')) 433 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment', types=('gecko'))
430 command.addOption('Create a release build', short='r', long='release') 434 command.addOption('Create a release build', short='r', long='release')
431 command.addOption('Enable use of experimental APIs', long='experimental') 435 command.addOption('Enable use of experimental APIs', long='experimental')
432 command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari') 436 command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari')
433 437
434 with addCommand(runAutoInstall, 'autoinstall') as command: 438 with addCommand(runAutoInstall, 'autoinstall') as command:
435 command.shortDescription = 'Install extension automatically' 439 command.shortDescription = 'Install extension automatically'
436 command.description = 'Will automatically install the extension in a browser r unning Extension Auto-Installer. If host parameter is omitted assumes that the b rowser runs on localhost.' 440 command.description = 'Will automatically install the extension in a browser r unning Extension Auto-Installer. If host parameter is omitted assumes that the b rowser runs on localhost.'
437 command.params = '[<host>:]<port>' 441 command.params = '[<host>:]<port>'
438 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment') 442 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment')
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') 485 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet')
482 command.params = '[options] <directory>' 486 command.params = '[options] <directory>'
483 command.supportedTypes = ('gecko') 487 command.supportedTypes = ('gecko')
484 488
485 with addCommand(runReleaseAutomation, 'release') as command: 489 with addCommand(runReleaseAutomation, 'release') as command:
486 command.shortDescription = 'Run release automation' 490 command.shortDescription = 'Run release automation'
487 command.description = 'Note: If you are not the project owner then you '\ 491 command.description = 'Note: If you are not the project owner then you '\
488 'probably don\'t want to run this!\n\n'\ 492 'probably don\'t want to run this!\n\n'\
489 'Runs release automation: creates downloads for the new version, tags '\ 493 'Runs release automation: creates downloads for the new version, tags '\
490 'source code repository as well as downloads and buildtools repository.' 494 'source code repository as well as downloads and buildtools repository.'
491 command.addOption('File containing private key and certificates required to si gn the release', short='k', long='key', value='file', types=('gecko')) 495 command.addOption('File containing private key and certificates required to si gn the release', short='k', long='key', value='file', types=('gecko', 'chrome'))
492 command.addOption('Directory containing downloads repository (if omitted ../do wnloads is assumed)', short='d', long='downloads', value='dir') 496 command.addOption('Directory containing downloads repository (if omitted ../do wnloads is assumed)', short='d', long='downloads', value='dir')
493 command.params = '[options] <version>' 497 command.params = '[options] <version>'
494 command.supportedTypes = ('gecko') 498 command.supportedTypes = ('gecko', 'chrome')
495 499
496 with addCommand(updatePSL, 'updatepsl') as command: 500 with addCommand(updatePSL, 'updatepsl') as command:
497 command.shortDescription = 'Updates Public Suffix List' 501 command.shortDescription = 'Updates Public Suffix List'
498 command.description = 'Downloads Public Suffix List (see http://publicsuffix.o rg/) and generates lib/publicSuffixList.js from it.' 502 command.description = 'Downloads Public Suffix List (see http://publicsuffix.o rg/) and generates lib/publicSuffixList.js from it.'
499 command.supportedTypes = ('chrome', 'opera') 503 command.supportedTypes = ('chrome', 'opera')
500 504
501 def getType(baseDir, scriptName, args): 505 def getType(baseDir, scriptName, args):
502 # Look for an explicit type parameter (has to be the first parameter) 506 # Look for an explicit type parameter (has to be the first parameter)
503 if len(args) >= 2 and args[0] == '-t': 507 if len(args) >= 2 and args[0] == '-t':
504 type = args[1] 508 type = args[1]
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 if option in ('-h', '--help'): 566 if option in ('-h', '--help'):
563 usage(scriptName, type, command) 567 usage(scriptName, type, command)
564 sys.exit() 568 sys.exit()
565 commands[command](baseDir, scriptName, opts, args, type) 569 commands[command](baseDir, scriptName, opts, args, type)
566 else: 570 else:
567 print 'Command %s is not supported for this application type' % command 571 print 'Command %s is not supported for this application type' % command
568 usage(scriptName, type) 572 usage(scriptName, type)
569 else: 573 else:
570 print 'Command %s is unrecognized' % command 574 print 'Command %s is unrecognized' % command
571 usage(scriptName, type) 575 usage(scriptName, type)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld