Index: src/platform/dev/devserver.py |
diff --git a/src/platform/dev/devserver.py b/src/platform/dev/devserver.py |
index 58bb6289cfe394986b0cd2896230f68ddfbebffe..20aac0676fb5325a245ede52d856af519a467410 100644 |
--- a/src/platform/dev/devserver.py |
+++ b/src/platform/dev/devserver.py |
@@ -7,8 +7,8 @@ import buildutil |
import optparse |
import os |
import SimpleHTTPServer |
-import web |
import sys |
+import web |
global updater |
updater = None |
@@ -47,19 +47,30 @@ if __name__ == '__main__': |
parser = optparse.OptionParser(usage) |
parser.add_option('-a', '--archive_dir', dest='archive_dir', |
help='serve archived builds only.') |
+ parser.add_option('--factory_config', dest='factory_config', |
+ help='Config file for serving images from factory floor.') |
parser.add_option('-t', action='store_true', dest='test_image') |
parser.add_option('-u', '--urlbase', dest='urlbase', |
help='base URL, other than devserver, for update images.') |
+ parser.add_option('--validate_factory_config', action="store_true", |
+ dest='validate_factory_config', |
+ help='Validate factory config file, then exit.') |
options, args = parser.parse_args() |
# clean up the args, due to httpserver's hardcoded use of sys.argv |
if options.archive_dir: |
sys.argv.remove('-a') |
+ sys.argv.remove('--archive_dir') |
sys.argv.remove(options.archive_dir) |
+ if options.factory_config: |
+ sys.argv.remove('--factory_config') |
+ sys.argv.remove(options.factory_config) |
if options.test_image: |
sys.argv.remove('-t') |
if options.urlbase: |
sys.argv.remove('-u') |
sys.argv.remove(options.urlbase) |
+ if options.validate_factory_config: |
+ sys.argv.remove('--validate_factory_config') |
root_dir = os.path.realpath('%s/../..' % |
os.path.dirname(os.path.abspath(sys.argv[0]))) |
@@ -74,11 +85,16 @@ if __name__ == '__main__': |
os.system('mkdir -p %s' % static_dir) |
web.debug('Serving images from %s' % static_dir) |
- updater = autoupdate.Autoupdate(root_dir=root_dir, |
- static_dir=static_dir, |
- serve_only=options.archive_dir, |
- urlbase=options.urlbase, |
- test_image=options.test_image) |
+ updater = autoupdate.Autoupdate( |
+ root_dir=root_dir, |
+ static_dir=static_dir, |
+ serve_only=options.archive_dir, |
+ urlbase=options.urlbase, |
+ test_image=options.test_image, |
+ factory_config_path=options.factory_config, |
+ validate_factory_config=options.validate_factory_config) |
+ if options.validate_factory_config: |
+ sys.exit(0) |
urls = ('/', 'index', |
'/update', 'update', |
'/update/(.+)', 'update', |