| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return False | 91 return False |
| 92 | 92 |
| 93 def UnpackImage(self, image_path, kernel_file, rootfs_file): | 93 def UnpackImage(self, image_path, kernel_file, rootfs_file): |
| 94 if os.path.exists(rootfs_file) and os.path.exists(kernel_file): | 94 if os.path.exists(rootfs_file) and os.path.exists(kernel_file): |
| 95 return True | 95 return True |
| 96 if self.test_image: | 96 if self.test_image: |
| 97 image_file = 'chromiumos_test_image.bin' | 97 image_file = 'chromiumos_test_image.bin' |
| 98 else: | 98 else: |
| 99 image_file = 'chromiumos_image.bin' | 99 image_file = 'chromiumos_image.bin' |
| 100 if self.serve_only: | 100 if self.serve_only: |
| 101 os.system('cd %s && unzip -o image.zip' % | 101 err = os.system('cd %s && unzip -o image.zip %s unpack_partitions.sh' % |
| 102 (image_path, image_file)) | 102 (image_path, image_file)) |
| 103 if err: |
| 104 web.debug('unzip image.zip failed.') |
| 105 return False |
| 106 |
| 103 os.system('rm -f %s/part_*' % image_path) | 107 os.system('rm -f %s/part_*' % image_path) |
| 104 os.system('cd %s && ./unpack_partitions.sh %s' % (image_path, image_file)) | 108 os.system('cd %s && ./unpack_partitions.sh %s' % (image_path, image_file)) |
| 105 shutil.move(os.path.join(image_path, 'part_2'), kernel_file) | 109 shutil.move(os.path.join(image_path, 'part_2'), kernel_file) |
| 106 shutil.move(os.path.join(image_path, 'part_3'), rootfs_file) | 110 shutil.move(os.path.join(image_path, 'part_3'), rootfs_file) |
| 107 os.system('rm -f %s/part_*' % image_path) | 111 os.system('rm -f %s/part_*' % image_path) |
| 108 return True | 112 return True |
| 109 | 113 |
| 110 def BuildUpdateImage(self, image_path): | 114 def BuildUpdateImage(self, image_path): |
| 111 kernel_file = '%s/kernel.image' % image_path | 115 kernel_file = '%s/kernel.image' % image_path |
| 112 rootfs_file = '%s/rootfs.image' % image_path | 116 rootfs_file = '%s/rootfs.image' % image_path |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 ok = self.BuildUpdateImage(latest_image_path) | 273 ok = self.BuildUpdateImage(latest_image_path) |
| 270 if ok != True: | 274 if ok != True: |
| 271 web.debug('Failed to build an update image') | 275 web.debug('Failed to build an update image') |
| 272 return self.GetNoUpdatePayload() | 276 return self.GetNoUpdatePayload() |
| 273 | 277 |
| 274 hash = self.GetHash('%s/update.gz' % self.static_dir) | 278 hash = self.GetHash('%s/update.gz' % self.static_dir) |
| 275 size = self.GetSize('%s/update.gz' % self.static_dir) | 279 size = self.GetSize('%s/update.gz' % self.static_dir) |
| 276 | 280 |
| 277 url = 'http://%s/static/update.gz' % hostname | 281 url = 'http://%s/static/update.gz' % hostname |
| 278 return self.GetUpdatePayload(hash, size, url) | 282 return self.GetUpdatePayload(hash, size, url) |
| OLD | NEW |