| 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-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 '-a', | 380 '-a', |
| 381 '-p', | 381 '-p', |
| 382 '-x=js,jsm', | 382 '-x=js,jsm', |
| 383 os.path.join(baseDir, 'lib')] | 383 os.path.join(baseDir, 'lib')] |
| 384 if quiet: | 384 if quiet: |
| 385 subprocess.check_output(command) | 385 subprocess.check_output(command) |
| 386 else: | 386 else: |
| 387 subprocess.check_call(command) | 387 subprocess.check_call(command) |
| 388 | 388 |
| 389 def runReleaseAutomation(baseDir, scriptName, opts, args, type): | 389 def runReleaseAutomation(baseDir, scriptName, opts, args, type): |
| 390 keyFile = None | 390 keyFiles = [] |
| 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 keyFiles.append(value) |
| 395 elif option in ('-d', '--downloads'): | 395 elif option in ('-d', '--downloads'): |
| 396 downloadsRepo = value | 396 downloadsRepo = value |
| 397 | 397 |
| 398 if len(args) == 0: | 398 if len(args) == 0: |
| 399 print 'No version number specified for the release' | 399 print 'No version number specified for the release' |
| 400 usage(scriptName, type, 'release') | 400 usage(scriptName, type, 'release') |
| 401 return | 401 return |
| 402 version = args[0] | 402 version = args[0] |
| 403 if re.search(r'[^\d\.]', version): | 403 if re.search(r'[^\d\.]', version): |
| 404 print 'Wrong version number format' | 404 print 'Wrong version number format' |
| 405 usage(scriptName, type, 'release') | 405 usage(scriptName, type, 'release') |
| 406 return | 406 return |
| 407 | 407 |
| 408 if keyFile == None: | 408 if type == "gecko" and len(keyFiles) == 0: |
| 409 if type == "gecko": | 409 print >>sys.stderr, "Warning: no key file specified, creating an unsigned re
lease build\n" |
| 410 print >>sys.stderr, "Warning: no key file specified, creating an unsigned
release build\n" | 410 elif type == "gecko" and len(keyFiles) > 1: |
| 411 else: | 411 print >>sys.stderr, "Error: too many key files, only one required" |
| 412 print >>sys.stderr, "Error: key file is required for the release" | 412 usage(scriptName, type, 'release') |
| 413 usage(scriptName, type, 'release') | 413 return |
| 414 return | 414 elif type == "chrome" and len(keyFiles) != 2: |
| 415 print >>sys.stderr, "Error: wrong number of key files specified, two keys (C
hrome and Safari) required for the release" |
| 416 usage(scriptName, type, 'release') |
| 417 return |
| 415 | 418 |
| 416 import buildtools.releaseAutomation as releaseAutomation | 419 import buildtools.releaseAutomation as releaseAutomation |
| 417 releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo) | 420 releaseAutomation.run(baseDir, type, version, keyFiles, downloadsRepo) |
| 418 | 421 |
| 419 def updatePSL(baseDir, scriptName, opts, args, type): | 422 def updatePSL(baseDir, scriptName, opts, args, type): |
| 420 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater | 423 import buildtools.publicSuffixListUpdater as publicSuffixListUpdater |
| 421 publicSuffixListUpdater.updatePSL(baseDir) | 424 publicSuffixListUpdater.updatePSL(baseDir) |
| 422 | 425 |
| 423 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: | 426 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName,
type), ('help', '-h', '--help')) as command: |
| 424 command.shortDescription = 'Show this message' | 427 command.shortDescription = 'Show this message' |
| 425 | 428 |
| 426 with addCommand(runBuild, 'build') as command: | 429 with addCommand(runBuild, 'build') as command: |
| 427 command.shortDescription = 'Create a build' | 430 command.shortDescription = 'Create a build' |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') | 488 command.addOption('Suppress JsDoc Toolkit output', short='q', long='quiet') |
| 486 command.params = '[options] <directory>' | 489 command.params = '[options] <directory>' |
| 487 command.supportedTypes = ('gecko') | 490 command.supportedTypes = ('gecko') |
| 488 | 491 |
| 489 with addCommand(runReleaseAutomation, 'release') as command: | 492 with addCommand(runReleaseAutomation, 'release') as command: |
| 490 command.shortDescription = 'Run release automation' | 493 command.shortDescription = 'Run release automation' |
| 491 command.description = 'Note: If you are not the project owner then you '\ | 494 command.description = 'Note: If you are not the project owner then you '\ |
| 492 'probably don\'t want to run this!\n\n'\ | 495 'probably don\'t want to run this!\n\n'\ |
| 493 'Runs release automation: creates downloads for the new version, tags '\ | 496 'Runs release automation: creates downloads for the new version, tags '\ |
| 494 'source code repository as well as downloads and buildtools repository.' | 497 'source code repository as well as downloads and buildtools repository.' |
| 495 command.addOption('File containing private key and certificates required to si
gn the release', short='k', long='key', value='file', types=('gecko', 'chrome')) | 498 command.addOption('File containing private key and certificates required to si
gn the release. Note that for Chrome releases this option needs to be specified
twice: first a key to sign Chrome/Opera builds, then another to sign the Safari
build.', short='k', long='key', value='file', types=('gecko', 'chrome')) |
| 496 command.addOption('Directory containing downloads repository (if omitted ../do
wnloads is assumed)', short='d', long='downloads', value='dir') | 499 command.addOption('Directory containing downloads repository (if omitted ../do
wnloads is assumed)', short='d', long='downloads', value='dir') |
| 497 command.params = '[options] <version>' | 500 command.params = '[options] <version>' |
| 498 command.supportedTypes = ('gecko', 'chrome') | 501 command.supportedTypes = ('gecko', 'chrome') |
| 499 | 502 |
| 500 with addCommand(updatePSL, 'updatepsl') as command: | 503 with addCommand(updatePSL, 'updatepsl') as command: |
| 501 command.shortDescription = 'Updates Public Suffix List' | 504 command.shortDescription = 'Updates Public Suffix List' |
| 502 command.description = 'Downloads Public Suffix List (see http://publicsuffix.o
rg/) and generates lib/publicSuffixList.js from it.' | 505 command.description = 'Downloads Public Suffix List (see http://publicsuffix.o
rg/) and generates lib/publicSuffixList.js from it.' |
| 503 command.supportedTypes = ('chrome', 'opera') | 506 command.supportedTypes = ('chrome', 'opera') |
| 504 | 507 |
| 505 def getType(baseDir, scriptName, args): | 508 def getType(baseDir, scriptName, args): |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if option in ('-h', '--help'): | 569 if option in ('-h', '--help'): |
| 567 usage(scriptName, type, command) | 570 usage(scriptName, type, command) |
| 568 sys.exit() | 571 sys.exit() |
| 569 commands[command](baseDir, scriptName, opts, args, type) | 572 commands[command](baseDir, scriptName, opts, args, type) |
| 570 else: | 573 else: |
| 571 print 'Command %s is not supported for this application type' % command | 574 print 'Command %s is not supported for this application type' % command |
| 572 usage(scriptName, type) | 575 usage(scriptName, type) |
| 573 else: | 576 else: |
| 574 print 'Command %s is unrecognized' % command | 577 print 'Command %s is unrecognized' % command |
| 575 usage(scriptName, type) | 578 usage(scriptName, type) |
| OLD | NEW |