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

Side by Side Diff: client/common_lib/cros/autoupdater.py

Issue 6312162: Support dev builds. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 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 | Annotate | Revision Log
« 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) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 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 import httplib 5 import httplib
6 import logging 6 import logging
7 import re 7 import re
8 import socket 8 import socket
9 import urlparse 9 import urlparse
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 # the update as failed, and keep the same rootfs after 127 # the update as failed, and keep the same rootfs after
128 # reboot. 128 # reboot.
129 self.revert_boot_partition() 129 self.revert_boot_partition()
130 raise ChromiumOSError('stateful_update failed on %s.' % 130 raise ChromiumOSError('stateful_update failed on %s.' %
131 self.host.hostname) 131 self.host.hostname)
132 return True 132 return True
133 133
134 134
135 def check_version(self): 135 def check_version(self):
136 booted_version = self.get_build_id() 136 booted_version = self.get_build_id()
137 if not booted_version:
138 booted_version = self.get_dev_build_id()
137 if not booted_version in self.update_version: 139 if not booted_version in self.update_version:
138 logging.error('Expected Chromium OS version: %s.' 140 logging.error('Expected Chromium OS version: %s.'
139 'Found Chromium OS %s', 141 'Found Chromium OS %s',
140 self.update_version, booted_version) 142 self.update_version, booted_version)
141 raise ChromiumOSError('Updater failed on host %s' % 143 raise ChromiumOSError('Updater failed on host %s' %
142 self.host.hostname) 144 self.host.hostname)
143 else: 145 else:
144 return True 146 return True
145 147
146 148
147 def get_build_id(self): 149 def get_build_id(self):
148 """Turns the CHROMEOS_RELEASE_DESCRIPTION into a string that 150 """Turns the CHROMEOS_RELEASE_DESCRIPTION into a string that
149 matches the build ID.""" 151 matches the build ID."""
150 # TODO(seano): handle dev build naming schemes.
151 version = self._run('grep CHROMEOS_RELEASE_DESCRIPTION' 152 version = self._run('grep CHROMEOS_RELEASE_DESCRIPTION'
152 ' /etc/lsb-release').stdout 153 ' /etc/lsb-release').stdout
153 build_re = (r'CHROMEOS_RELEASE_DESCRIPTION=' 154 build_re = (r'CHROMEOS_RELEASE_DESCRIPTION='
154 '(\d+\.\d+\.\d+\.\d+) \(\w+ \w+ (\w+)(.*)\)') 155 '(\d+\.\d+\.\d+\.\d+) \(\w+ \w+ (\w+)(.*)\)')
155 version_match = re.match(build_re, version) 156 version_match = re.match(build_re, version)
156 if not version_match: 157 if version_match:
157 raise ChromiumOSError('Unable to get build ID from %s. Found "%s"', 158 version, build_id, builder = version_match.groups()
158 self.host.hostname, version) 159 build_match = re.match(r'.*: (\d+)', builder)
159 version, build_id, builder = version_match.groups() 160 if build_match:
160 build_match = re.match(r'.*: (\d+)', builder) 161 builder_num = '-b%s' % build_match.group(1)
161 if build_match: 162 else:
162 builder_num = '-b%s' % build_match.group(1) 163 builder_num = ''
163 else: 164 return '%s-r%s%s' % (version, build_id, builder_num)
164 builder_num = '' 165
165 return '%s-r%s%s' % (version, build_id, builder_num) 166
167 def get_dev_build_id(self):
168 """Pulls the CHROMEOS_RELEASE_VERSION string from /etc/lsb-release."""
169 return self._run('grep CHROMEOS_RELEASE_VERSION'
170 ' /etc/lsb-release').stdout.split('=')[1].strip()
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