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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if __name__ == '__main__': | 109 if __name__ == '__main__': |
110 usage = 'usage: %prog [options]' | 110 usage = 'usage: %prog [options]' |
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('--for_vm', dest='vm', default=False, action='store_true', |
| 120 help='Update is for a vm image.') |
119 parser.add_option('--image', dest='image', | 121 parser.add_option('--image', dest='image', |
120 help='Force update using this image.') | 122 help='Force update using this image.') |
121 parser.add_option('-p', '--pregenerate_update', action='store_true', | 123 parser.add_option('-p', '--pregenerate_update', action='store_true', |
122 default=False, help='Pre-generate update payload.') | 124 default=False, help='Pre-generate update payload.') |
123 parser.add_option('--port', default=8080, | 125 parser.add_option('--port', default=8080, |
124 help='Port for the dev server to use.') | 126 help='Port for the dev server to use.') |
125 parser.add_option('--src_image', default='', | 127 parser.add_option('--src_image', default='', |
126 help='Image on remote machine for generating delta update.') | 128 help='Image on remote machine for generating delta update.') |
127 parser.add_option('-t', action='store_true', dest='test_image') | 129 parser.add_option('-t', action='store_true', dest='test_image') |
128 parser.add_option('-u', '--urlbase', dest='urlbase', | 130 parser.add_option('-u', '--urlbase', dest='urlbase', |
(...skipping 25 matching lines...) Expand all Loading... |
154 root_dir=root_dir, | 156 root_dir=root_dir, |
155 static_dir=static_dir, | 157 static_dir=static_dir, |
156 serve_only=serve_only, | 158 serve_only=serve_only, |
157 urlbase=options.urlbase, | 159 urlbase=options.urlbase, |
158 test_image=options.test_image, | 160 test_image=options.test_image, |
159 factory_config_path=options.factory_config, | 161 factory_config_path=options.factory_config, |
160 client_prefix=options.client_prefix, | 162 client_prefix=options.client_prefix, |
161 forced_image=options.image, | 163 forced_image=options.image, |
162 use_cached=options.use_cached, | 164 use_cached=options.use_cached, |
163 port=options.port, | 165 port=options.port, |
164 src_image=options.src_image) | 166 src_image=options.src_image, |
| 167 vm = options.vm) |
165 | 168 |
166 # Sanity-check for use of validate_factory_config. | 169 # Sanity-check for use of validate_factory_config. |
167 if not options.factory_config and options.validate_factory_config: | 170 if not options.factory_config and options.validate_factory_config: |
168 parser.error('You need a factory_config to validate.') | 171 parser.error('You need a factory_config to validate.') |
169 | 172 |
170 if options.factory_config: | 173 if options.factory_config: |
171 updater.ImportFactoryConfigFile(options.factory_config, | 174 updater.ImportFactoryConfigFile(options.factory_config, |
172 options.validate_factory_config) | 175 options.validate_factory_config) |
173 # We don't run the dev server with this option. | 176 # We don't run the dev server with this option. |
174 if options.validate_factory_config: | 177 if options.validate_factory_config: |
175 sys.exit(0) | 178 sys.exit(0) |
176 elif options.pregenerate_update: | 179 elif options.pregenerate_update: |
177 updater.PreGenerateUpdate() | 180 updater.PreGenerateUpdate() |
178 | 181 |
179 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) | 182 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) |
OLD | NEW |