Chromium Code Reviews| 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 shutil | 9 import shutil |
| 10 import sys | 10 import sys |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 if board_id not in stanza['qual_ids']: | 243 if board_id not in stanza['qual_ids']: |
| 244 continue | 244 continue |
| 245 return (stanza[kind + '_image'], | 245 return (stanza[kind + '_image'], |
| 246 stanza[kind + '_checksum'], | 246 stanza[kind + '_checksum'], |
| 247 stanza[kind + '_size']) | 247 stanza[kind + '_size']) |
| 248 | 248 |
| 249 def HandleUpdatePing(self, data, label=None): | 249 def HandleUpdatePing(self, data, label=None): |
| 250 web.debug('handle update ping') | 250 web.debug('handle update ping') |
| 251 update_dom = minidom.parseString(data) | 251 update_dom = minidom.parseString(data) |
| 252 root = update_dom.firstChild | 252 root = update_dom.firstChild |
| 253 if root.getAttribute('updaterversion') and \ | |
|
seano
2010/05/07 23:23:17
nit: if root.hasAttribute('updaterversion')
| |
| 254 not root.getAttribute('updaterversion').startswith( | |
| 255 'MementoSoftwareUpdate'): | |
| 256 web.debug('Got update from unsupported updater:' + \ | |
| 257 root.getAttribute('updaterversion')) | |
| 258 return self.GetNoUpdatePayload() | |
| 253 query = root.getElementsByTagName('o:app')[0] | 259 query = root.getElementsByTagName('o:app')[0] |
| 254 client_version = query.getAttribute('version') | 260 client_version = query.getAttribute('version') |
| 255 channel = query.getAttribute('track') | 261 channel = query.getAttribute('track') |
| 256 board_id = query.hasAttribute('board') and query.getAttribute('board') \ | 262 board_id = query.hasAttribute('board') and query.getAttribute('board') \ |
| 257 or 'x86-generic' | 263 or 'x86-generic' |
| 258 latest_image_path = self.GetLatestImagePath(board_id) | 264 latest_image_path = self.GetLatestImagePath(board_id) |
| 259 latest_version = self.GetLatestVersion(latest_image_path) | 265 latest_version = self.GetLatestVersion(latest_image_path) |
| 260 hostname = web.ctx.host | 266 hostname = web.ctx.host |
| 261 | 267 |
| 262 # If this is a factory floor server, return the image here: | 268 # If this is a factory floor server, return the image here: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 ok = self.BuildUpdateImage(latest_image_path) | 311 ok = self.BuildUpdateImage(latest_image_path) |
| 306 if ok != True: | 312 if ok != True: |
| 307 web.debug('Failed to build an update image') | 313 web.debug('Failed to build an update image') |
| 308 return self.GetNoUpdatePayload() | 314 return self.GetNoUpdatePayload() |
| 309 | 315 |
| 310 hash = self.GetHash('%s/update.gz' % self.static_dir) | 316 hash = self.GetHash('%s/update.gz' % self.static_dir) |
| 311 size = self.GetSize('%s/update.gz' % self.static_dir) | 317 size = self.GetSize('%s/update.gz' % self.static_dir) |
| 312 | 318 |
| 313 url = 'http://%s/static/update.gz' % hostname | 319 url = 'http://%s/static/update.gz' % hostname |
| 314 return self.GetUpdatePayload(hash, size, url) | 320 return self.GetUpdatePayload(hash, size, url) |
| OLD | NEW |