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

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

Issue 574020: Adds support for autoupdating portage with portage images (Closed)
Patch Set: Created 10 years, 10 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 web 9 import web
10 10
(...skipping 29 matching lines...) Expand all
40 </gupdate> 40 </gupdate>
41 """ 41 """
42 return payload % self.app_id 42 return payload % self.app_id
43 43
44 def GetLatestImagePath(self): 44 def GetLatestImagePath(self):
45 cmd = "%s/get_latest_image.sh" % self.scripts_dir 45 cmd = "%s/get_latest_image.sh" % self.scripts_dir
46 return os.popen(cmd).read().strip() 46 return os.popen(cmd).read().strip()
47 47
48 def GetLatestVersion(self, latest_image_path): 48 def GetLatestVersion(self, latest_image_path):
49 latest_version = latest_image_path.split('/')[-1] 49 latest_version = latest_image_path.split('/')[-1]
50
51 # Removes the portage build prefix.
52 latest_version = latest_version.lstrip("g-")
50 return latest_version.split('-')[0] 53 return latest_version.split('-')[0]
51 54
52 def CanUpdate(self, client_version, latest_version): 55 def CanUpdate(self, client_version, latest_version):
53 """ 56 """
54 Returns true iff the latest_version is greater than the client_version. 57 Returns true iff the latest_version is greater than the client_version.
55 """ 58 """
56 client_tokens = client_version.split('.') 59 client_tokens = client_version.split('.')
57 latest_tokens = latest_version.split('.') 60 latest_tokens = latest_version.split('.')
58 web.debug("client version %s latest version %s" % (client_version, latest_ve rsion)) 61 web.debug("client version %s latest version %s" % (client_version, latest_ve rsion))
59 for i in range(0,4): 62 for i in range(0,4):
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if ok != True: 107 if ok != True:
105 web.debug("Failed to build an update image") 108 web.debug("Failed to build an update image")
106 return self.GetNoUpdatePayload() 109 return self.GetNoUpdatePayload()
107 110
108 hash = self.GetHash("%s/update.gz" % self.static_dir) 111 hash = self.GetHash("%s/update.gz" % self.static_dir)
109 size = self.GetSize("%s/update.gz" % self.static_dir) 112 size = self.GetSize("%s/update.gz" % self.static_dir)
110 hostname = web.ctx.host 113 hostname = web.ctx.host
111 url = "http://%s/static/update.gz" % hostname 114 url = "http://%s/static/update.gz" % hostname
112 return self.GetUpdatePayload(hash, size, url) 115 return self.GetUpdatePayload(hash, size, url)
113 116
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