Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import autoupdate | 5 import autoupdate |
| 6 import buildutil | 6 import buildutil |
| 7 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import web | 10 import web |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) | 39 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) |
| 40 err = os.system(emerge_command) | 40 err = os.system(emerge_command) |
| 41 if err != 0: | 41 if err != 0: |
| 42 raise Exception('failed to execute %s' % emerge_command) | 42 raise Exception('failed to execute %s' % emerge_command) |
| 43 | 43 |
| 44 if __name__ == '__main__': | 44 if __name__ == '__main__': |
| 45 usage = 'usage: %prog [options]' | 45 usage = 'usage: %prog [options]' |
| 46 parser = optparse.OptionParser(usage) | 46 parser = optparse.OptionParser(usage) |
| 47 parser.add_option('--archive_dir', dest='archive_dir', | 47 parser.add_option('--archive_dir', dest='archive_dir', |
| 48 help='serve archived builds only.') | 48 help='serve archived builds only.') |
| 49 parser.add_option('--client_prefix', dest='client_prefix', | |
| 50 help='Required prefix for client software version.', | |
| 51 default='MementoSoftwareUpdate') | |
| 49 parser.add_option('--factory_config', dest='factory_config', | 52 parser.add_option('--factory_config', dest='factory_config', |
| 50 help='Config file for serving images from factory floor.') | 53 help='Config file for serving images from factory floor.') |
| 51 parser.add_option('-t', action='store_true', dest='test_image') | 54 parser.add_option('-t', action='store_true', dest='test_image') |
| 52 parser.add_option('-u', '--urlbase', dest='urlbase', | 55 parser.add_option('-u', '--urlbase', dest='urlbase', |
| 53 help='base URL, other than devserver, for update images.') | 56 help='base URL, other than devserver, for update images.') |
| 54 parser.add_option('--validate_factory_config', action="store_true", | 57 parser.add_option('--validate_factory_config', action="store_true", |
| 55 dest='validate_factory_config', | 58 dest='validate_factory_config', |
| 56 help='Validate factory config file, then exit.') | 59 help='Validate factory config file, then exit.') |
| 57 options, args = parser.parse_args() | 60 options, args = parser.parse_args() |
| 58 # clean up the args, due to httpserver's hardcoded use of sys.argv | 61 # clean up the args, due to httpserver's hardcoded use of sys.argv |
| 59 if options.archive_dir: | 62 if options.archive_dir: |
| 60 sys.argv.remove('--archive_dir') | 63 sys.argv.remove('--archive_dir') |
| 61 sys.argv.remove(options.archive_dir) | 64 sys.argv.remove(options.archive_dir) |
| 65 if '--client_prefix' in sys.argv: | |
|
seano
2010/05/07 23:23:17
why not 'if options.client_prefix' ?
(I'd like t
| |
| 66 sys.argv.remove('--client_prefix') | |
| 67 sys.argv.remove(options.client_prefix) | |
| 62 if options.factory_config: | 68 if options.factory_config: |
| 63 sys.argv.remove('--factory_config') | 69 sys.argv.remove('--factory_config') |
| 64 sys.argv.remove(options.factory_config) | 70 sys.argv.remove(options.factory_config) |
| 65 if options.test_image: | 71 if options.test_image: |
| 66 sys.argv.remove('-t') | 72 sys.argv.remove('-t') |
| 67 if options.urlbase: | 73 if options.urlbase: |
| 68 sys.argv.remove('-u') | 74 sys.argv.remove('-u') |
| 69 sys.argv.remove(options.urlbase) | 75 sys.argv.remove(options.urlbase) |
| 70 if options.validate_factory_config: | 76 if options.validate_factory_config: |
| 71 sys.argv.remove('--validate_factory_config') | 77 sys.argv.remove('--validate_factory_config') |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 95 sys.exit(0) | 101 sys.exit(0) |
| 96 urls = ('/', 'index', | 102 urls = ('/', 'index', |
| 97 '/update', 'update', | 103 '/update', 'update', |
| 98 '/update/(.+)', 'update', | 104 '/update/(.+)', 'update', |
| 99 '/webbuild', 'webbuild', | 105 '/webbuild', 'webbuild', |
| 100 '/build', 'build') | 106 '/build', 'build') |
| 101 | 107 |
| 102 app = web.application(urls, globals(), autoreload=True) | 108 app = web.application(urls, globals(), autoreload=True) |
| 103 render = web.template.render('templates/') | 109 render = web.template.render('templates/') |
| 104 app.run() | 110 app.run() |
| OLD | NEW |