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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 IsDelta="%s" | 201 IsDelta="%s" |
202 status="ok"/> | 202 status="ok"/> |
203 </app> | 203 </app> |
204 </gupdate> | 204 </gupdate> |
205 """ | 205 """ |
206 return payload % (self._GetSecondsSinceMidnight(), | 206 return payload % (self._GetSecondsSinceMidnight(), |
207 self.app_id, url, hash, sha256, size, delta) | 207 self.app_id, url, hash, sha256, size, delta) |
208 | 208 |
209 def GetNoUpdatePayload(self): | 209 def GetNoUpdatePayload(self): |
210 """Returns a payload to the client corresponding to no update.""" | 210 """Returns a payload to the client corresponding to no update.""" |
211 payload = """ < ?xml version = "1.0" encoding = "UTF-8"? > | 211 payload = """<?xml version="1.0" encoding="UTF-8"?> |
212 < gupdate xmlns = "http://www.google.com/update2/response" protocol = "2.0
" > | 212 <gupdate xmlns="http://www.google.com/update2/response" protocol="2.0"> |
213 < daystart elapsed_seconds = "%s" /> | 213 <daystart elapsed_seconds="%s"/> |
214 < app appid = "{%s}" status = "ok" > | 214 <app appid="{%s}" status="ok"> |
215 < ping status = "ok" /> | 215 <ping status="ok"/> |
216 < updatecheck status = "noupdate" /> | 216 <updatecheck status="noupdate"/> |
217 </ app > | 217 </app> |
218 </ gupdate > | 218 </gupdate> |
219 """ | 219 """ |
220 return payload % (self._GetSecondsSinceMidnight(), self.app_id) | 220 return payload % (self._GetSecondsSinceMidnight(), self.app_id) |
221 | 221 |
222 def GenerateUpdateFile(self, src_image, image_path, output_dir): | 222 def GenerateUpdateFile(self, src_image, image_path, output_dir): |
223 """Generates an update gz given a full path to an image. | 223 """Generates an update gz given a full path to an image. |
224 | 224 |
225 Args: | 225 Args: |
226 image_path: Full path to image. | 226 image_path: Full path to image. |
227 Returns: | 227 Returns: |
228 Path to created update_payload or None on error. | 228 Path to created update_payload or None on error. |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 is_delta_format = self._IsDeltaFormatFile(filename) | 646 is_delta_format = self._IsDeltaFormatFile(filename) |
647 if label: | 647 if label: |
648 url = '%s/%s/%s' % (static_urlbase, label, payload_path) | 648 url = '%s/%s/%s' % (static_urlbase, label, payload_path) |
649 else: | 649 else: |
650 url = '%s/%s' % (static_urlbase, payload_path) | 650 url = '%s/%s' % (static_urlbase, payload_path) |
651 | 651 |
652 _LogMessage('Responding to client to use url %s to get image.' % url) | 652 _LogMessage('Responding to client to use url %s to get image.' % url) |
653 return self.GetUpdatePayload(hash, sha256, size, url, is_delta_format) | 653 return self.GetUpdatePayload(hash, sha256, size, url, is_delta_format) |
654 else: | 654 else: |
655 return self.GetNoUpdatePayload() | 655 return self.GetNoUpdatePayload() |
OLD | NEW |