| OLD | NEW |
| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 384 |
| 385 def runReleaseAutomation(baseDir, scriptName, opts, args, type): | 385 def runReleaseAutomation(baseDir, scriptName, opts, args, type): |
| 386 keyFile = None | 386 keyFile = None |
| 387 downloadsRepo = os.path.join(baseDir, '..', 'downloads') | 387 downloadsRepo = os.path.join(baseDir, '..', 'downloads') |
| 388 for option, value in opts: | 388 for option, value in opts: |
| 389 if option in ('-k', '--key'): | 389 if option in ('-k', '--key'): |
| 390 keyFile = value | 390 keyFile = value |
| 391 elif option in ('-d', '--downloads'): | 391 elif option in ('-d', '--downloads'): |
| 392 downloadsRepo = value | 392 downloadsRepo = value |
| 393 | 393 |
| 394 if type == 'gecko': | 394 if len(args) == 0: |
| 395 if len(args) == 0: | 395 print 'No version number specified for the release' |
| 396 print 'No version number specified for the release' | 396 usage(scriptName, type, 'release') |
| 397 usage(scriptName, type, 'release') | 397 return |
| 398 return | 398 version = args[0] |
| 399 version = args[0] | 399 if re.search(r'[^\d\.]', version): |
| 400 if re.search(r'[^\w\.]', version): | 400 print 'Wrong version number format' |
| 401 print 'Wrong version number format' | 401 usage(scriptName, type, 'release') |
| 402 return |
| 403 |
| 404 if keyFile == None: |
| 405 if type == "gecko": |
| 406 print >>sys.stderr, "Warning: no key file specified, creating an unsigned
release build\n" |
| 407 else: |
| 408 print >>sys.stderr, "Error: key file is required for the release" |
| 402 usage(scriptName, type, 'release') | 409 usage(scriptName, type, 'release') |
| 403 return | 410 return |
| 404 | 411 |
| 405 if keyFile == None: | 412 import buildtools.releaseAutomation as releaseAutomation |
| 406 print 'Warning: no key file specified, creating an unsigned release build\
n' | 413 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) |
| 407 | |
| 408 import buildtools.releaseAutomationGecko as releaseAutomation | |
| 409 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) | |
| 410 | 414 |
| 411 def updatePSL(baseDir, scriptName, opts, args, type): | 415 def updatePSL(baseDir, scriptName, opts, args, type): |
| 412 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 416 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater |
| 413 publicSuffixListUpdater.updatePSL(baseDir) | 417 publicSuffixListUpdater.updatePSL(baseDir) |
| 414 | 418 |
| 415 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: | 419 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: |
| 416 command.shortDescription = 'Show this message' | 420 command.shortDescription = 'Show this message' |
| 417 | 421 |
| 418 with addCommand(runBuild, 'build') as command: | 422 with addCommand(runBuild, 'build') as command: |
| 419 command.shortDescription = 'Create a build' | 423 command.shortDescription = 'Create a build' |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') | 481 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') |
| 478 command.params = '[options] <directory>' | 482 command.params = '[options] <directory>' |
| 479 command.supportedTypes = ('gecko') | 483 command.supportedTypes = ('gecko') |
| 480 | 484 |
| 481 with addCommand(runReleaseAutomation, 'release') as command: | 485 with addCommand(runReleaseAutomation, 'release') as command: |
| 482 command.shortDescription = 'Run release automation' | 486 command.shortDescription = 'Run release automation' |
| 483 command.description = 'Note: If you are not the project owner then you '\ | 487 command.description = 'Note: If you are not the project owner then you '\ |
| 484 'probably don\'t want to run this!\n\n'\ | 488 'probably don\'t want to run this!\n\n'\ |
| 485 'Runs release automation: creates downloads for the new version, tags '\ | 489 'Runs release automation: creates downloads for the new version, tags '\ |
| 486 'source code repository as well as downloads and buildtools repository.' | 490 'source code repository as well as downloads and buildtools repository.' |
| 487 command.addOption('File containing private key and certificates required to si
gn the release', short='k', long='key', value='file', types=('gecko')) | 491 command.addOption('File containing private key and certificates required to si
gn the release', short='k', long='key', value='file', types=('gecko', 'chrome')) |
| 488 command.addOption('Directory containing downloads repository (if omitted ../do
wnloads is assumed)', short='d', long='downloads', value='dir') | 492 command.addOption('Directory containing downloads repository (if omitted ../do
wnloads is assumed)', short='d', long='downloads', value='dir') |
| 489 command.params = '[options] <version>' | 493 command.params = '[options] <version>' |
| 490 command.supportedTypes = ('gecko') | 494 command.supportedTypes = ('gecko', 'chrome') |
| 491 | 495 |
| 492 with addCommand(updatePSL, 'updatepsl') as command: | 496 with addCommand(updatePSL, 'updatepsl') as command: |
| 493 command.shortDescription = 'Updates Public Suffix List' | 497 command.shortDescription = 'Updates Public Suffix List' |
| 494 command.description = 'Downloads Public Suffix List (see http://publicsuffix.o
rg/) and generates lib/publicSuffixList.js from it.' | 498 command.description = 'Downloads Public Suffix List (see http://publicsuffix.o
rg/) and generates lib/publicSuffixList.js from it.' |
| 495 command.supportedTypes = ('chrome', 'opera') | 499 command.supportedTypes = ('chrome', 'opera') |
| 496 | 500 |
| 497 def getType(baseDir, scriptName, args): | 501 def getType(baseDir, scriptName, args): |
| 498 # Look for an explicit type parameter (has to be the first parameter) | 502 # Look for an explicit type parameter (has to be the first parameter) |
| 499 if len(args) >= 2 and args[0] == '-t': | 503 if len(args) >= 2 and args[0] == '-t': |
| 500 type = args[1] | 504 type = args[1] |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 if option in ('-h', '--help'): | 562 if option in ('-h', '--help'): |
| 559 usage(scriptName, type, command) | 563 usage(scriptName, type, command) |
| 560 sys.exit() | 564 sys.exit() |
| 561 commands[command](baseDir, scriptName, opts, args, type) | 565 commands[command](baseDir, scriptName, opts, args, type) |
| 562 else: | 566 else: |
| 563 print 'Command %s is not supported for this application type' % command | 567 print 'Command %s is not supported for this application type' % command |
| 564 usage(scriptName, type) | 568 usage(scriptName, type) |
| 565 else: | 569 else: |
| 566 print 'Command %s is unrecognized' % command | 570 print 'Command %s is unrecognized' % command |
| 567 usage(scriptName, type) | 571 usage(scriptName, type) |
| OLD | NEW |