Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Side by Side Diff: src/platform/dev/autoupdate.py

Issue 1604014: Fix devserver to unpack rootfs and serve it. (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 web 10 import web
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 client_tokens = client_version.split('.') 66 client_tokens = client_version.split('.')
67 latest_tokens = latest_version.split('.') 67 latest_tokens = latest_version.split('.')
68 web.debug('client version %s latest version %s' \ 68 web.debug('client version %s latest version %s' \
69 % (client_version, latest_version)) 69 % (client_version, latest_version))
70 for i in range(0,4): 70 for i in range(0,4):
71 if int(latest_tokens[i]) == int(client_tokens[i]): 71 if int(latest_tokens[i]) == int(client_tokens[i]):
72 continue 72 continue
73 return int(latest_tokens[i]) > int(client_tokens[i]) 73 return int(latest_tokens[i]) > int(client_tokens[i])
74 return False 74 return False
75 75
76 def UnpackRootfs(self, image_path, rootfs_file):
77 if os.path.exists(rootfs_file):
78 return True
79 if self.test_image:
80 image_file = 'chromiumos_test_image.bin'
81 else:
82 image_file = 'chromiumos_image.bin'
83 os.system('rm -f %s/part_*' % image_path)
84 os.system('cd %s && ./unpack_partitions.sh %s' % (image_path, image_file))
85 shutil.move(os.path.join(image_path, 'part_3'), rootfs_file)
86 os.system('rm -f %s/part_*' % image_path)
87 return True
88
76 def BuildUpdateImage(self, image_path): 89 def BuildUpdateImage(self, image_path):
77 if self.test_image: 90 if self.test_image:
78 image_file = '%s/rootfs_test.image' % image_path 91 image_file = '%s/rootfs_test.image' % image_path
79 else: 92 else:
80 image_file = '%s/rootfs.image' % image_path 93 image_file = '%s/rootfs.image' % image_path
94
95 if not self.UnpackRootfs(image_path, image_file):
96 web.debug('failed to unpack rootfs.')
97 return False
98
81 update_file = '%s/update.gz' % image_path 99 update_file = '%s/update.gz' % image_path
82 if (os.path.exists(update_file) and 100 if (os.path.exists(update_file) and
83 os.path.getmtime(update_file) >= os.path.getmtime(image_file)): 101 os.path.getmtime(update_file) >= os.path.getmtime(image_file)):
84 web.debug('Found cached update image %s/update.gz' % image_path) 102 web.debug('Found cached update image %s/update.gz' % image_path)
85 else: 103 else:
86 web.debug('generating update image %s/update.gz' % image_path) 104 web.debug('generating update image %s/update.gz' % image_path)
87 mkupdate = '%s/mk_memento_images.sh %s' % (self.scripts_dir, image_file) 105 mkupdate = '%s/mk_memento_images.sh %s' % (self.scripts_dir, image_file)
88 web.debug(mkupdate) 106 web.debug(mkupdate)
89 err = os.system(mkupdate) 107 err = os.system(mkupdate)
90 if err != 0: 108 if err != 0:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ok = self.BuildUpdateImage(latest_image_path) 165 ok = self.BuildUpdateImage(latest_image_path)
148 if ok != True: 166 if ok != True:
149 web.debug('Failed to build an update image') 167 web.debug('Failed to build an update image')
150 return self.GetNoUpdatePayload() 168 return self.GetNoUpdatePayload()
151 169
152 hash = self.GetHash('%s/update.gz' % self.static_dir) 170 hash = self.GetHash('%s/update.gz' % self.static_dir)
153 size = self.GetSize('%s/update.gz' % self.static_dir) 171 size = self.GetSize('%s/update.gz' % self.static_dir)
154 172
155 url = 'http://%s/static/update.gz' % hostname 173 url = 'http://%s/static/update.gz' % hostname
156 return self.GetUpdatePayload(hash, size, url) 174 return self.GetUpdatePayload(hash, size, url)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698