| 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 from buildutil import BuildObject | 5 from buildutil import BuildObject |
| 6 from xml.dom import minidom | 6 from xml.dom import minidom |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import web | 9 import web |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 web.debug(cmd) | 88 web.debug(cmd) |
| 89 return os.popen(cmd).read() | 89 return os.popen(cmd).read() |
| 90 | 90 |
| 91 def HandleUpdatePing(self, data): | 91 def HandleUpdatePing(self, data): |
| 92 update_dom = minidom.parseString(data) | 92 update_dom = minidom.parseString(data) |
| 93 root = update_dom.firstChild | 93 root = update_dom.firstChild |
| 94 query = root.getElementsByTagName("o:app")[0] | 94 query = root.getElementsByTagName("o:app")[0] |
| 95 client_version = query.attributes['version'].value | 95 client_version = query.attributes['version'].value |
| 96 latest_image_path = self.GetLatestImagePath(); | 96 latest_image_path = self.GetLatestImagePath(); |
| 97 latest_version = self.GetLatestVersion(latest_image_path); | 97 latest_version = self.GetLatestVersion(latest_image_path); |
| 98 if not self.CanUpdate(client_version, latest_version): | 98 if client_version != "ForcedUpdate" and not self.CanUpdate(client_version, l
atest_version): |
| 99 web.debug("no update") | 99 web.debug("no update") |
| 100 return self.GetNoUpdatePayload() | 100 return self.GetNoUpdatePayload() |
| 101 | 101 |
| 102 web.debug("update found %s " % latest_version) | 102 web.debug("update found %s " % latest_version) |
| 103 ok = self.BuildUpdateImage(latest_image_path) | 103 ok = self.BuildUpdateImage(latest_image_path) |
| 104 if ok != True: | 104 if ok != True: |
| 105 web.debug("Failed to build an update image") | 105 web.debug("Failed to build an update image") |
| 106 return self.GetNoUpdatePayload() | 106 return self.GetNoUpdatePayload() |
| 107 | 107 |
| 108 hash = self.GetHash("%s/update.gz" % self.static_dir) | 108 hash = self.GetHash("%s/update.gz" % self.static_dir) |
| 109 size = self.GetSize("%s/update.gz" % self.static_dir) | 109 size = self.GetSize("%s/update.gz" % self.static_dir) |
| 110 hostname = web.ctx.host | 110 hostname = web.ctx.host |
| 111 url = "http://%s/static/update.gz" % hostname | 111 url = "http://%s/static/update.gz" % hostname |
| 112 return self.GetUpdatePayload(hash, size, url) | 112 return self.GetUpdatePayload(hash, size, url) |
| 113 | 113 |
| OLD | NEW |