| OLD | NEW |
| 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import autoupdate | 5 import autoupdate |
| 6 import buildutil | 6 import buildutil |
| 7 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import web | 10 import web |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 builds the package specified by the pkg parameter and returns the name | 30 builds the package specified by the pkg parameter and returns the name |
| 31 of the output file. | 31 of the output file. |
| 32 """ | 32 """ |
| 33 def POST(self): | 33 def POST(self): |
| 34 input = web.input() | 34 input = web.input() |
| 35 web.debug('emerging %s ' % input.pkg) | 35 web.debug('emerging %s ' % input.pkg) |
| 36 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) | 36 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) |
| 37 err = os.system(emerge_command) | 37 err = os.system(emerge_command) |
| 38 if err != 0: | 38 if err != 0: |
| 39 raise Exception('failed to execute %s' % emerge_command) | 39 raise Exception('failed to execute %s' % emerge_command) |
| 40 eclean_command = 'eclean-%s -d packages' % input.board |
| 41 err = os.system(eclean_command) |
| 42 if err != 0: |
| 43 raise Exception('failed to execute %s' % emerge_command) |
| 40 | 44 |
| 41 def OverrideWSGIServer(server_address, wsgi_app): | 45 def OverrideWSGIServer(server_address, wsgi_app): |
| 42 """Creates a CherryPyWSGIServer instance. | 46 """Creates a CherryPyWSGIServer instance. |
| 43 | 47 |
| 44 Overrides web.py's WSGIServer routine (web.httpserver.WSGIServer) to | 48 Overrides web.py's WSGIServer routine (web.httpserver.WSGIServer) to |
| 45 increase the accepted connection socket timeout from the default 10 | 49 increase the accepted connection socket timeout from the default 10 |
| 46 seconds to 10 minutes. The extra time is necessary to serve delta | 50 seconds to 10 minutes. The extra time is necessary to serve delta |
| 47 updates as well as update requests from a low priority update_engine | 51 updates as well as update requests from a low priority update_engine |
| 48 process running on a heavily loaded Chrome OS device. | 52 process running on a heavily loaded Chrome OS device. |
| 49 """ | 53 """ |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 urls = ('/', 'index', | 118 urls = ('/', 'index', |
| 115 '/update', 'update', | 119 '/update', 'update', |
| 116 '/update/(.+)', 'update', | 120 '/update/(.+)', 'update', |
| 117 '/build', 'build') | 121 '/build', 'build') |
| 118 | 122 |
| 119 # Overrides the default WSGIServer routine -- see OverrideWSGIServer. | 123 # Overrides the default WSGIServer routine -- see OverrideWSGIServer. |
| 120 web.httpserver.WSGIServer = OverrideWSGIServer | 124 web.httpserver.WSGIServer = OverrideWSGIServer |
| 121 app = web.application(urls, globals(), autoreload=True) | 125 app = web.application(urls, globals(), autoreload=True) |
| 122 render = web.template.render('templates/') | 126 render = web.template.render('templates/') |
| 123 app.run() | 127 app.run() |
| OLD | NEW |