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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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('--port', default=8080, | 121 parser.add_option('--port', default=8080, |
122 help='Port for the dev server to use.') | 122 help='Port for the dev server to use.') |
| 123 parser.add_option('--src_image', default='', |
| 124 help='Image on remote machine for generating delta update.') |
123 parser.add_option('-t', action='store_true', dest='test_image') | 125 parser.add_option('-t', action='store_true', dest='test_image') |
124 parser.add_option('-u', '--urlbase', dest='urlbase', | 126 parser.add_option('-u', '--urlbase', dest='urlbase', |
125 help='base URL, other than devserver, for update images.') | 127 help='base URL, other than devserver, for update images.') |
126 parser.add_option('--use_cached', action="store_true", default=False, | 128 parser.add_option('--use_cached', action="store_true", default=False, |
127 help='Prefer cached image regardless of timestamps.') | 129 help='Prefer cached image regardless of timestamps.') |
128 parser.add_option('--validate_factory_config', action="store_true", | 130 parser.add_option('--validate_factory_config', action="store_true", |
129 dest='validate_factory_config', | 131 dest='validate_factory_config', |
130 help='Validate factory config file, then exit.') | 132 help='Validate factory config file, then exit.') |
131 parser.set_usage(parser.format_help()) | 133 parser.set_usage(parser.format_help()) |
132 (options, _) = parser.parse_args() | 134 (options, _) = parser.parse_args() |
(...skipping 16 matching lines...) Expand all Loading... |
149 updater = autoupdate.Autoupdate( | 151 updater = autoupdate.Autoupdate( |
150 root_dir=root_dir, | 152 root_dir=root_dir, |
151 static_dir=static_dir, | 153 static_dir=static_dir, |
152 serve_only=serve_only, | 154 serve_only=serve_only, |
153 urlbase=options.urlbase, | 155 urlbase=options.urlbase, |
154 test_image=options.test_image, | 156 test_image=options.test_image, |
155 factory_config_path=options.factory_config, | 157 factory_config_path=options.factory_config, |
156 client_prefix=options.client_prefix, | 158 client_prefix=options.client_prefix, |
157 forced_image=options.image, | 159 forced_image=options.image, |
158 use_cached=options.use_cached, | 160 use_cached=options.use_cached, |
159 port=options.port) | 161 port=options.port, |
| 162 src_image=options.src_image) |
160 | 163 |
161 # Sanity-check for use of validate_factory_config. | 164 # Sanity-check for use of validate_factory_config. |
162 if not options.factory_config and options.validate_factory_config: | 165 if not options.factory_config and options.validate_factory_config: |
163 parser.error('You need a factory_config to validate.') | 166 parser.error('You need a factory_config to validate.') |
164 | 167 |
165 if options.factory_config: | 168 if options.factory_config: |
166 updater.ImportFactoryConfigFile(options.factory_config, | 169 updater.ImportFactoryConfigFile(options.factory_config, |
167 options.validate_factory_config) | 170 options.validate_factory_config) |
168 # We don't run the dev server with this option. | 171 # We don't run the dev server with this option. |
169 if options.validate_factory_config: | 172 if options.validate_factory_config: |
170 sys.exit(0) | 173 sys.exit(0) |
171 | 174 |
172 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) | 175 cherrypy.quickstart(DevServerRoot(), config=_GetConfig(options)) |
OLD | NEW |