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

Unified Diff: bin/cros_image_to_target.py

Issue 3572006: Add sha256 to devserver clone updater output (Closed) Base URL: ssh://gitrw.chromium.org/crosutils.git
Patch Set: Created 10 years, 3 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 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 9a4fd8ce49b1eb4ca3c8ef293afcb05c87c1a6dc..dc6a0f1be5619fbeb7db3e0869c789df269c32e5 100755
--- a/bin/cros_image_to_target.py
+++ b/bin/cros_image_to_target.py
@@ -219,6 +219,12 @@ class CrosEnv(object):
infile=filename,
capture=True, oneline=True)
+ def GetSha256(self, filename):
+ return self.cmd.RunPipe([['openssl', 'dgst', '-sha256', '-binary'],
+ ['openssl', 'base64']],
+ infile=filename,
+ capture=True, oneline=True)
+
def GetDefaultBoard(self):
def_board_file = self.CrosUtilsPath('.default_board')
if not os.path.exists(def_board_file):
@@ -250,6 +256,7 @@ class CrosEnv(object):
"""Start the devserver clone."""
PingUpdateResponse.Setup(self.GetHash(update_file),
+ self.GetSha256(update_file),
self.GetSize(update_file))
UpdateHandler.SetupUrl('/update', PingUpdateResponse())
@@ -423,6 +430,7 @@ class PingUpdateResponse(StringUpdateResponse):
<updatecheck
codebase="%s"
hash="%s"
+ sha256="%s"
needsadmin="false"
size="%s"
status="ok"/>
@@ -443,8 +451,9 @@ class PingUpdateResponse(StringUpdateResponse):
self.content_type = 'text/xml'
@staticmethod
- def Setup(filehash, filesize):
+ def Setup(filehash, filesha256, filesize):
PingUpdateResponse.file_hash = filehash
+ PingUpdateResponse.file_sha256 = filesha256
PingUpdateResponse.file_size = filesize
def Reply(self, handler, send_content=True, post_data=None):
@@ -462,7 +471,7 @@ class PingUpdateResponse(StringUpdateResponse):
self.string = (self.payload_success_template %
(self.xmlns, self.SecondsSinceMidnight(),
self.app_id, 'http://%s/%s' % (host, UPDATE_FILENAME),
- self.file_hash, self.file_size))
+ self.file_hash, self.file_sha256, self.file_size))
else:
self.string = (self.payload_failure_template %
(self.xmlns, self.SecondsSinceMidnight(), self.app_id))
« 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