| OLD | NEW |
| 1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009-2010 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 cherrypy | 8 import cherrypy |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 Args: | 237 Args: |
| 238 image_path: Full path to image. | 238 image_path: Full path to image. |
| 239 Returns: | 239 Returns: |
| 240 Path to created update_payload or None on error. | 240 Path to created update_payload or None on error. |
| 241 """ | 241 """ |
| 242 update_path = os.path.join(output_dir, UPDATE_FILE) | 242 update_path = os.path.join(output_dir, UPDATE_FILE) |
| 243 _LogMessage('Generating update image %s' % update_path) | 243 _LogMessage('Generating update image %s' % update_path) |
| 244 | 244 |
| 245 update_command = [ | 245 update_command = [ |
| 246 '%s/cros_generate_update_payload' % self.scripts_dir, | 246 '%s/cros_generate_update_payload' % self.devserver_dir, |
| 247 '--image="%s"' % image_path, | 247 '--image="%s"' % image_path, |
| 248 '--output="%s"' % update_path, | 248 '--output="%s"' % update_path, |
| 249 '--noold_style', | 249 '--noold_style', |
| 250 ] | 250 ] |
| 251 | 251 |
| 252 if src_image: update_command.append('--src_image="%s"' % src_image) | 252 if src_image: update_command.append('--src_image="%s"' % src_image) |
| 253 if not self.vm: update_command.append('--patch_kernel') | 253 if not self.vm: update_command.append('--patch_kernel') |
| 254 if self.private_key: update_command.append('--private_key="%s"' % | 254 if self.private_key: update_command.append('--private_key="%s"' % |
| 255 self.private_key) | 255 self.private_key) |
| 256 | 256 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 268 Args: | 268 Args: |
| 269 image_path: Full path to image. | 269 image_path: Full path to image. |
| 270 Returns: | 270 Returns: |
| 271 Path to created stateful update_payload or None on error. | 271 Path to created stateful update_payload or None on error. |
| 272 Raises: | 272 Raises: |
| 273 A subprocess exception if the update generator fails to generate a | 273 A subprocess exception if the update generator fails to generate a |
| 274 stateful payload. | 274 stateful payload. |
| 275 """ | 275 """ |
| 276 output_gz = os.path.join(output_dir, STATEFUL_FILE) | 276 output_gz = os.path.join(output_dir, STATEFUL_FILE) |
| 277 subprocess.check_call( | 277 subprocess.check_call( |
| 278 ['%s/cros_generate_stateful_update_payload' % self.scripts_dir, | 278 ['%s/cros_generate_stateful_update_payload' % self.devserver_dir, |
| 279 '--image=%s' % image_path, | 279 '--image=%s' % image_path, |
| 280 '--output_dir=%s' % output_dir, | 280 '--output_dir=%s' % output_dir, |
| 281 ]) | 281 ]) |
| 282 return STATEFUL_FILE | 282 return STATEFUL_FILE |
| 283 | 283 |
| 284 def FindCachedUpdateImageSubDir(self, src_image, dest_image): | 284 def FindCachedUpdateImageSubDir(self, src_image, dest_image): |
| 285 """Find directory to store a cached update. | 285 """Find directory to store a cached update. |
| 286 | 286 |
| 287 Given one, or two images for an update, this finds which | 287 Given one, or two images for an update, this finds which |
| 288 cache directory should hold the update files, even if they don't exist | 288 cache directory should hold the update files, even if they don't exist |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 is_delta_format = self._IsDeltaFormatFile(filename) | 661 is_delta_format = self._IsDeltaFormatFile(filename) |
| 662 if label: | 662 if label: |
| 663 url = '%s/%s/%s' % (static_urlbase, label, payload_path) | 663 url = '%s/%s/%s' % (static_urlbase, label, payload_path) |
| 664 else: | 664 else: |
| 665 url = '%s/%s' % (static_urlbase, payload_path) | 665 url = '%s/%s' % (static_urlbase, payload_path) |
| 666 | 666 |
| 667 _LogMessage('Responding to client to use url %s to get image.' % url) | 667 _LogMessage('Responding to client to use url %s to get image.' % url) |
| 668 return self.GetUpdatePayload(hash, sha256, size, url, is_delta_format) | 668 return self.GetUpdatePayload(hash, sha256, size, url, is_delta_format) |
| 669 else: | 669 else: |
| 670 return self.GetNoUpdatePayload() | 670 return self.GetNoUpdatePayload() |
| OLD | NEW |