| 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 SimpleHTTPServer | 9 import SimpleHTTPServer |
| 10 import sys | 10 import sys |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 input = web.input() | 38 input = web.input() |
| 39 web.debug('emerging %s ' % input.pkg) | 39 web.debug('emerging %s ' % input.pkg) |
| 40 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) | 40 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) |
| 41 err = os.system(emerge_command) | 41 err = os.system(emerge_command) |
| 42 if err != 0: | 42 if err != 0: |
| 43 raise Exception('failed to execute %s' % emerge_command) | 43 raise Exception('failed to execute %s' % emerge_command) |
| 44 | 44 |
| 45 if __name__ == '__main__': | 45 if __name__ == '__main__': |
| 46 usage = 'usage: %prog [options]' | 46 usage = 'usage: %prog [options]' |
| 47 parser = optparse.OptionParser(usage) | 47 parser = optparse.OptionParser(usage) |
| 48 parser.add_option('-a', '--archive_dir', dest='archive_dir', | 48 parser.add_option('--archive_dir', dest='archive_dir', |
| 49 help='serve archived builds only.') | 49 help='serve archived builds only.') |
| 50 parser.add_option('--factory_config', dest='factory_config', | 50 parser.add_option('--factory_config', dest='factory_config', |
| 51 help='Config file for serving images from factory floor.') | 51 help='Config file for serving images from factory floor.') |
| 52 parser.add_option('-t', action='store_true', dest='test_image') | 52 parser.add_option('-t', action='store_true', dest='test_image') |
| 53 parser.add_option('-u', '--urlbase', dest='urlbase', | 53 parser.add_option('-u', '--urlbase', dest='urlbase', |
| 54 help='base URL, other than devserver, for update images.') | 54 help='base URL, other than devserver, for update images.') |
| 55 parser.add_option('--validate_factory_config', action="store_true", | 55 parser.add_option('--validate_factory_config', action="store_true", |
| 56 dest='validate_factory_config', | 56 dest='validate_factory_config', |
| 57 help='Validate factory config file, then exit.') | 57 help='Validate factory config file, then exit.') |
| 58 options, args = parser.parse_args() | 58 options, args = parser.parse_args() |
| 59 # clean up the args, due to httpserver's hardcoded use of sys.argv | 59 # clean up the args, due to httpserver's hardcoded use of sys.argv |
| 60 if options.archive_dir: | 60 if options.archive_dir: |
| 61 sys.argv.remove('-a') | |
| 62 sys.argv.remove('--archive_dir') | 61 sys.argv.remove('--archive_dir') |
| 63 sys.argv.remove(options.archive_dir) | 62 sys.argv.remove(options.archive_dir) |
| 64 if options.factory_config: | 63 if options.factory_config: |
| 65 sys.argv.remove('--factory_config') | 64 sys.argv.remove('--factory_config') |
| 66 sys.argv.remove(options.factory_config) | 65 sys.argv.remove(options.factory_config) |
| 67 if options.test_image: | 66 if options.test_image: |
| 68 sys.argv.remove('-t') | 67 sys.argv.remove('-t') |
| 69 if options.urlbase: | 68 if options.urlbase: |
| 70 sys.argv.remove('-u') | 69 sys.argv.remove('-u') |
| 71 sys.argv.remove(options.urlbase) | 70 sys.argv.remove(options.urlbase) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 97 sys.exit(0) | 96 sys.exit(0) |
| 98 urls = ('/', 'index', | 97 urls = ('/', 'index', |
| 99 '/update', 'update', | 98 '/update', 'update', |
| 100 '/update/(.+)', 'update', | 99 '/update/(.+)', 'update', |
| 101 '/webbuild', 'webbuild', | 100 '/webbuild', 'webbuild', |
| 102 '/build', 'build') | 101 '/build', 'build') |
| 103 | 102 |
| 104 app = web.application(urls, globals(), autoreload=True) | 103 app = web.application(urls, globals(), autoreload=True) |
| 105 render = web.template.render('templates/') | 104 render = web.template.render('templates/') |
| 106 app.run() | 105 app.run() |
| OLD | NEW |