| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if validate_checksums: | 255 if validate_checksums: |
| 256 if success is False: | 256 if success is False: |
| 257 raise Exception('Checksum mismatch in conf file.') | 257 raise Exception('Checksum mismatch in conf file.') |
| 258 print 'Config file looks good.' | 258 print 'Config file looks good.' |
| 259 | 259 |
| 260 def GetFactoryImage(self, board_id, channel): | 260 def GetFactoryImage(self, board_id, channel): |
| 261 kind = channel.rsplit('-', 1)[0] | 261 kind = channel.rsplit('-', 1)[0] |
| 262 for stanza in self.factory_config: | 262 for stanza in self.factory_config: |
| 263 if board_id not in stanza['qual_ids']: | 263 if board_id not in stanza['qual_ids']: |
| 264 continue | 264 continue |
| 265 if kind + '_image' not in stanza: |
| 266 break |
| 265 return (stanza[kind + '_image'], | 267 return (stanza[kind + '_image'], |
| 266 stanza[kind + '_checksum'], | 268 stanza[kind + '_checksum'], |
| 267 stanza[kind + '_size']) | 269 stanza[kind + '_size']) |
| 270 return (None, None, None) |
| 268 | 271 |
| 269 def HandleUpdatePing(self, data, label=None): | 272 def HandleUpdatePing(self, data, label=None): |
| 270 web.debug('handle update ping') | 273 web.debug('handle update ping') |
| 271 update_dom = minidom.parseString(data) | 274 update_dom = minidom.parseString(data) |
| 272 root = update_dom.firstChild | 275 root = update_dom.firstChild |
| 273 if root.hasAttribute('updaterversion') and \ | 276 if root.hasAttribute('updaterversion') and \ |
| 274 not root.getAttribute('updaterversion').startswith( | 277 not root.getAttribute('updaterversion').startswith( |
| 275 'MementoSoftwareUpdate'): | 278 'MementoSoftwareUpdate'): |
| 276 web.debug('Got update from unsupported updater:' + \ | 279 web.debug('Got update from unsupported updater:' + \ |
| 277 root.getAttribute('updaterversion')) | 280 root.getAttribute('updaterversion')) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 ok = self.BuildUpdateImage(latest_image_path) | 334 ok = self.BuildUpdateImage(latest_image_path) |
| 332 if ok != True: | 335 if ok != True: |
| 333 web.debug('Failed to build an update image') | 336 web.debug('Failed to build an update image') |
| 334 return self.GetNoUpdatePayload() | 337 return self.GetNoUpdatePayload() |
| 335 | 338 |
| 336 hash = self.GetHash('%s/update.gz' % self.static_dir) | 339 hash = self.GetHash('%s/update.gz' % self.static_dir) |
| 337 size = self.GetSize('%s/update.gz' % self.static_dir) | 340 size = self.GetSize('%s/update.gz' % self.static_dir) |
| 338 | 341 |
| 339 url = 'http://%s/static/update.gz' % hostname | 342 url = 'http://%s/static/update.gz' % hostname |
| 340 return self.GetUpdatePayload(hash, size, url) | 343 return self.GetUpdatePayload(hash, size, url) |
| OLD | NEW |