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

Unified Diff: bin/cros_image_to_target.py

Issue 5149002: Use new stateful image builder (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_image_to_target.py
diff --git a/bin/cros_image_to_target.py b/bin/cros_image_to_target.py
index dc6a0f1be5619fbeb7db3e0869c789df269c32e5..8455777892f6ae8df104eaf830514f284d367ca6 100755
--- a/bin/cros_image_to_target.py
+++ b/bin/cros_image_to_target.py
@@ -33,7 +33,7 @@ DEFAULT_IMAGE_NAME = 'chromiumos_image.bin'
# The filenames we provide to clients to pull updates
UPDATE_FILENAME = 'update.gz'
-STATEFUL_FILENAME = 'stateful.image.gz'
+STATEFUL_FILENAME = 'stateful.tgz'
# How long do we wait for the server to start before launching client
SERVER_STARTUP_WAIT = 1
@@ -192,23 +192,16 @@ class CrosEnv(object):
return True
- def BuildStateful(self, src, dst):
+ def BuildStateful(self, src, dst_dir, dst_file):
"""Create a stateful partition update image."""
- if self.GetCached(src, dst):
- self.Info('Using cached stateful %s' % dst)
+ if self.GetCached(src, dst_file):
+ self.Info('Using cached stateful %s' % dst_file)
return True
- cgpt = self.ChrootPath('/usr/bin/cgpt')
- offset = self.cmd.OutputOneLine(cgpt, 'show', '-b', '-i', '1', src)
- size = self.cmd.OutputOneLine(cgpt, 'show', '-s', '-i', '1', src)
- if None in (size, offset):
- self.Error('Unable to use cgpt to get image geometry')
- return False
-
- return self.cmd.RunPipe([['dd', 'if=%s' % src, 'bs=512',
- 'skip=%s' % offset, 'count=%s' % size],
- ['gzip', '-c']], outfile=dst)
+ return self.cmd.Run(self.CrosUtilsPath(
+ 'cros_generate_stateful_update_payload'),
+ '--image=%s' % src, '--output=%s' % dst_dir)
def GetSize(self, filename):
return os.path.getsize(filename)
@@ -614,7 +607,7 @@ def main(argv):
stateful_file = os.path.join(image_directory, STATEFUL_FILENAME)
if (not cros_env.GenerateUpdatePayload(image_file, update_file) or
- not cros_env.BuildStateful(image_file, stateful_file)):
+ not cros_env.BuildStateful(image_file, image_directory, stateful_file)):
cros_env.Fatal()
cros_env.CreateServer(options.port, update_file, stateful_file)
« 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