OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """A CherryPy-based webserver to host images and build packages.""" | 7 """A CherryPy-based webserver to host images and build packages.""" |
8 | 8 |
9 import cherrypy | 9 import cherrypy |
10 import optparse | 10 import optparse |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 parser = optparse.OptionParser(usage) | 111 parser = optparse.OptionParser(usage) |
112 parser.add_option('--archive_dir', dest='archive_dir', | 112 parser.add_option('--archive_dir', dest='archive_dir', |
113 help='serve archived builds only.') | 113 help='serve archived builds only.') |
114 parser.add_option('--client_prefix', dest='client_prefix', | 114 parser.add_option('--client_prefix', dest='client_prefix', |
115 help='Required prefix for client software version.', | 115 help='Required prefix for client software version.', |
116 default='MementoSoftwareUpdate') | 116 default='MementoSoftwareUpdate') |
117 parser.add_option('--factory_config', dest='factory_config', | 117 parser.add_option('--factory_config', dest='factory_config', |
118 help='Config file for serving images from factory floor.') | 118 help='Config file for serving images from factory floor.') |
119 parser.add_option('--image', dest='image', | 119 parser.add_option('--image', dest='image', |
120 help='Force update using this image.') | 120 help='Force update using this image.') |
| 121 parser.add_option('-p', '--pregenerate_update', action='store_true', |
| 122 default=False, help='Pre-generate update payload.') |
121 parser.add_option('--port', default=8080, | 123 parser.add_option('--port', default=8080, |
122 help='Port for the dev server to use.') | 124 help='Port for the dev server to use.') |
123 parser.add_option('--src_image', default='', | 125 parser.add_option('--src_image', default='', |
124 help='Image on remote machine for generating delta update.') | 126 help='Image on remote machine for generating delta update.') |
125 parser.add_option('-t', action='store_true', dest='test_image') | 127 parser.add_option('-t', action='store_true', dest='test_image') |
126 parser.add_option('-u', '--urlbase', dest='urlbase', | 128 parser.add_option('-u', '--urlbase', dest='urlbase', |
127 help='base URL, other than devserver, for update images.') | 129 help='base URL, other than devserver, for update images.') |
128 parser.add_option('--use_cached', action="store_true", default=False, | 130 parser.add_option('--use_cached', action="store_true", default=False, |
129 help='Prefer cached image regardless of timestamps.') | 131 help='Prefer cached image regardless of timestamps.') |
130 parser.add_option('--validate_factory_config', action="store_true", | 132 parser.add_option('--validate_factory_config', action="store_true", |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 # Sanity-check for use of validate_factory_config. | 166 # Sanity-check for use of validate_factory_config. |
165 if not options.factory_config and options.validate_factory_config: | 167 if not options.factory_config and options.validate_factory_config: |
166 parser.error('You need a factory_config to validate.') | 168 parser.error('You need a factory_config to validate.') |
167 | 169 |
168 if options.factory_config: | 170 if options.factory_config: |
169 updater.ImportFactoryConfigFile(options.factory_config, | 171 updater.ImportFactoryConfigFile(options.factory_config, |
170 options.validate_factory_config) | 172 options.validate_factory_config) |
171 # We don't run the dev server with this option. | 173 # We don't run the dev server with this option. |
172 if options.validate_factory_config: | 174 if options.validate_factory_config: |
173 sys.exit(0) | 175 sys.exit(0) |
| 176 elif options.pregenerate_update: |
| 177 updater.PreGenerateUpdate() |
174 | 178 |
175 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) | 179 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) |
OLD | NEW |