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 | 111 |
112 if __name__ == '__main__': | 112 if __name__ == '__main__': |
113 usage = 'usage: %prog [options]' | 113 usage = 'usage: %prog [options]' |
114 parser = optparse.OptionParser(usage) | 114 parser = optparse.OptionParser(usage) |
115 parser.add_option('--archive_dir', dest='archive_dir', | 115 parser.add_option('--archive_dir', dest='archive_dir', |
116 help='serve archived builds only.') | 116 help='serve archived builds only.') |
117 parser.add_option('--board', dest='board', | 117 parser.add_option('--board', dest='board', |
118 help='When pre-generating update, board for latest image.') | 118 help='When pre-generating update, board for latest image.') |
119 parser.add_option('--clear_cache', action='store_true', default=False, | 119 parser.add_option('--clear_cache', action='store_true', default=False, |
120 help='Clear out all cached udpates and exit') | 120 help='Clear out all cached udpates and exit') |
121 parser.add_option('--client_prefix', dest='client_prefix', | 121 parser.add_option('--client_prefix', dest='client_prefix_deprecated', |
sosa
2011/03/15 20:33:49
Maybe instead of in the help ... print out somethi
Greg Spencer (Chromium)
2011/03/15 21:14:37
OK, added this.
| |
122 help='Required prefix for client software version.', | 122 help='No longer used. It is still here so we don\'t break ' |
123 default='MementoSoftwareUpdate') | 123 'scripts that used it.', default='') |
124 parser.add_option('--data_dir', dest='data_dir', | 124 parser.add_option('--data_dir', dest='data_dir', |
125 help='Writable directory where static lives', | 125 help='Writable directory where static lives', |
126 default=os.path.dirname(os.path.abspath(sys.argv[0]))) | 126 default=os.path.dirname(os.path.abspath(sys.argv[0]))) |
127 parser.add_option('--exit', action='store_true', default=False, | 127 parser.add_option('--exit', action='store_true', default=False, |
128 help='Don\'t start the server (still pregenerate or clear' | 128 help='Don\'t start the server (still pregenerate or clear' |
129 'cache).') | 129 'cache).') |
130 parser.add_option('--factory_config', dest='factory_config', | 130 parser.add_option('--factory_config', dest='factory_config', |
131 help='Config file for serving images from factory floor.') | 131 help='Config file for serving images from factory floor.') |
132 parser.add_option('--for_vm', dest='vm', default=False, action='store_true', | 132 parser.add_option('--for_vm', dest='vm', default=False, action='store_true', |
133 help='Update is for a vm image.') | 133 help='Update is for a vm image.') |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 cherrypy.log('Source root is %s' % root_dir, 'DEVSERVER') | 204 cherrypy.log('Source root is %s' % root_dir, 'DEVSERVER') |
205 cherrypy.log('Serving from %s' % static_dir, 'DEVSERVER') | 205 cherrypy.log('Serving from %s' % static_dir, 'DEVSERVER') |
206 | 206 |
207 updater = autoupdate.Autoupdate( | 207 updater = autoupdate.Autoupdate( |
208 root_dir=root_dir, | 208 root_dir=root_dir, |
209 static_dir=static_dir, | 209 static_dir=static_dir, |
210 serve_only=serve_only, | 210 serve_only=serve_only, |
211 urlbase=options.urlbase, | 211 urlbase=options.urlbase, |
212 test_image=options.test_image, | 212 test_image=options.test_image, |
213 factory_config_path=options.factory_config, | 213 factory_config_path=options.factory_config, |
214 client_prefix=options.client_prefix, | |
215 forced_image=options.image, | 214 forced_image=options.image, |
216 forced_payload=options.payload, | 215 forced_payload=options.payload, |
217 port=options.port, | 216 port=options.port, |
218 proxy_port=options.proxy_port, | 217 proxy_port=options.proxy_port, |
219 src_image=options.src_image, | 218 src_image=options.src_image, |
220 vm=options.vm, | 219 vm=options.vm, |
221 board=options.board, | 220 board=options.board, |
222 copy_to_static_root=not options.exit, | 221 copy_to_static_root=not options.exit, |
223 private_key=options.private_key, | 222 private_key=options.private_key, |
224 ) | 223 ) |
225 | 224 |
226 # Sanity-check for use of validate_factory_config. | 225 # Sanity-check for use of validate_factory_config. |
227 if not options.factory_config and options.validate_factory_config: | 226 if not options.factory_config and options.validate_factory_config: |
228 parser.error('You need a factory_config to validate.') | 227 parser.error('You need a factory_config to validate.') |
229 | 228 |
230 if options.factory_config: | 229 if options.factory_config: |
231 updater.ImportFactoryConfigFile(options.factory_config, | 230 updater.ImportFactoryConfigFile(options.factory_config, |
232 options.validate_factory_config) | 231 options.validate_factory_config) |
233 # We don't run the dev server with this option. | 232 # We don't run the dev server with this option. |
234 if options.validate_factory_config: | 233 if options.validate_factory_config: |
235 sys.exit(0) | 234 sys.exit(0) |
236 elif options.pregenerate_update: | 235 elif options.pregenerate_update: |
237 if not updater.PreGenerateUpdate(): | 236 if not updater.PreGenerateUpdate(): |
238 sys.exit(1) | 237 sys.exit(1) |
239 | 238 |
240 # If the command line requested after setup, it's time to do it. | 239 # If the command line requested after setup, it's time to do it. |
241 if not options.exit: | 240 if not options.exit: |
242 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) | 241 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) |
OLD | NEW |