| OLD | NEW |
| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 elif option in ('-k', '--key'): | 191 elif option in ('-k', '--key'): |
| 192 keyFile = value | 192 keyFile = value |
| 193 elif option in ('-m', '--multi-compartment'): | 193 elif option in ('-m', '--multi-compartment'): |
| 194 multicompartment = True | 194 multicompartment = True |
| 195 elif option in ('-r', '--release'): | 195 elif option in ('-r', '--release'): |
| 196 releaseBuild = True | 196 releaseBuild = True |
| 197 outFile = args[0] if len(args) > 0 else None | 197 outFile = args[0] if len(args) > 0 else None |
| 198 | 198 |
| 199 if type == 'gecko': | 199 if type == 'gecko': |
| 200 import buildtools.packagerGecko as packager | 200 import buildtools.packagerGecko as packager |
| 201 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locale
s, buildNum=buildNum, | 201 packager.createBuild(baseDir, type=type, outFile=outFile, |
| 202 releaseBuild=releaseBuild, keyFile=keyFile, | 202 locales=locales, buildNum=buildNum, |
| 203 releaseBuild=releaseBuild, |
| 203 multicompartment=multicompartment) | 204 multicompartment=multicompartment) |
| 204 elif type == 'chrome': | 205 elif type == 'chrome': |
| 205 import buildtools.packagerChrome as packager | 206 import buildtools.packagerChrome as packager |
| 206 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=build
Num, | 207 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=build
Num, |
| 207 releaseBuild=releaseBuild, keyFile=keyFile) | 208 releaseBuild=releaseBuild, keyFile=keyFile) |
| 208 elif type == 'safari': | 209 elif type == 'safari': |
| 209 import buildtools.packagerSafari as packager | 210 import buildtools.packagerSafari as packager |
| 210 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=build
Num, | 211 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=build
Num, |
| 211 releaseBuild=releaseBuild, keyFile=keyFile) | 212 releaseBuild=releaseBuild, keyFile=keyFile) |
| 212 | 213 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 if len(args) == 0: | 442 if len(args) == 0: |
| 442 print 'No version number specified for the release' | 443 print 'No version number specified for the release' |
| 443 usage(scriptName, type, 'release') | 444 usage(scriptName, type, 'release') |
| 444 return | 445 return |
| 445 version = args[0] | 446 version = args[0] |
| 446 if re.search(r'[^\d\.]', version): | 447 if re.search(r'[^\d\.]', version): |
| 447 print 'Wrong version number format' | 448 print 'Wrong version number format' |
| 448 usage(scriptName, type, 'release') | 449 usage(scriptName, type, 'release') |
| 449 return | 450 return |
| 450 | 451 |
| 451 if type == 'gecko' and len(keyFiles) == 0: | 452 if type == 'chrome' and len(keyFiles) != 2: |
| 452 print >>sys.stderr, 'Warning: no key file specified, creating an unsigne
d release build\n' | |
| 453 elif type == 'gecko' and len(keyFiles) > 1: | |
| 454 print >>sys.stderr, 'Error: too many key files, only one required' | |
| 455 usage(scriptName, type, 'release') | |
| 456 return | |
| 457 elif type == 'chrome' and len(keyFiles) != 2: | |
| 458 print >>sys.stderr, 'Error: wrong number of key files specified, two key
s (Chrome and Safari) required for the release' | 453 print >>sys.stderr, 'Error: wrong number of key files specified, two key
s (Chrome and Safari) required for the release' |
| 459 usage(scriptName, type, 'release') | 454 usage(scriptName, type, 'release') |
| 460 return | 455 return |
| 461 | 456 |
| 462 import buildtools.releaseAutomation as releaseAutomation | 457 import buildtools.releaseAutomation as releaseAutomation |
| 463 releaseAutomation.run(baseDir, type, version, keyFiles, downloadsRepo) | 458 releaseAutomation.run(baseDir, type, version, keyFiles, downloadsRepo) |
| 464 | 459 |
| 465 | 460 |
| 466 def updatePSL(baseDir, scriptName, opts, args, type): | 461 def updatePSL(baseDir, scriptName, opts, args, type): |
| 467 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 462 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater |
| 468 publicSuffixListUpdater.updatePSL(baseDir) | 463 publicSuffixListUpdater.updatePSL(baseDir) |
| 469 | 464 |
| 470 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: | 465 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: |
| 471 command.shortDescription = 'Show this message' | 466 command.shortDescription = 'Show this message' |
| 472 | 467 |
| 473 with addCommand(runBuild, 'build') as command: | 468 with addCommand(runBuild, 'build') as command: |
| 474 command.shortDescription = 'Create a build' | 469 command.shortDescription = 'Create a build' |
| 475 command.description = 'Creates an extension build with given file name. If o
utput_file is missing a default name will be chosen.' | 470 command.description = 'Creates an extension build with given file name. If o
utput_file is missing a default name will be chosen.' |
| 476 command.params = '[options] [output_file]' | 471 command.params = '[options] [output_file]' |
| 477 command.addOption('Only include the given locales (if omitted: all locales n
ot marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('
gecko')) | 472 command.addOption('Only include the given locales (if omitted: all locales n
ot marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('
gecko')) |
| 478 command.addOption('Use given build number (if omitted the build number will
be retrieved from Mercurial)', short='b', long='build', value='num') | 473 command.addOption('Use given build number (if omitted the build number will
be retrieved from Mercurial)', short='b', long='build', value='num') |
| 479 command.addOption('File containing private key and certificates required to
sign the package', short='k', long='key', value='file', types=('gecko', 'chrome'
, 'safari')) | 474 command.addOption('File containing private key and certificates required to
sign the package', short='k', long='key', value='file', types=('chrome', 'safari
')) |
| 480 command.addOption('Create a build for leak testing', short='m', long='multi-
compartment', types=('gecko')) | 475 command.addOption('Create a build for leak testing', short='m', long='multi-
compartment', types=('gecko')) |
| 481 command.addOption('Create a release build', short='r', long='release') | 476 command.addOption('Create a release build', short='r', long='release') |
| 482 command.supportedTypes = ('gecko', 'chrome', 'safari') | 477 command.supportedTypes = ('gecko', 'chrome', 'safari') |
| 483 | 478 |
| 484 with addCommand(runAutoInstall, 'autoinstall') as command: | 479 with addCommand(runAutoInstall, 'autoinstall') as command: |
| 485 command.shortDescription = 'Install extension automatically' | 480 command.shortDescription = 'Install extension automatically' |
| 486 command.description = 'Will automatically install the extension in a browser
running Extension Auto-Installer. If host parameter is omitted assumes that the
browser runs on localhost.' | 481 command.description = 'Will automatically install the extension in a browser
running Extension Auto-Installer. If host parameter is omitted assumes that the
browser runs on localhost.' |
| 487 command.params = '[<host>:]<port>' | 482 command.params = '[<host>:]<port>' |
| 488 command.addOption('Create a build for leak testing', short='m', long='multi-
compartment') | 483 command.addOption('Create a build for leak testing', short='m', long='multi-
compartment') |
| 489 command.supportedTypes = ('gecko') | 484 command.supportedTypes = ('gecko') |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 with addCommand(generateDocs, 'docs') as command: | 522 with addCommand(generateDocs, 'docs') as command: |
| 528 command.shortDescription = 'Generate documentation (requires node.js)' | 523 command.shortDescription = 'Generate documentation (requires node.js)' |
| 529 command.description = 'Generate documentation files and write them into the
specified directory. This operation requires JsDoc 3 to be installed.' | 524 command.description = 'Generate documentation files and write them into the
specified directory. This operation requires JsDoc 3 to be installed.' |
| 530 command.addOption('Suppress JsDoc output', short='q', long='quiet') | 525 command.addOption('Suppress JsDoc output', short='q', long='quiet') |
| 531 command.params = '[options] <directory>' | 526 command.params = '[options] <directory>' |
| 532 command.supportedTypes = ('gecko', 'chrome') | 527 command.supportedTypes = ('gecko', 'chrome') |
| 533 | 528 |
| 534 with addCommand(runReleaseAutomation, 'release') as command: | 529 with addCommand(runReleaseAutomation, 'release') as command: |
| 535 command.shortDescription = 'Run release automation' | 530 command.shortDescription = 'Run release automation' |
| 536 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.' | 531 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.' |
| 537 command.addOption('File containing private key and certificates required to
sign the release. Note that for Chrome releases this option needs to be specifie
d twice: first a key to sign Chrome builds, then another to sign the Safari buil
d.', short='k', long='key', value='file', types=('gecko', 'chrome')) | 532 command.addOption('File containing private key and certificates required to
sign the release. Note that for Chrome releases this option needs to be specifie
d twice: first a key to sign Chrome builds, then another to sign the Safari buil
d.', short='k', long='key', value='file', types=('chrome',)) |
| 538 command.addOption('Directory containing downloads repository (if omitted ../
downloads is assumed)', short='d', long='downloads', value='dir') | 533 command.addOption('Directory containing downloads repository (if omitted ../
downloads is assumed)', short='d', long='downloads', value='dir') |
| 539 command.params = '[options] <version>' | 534 command.params = '[options] <version>' |
| 540 command.supportedTypes = ('gecko', 'chrome') | 535 command.supportedTypes = ('gecko', 'chrome') |
| 541 | 536 |
| 542 with addCommand(updatePSL, 'updatepsl') as command: | 537 with addCommand(updatePSL, 'updatepsl') as command: |
| 543 command.shortDescription = 'Updates Public Suffix List' | 538 command.shortDescription = 'Updates Public Suffix List' |
| 544 command.description = 'Downloads Public Suffix List (see http://publicsuffix
.org/) and generates lib/publicSuffixList.js from it.' | 539 command.description = 'Downloads Public Suffix List (see http://publicsuffix
.org/) and generates lib/publicSuffixList.js from it.' |
| 545 command.supportedTypes = ('chrome',) | 540 command.supportedTypes = ('chrome',) |
| 546 | 541 |
| 547 | 542 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 if option in ('-h', '--help'): | 605 if option in ('-h', '--help'): |
| 611 usage(scriptName, type, command) | 606 usage(scriptName, type, command) |
| 612 sys.exit() | 607 sys.exit() |
| 613 commands[command](baseDir, scriptName, opts, args, type) | 608 commands[command](baseDir, scriptName, opts, args, type) |
| 614 else: | 609 else: |
| 615 print 'Command %s is not supported for this application type' % comm
and | 610 print 'Command %s is not supported for this application type' % comm
and |
| 616 usage(scriptName, type) | 611 usage(scriptName, type) |
| 617 else: | 612 else: |
| 618 print 'Command %s is unrecognized' % command | 613 print 'Command %s is unrecognized' % command |
| 619 usage(scriptName, type) | 614 usage(scriptName, type) |
| OLD | NEW |