Index: client/common_lib/cros/autoupdater.py |
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py |
index 3ed610509e80eee0dba9dca2f5f03ebc0d517826..244cbbdd117d6f9ec88c76f4f07641c2a52be77c 100644 |
--- a/client/common_lib/cros/autoupdater.py |
+++ b/client/common_lib/cros/autoupdater.py |
@@ -134,6 +134,8 @@ class ChromiumOSUpdater(): |
def check_version(self): |
booted_version = self.get_build_id() |
+ if not booted_version: |
+ booted_version = self.get_dev_build_id() |
if not booted_version in self.update_version: |
logging.error('Expected Chromium OS version: %s.' |
'Found Chromium OS %s', |
@@ -147,19 +149,22 @@ class ChromiumOSUpdater(): |
def get_build_id(self): |
"""Turns the CHROMEOS_RELEASE_DESCRIPTION into a string that |
matches the build ID.""" |
- # TODO(seano): handle dev build naming schemes. |
version = self._run('grep CHROMEOS_RELEASE_DESCRIPTION' |
' /etc/lsb-release').stdout |
build_re = (r'CHROMEOS_RELEASE_DESCRIPTION=' |
'(\d+\.\d+\.\d+\.\d+) \(\w+ \w+ (\w+)(.*)\)') |
version_match = re.match(build_re, version) |
- if not version_match: |
- raise ChromiumOSError('Unable to get build ID from %s. Found "%s"', |
- self.host.hostname, version) |
- version, build_id, builder = version_match.groups() |
- build_match = re.match(r'.*: (\d+)', builder) |
- if build_match: |
- builder_num = '-b%s' % build_match.group(1) |
- else: |
- builder_num = '' |
- return '%s-r%s%s' % (version, build_id, builder_num) |
+ if version_match: |
+ version, build_id, builder = version_match.groups() |
+ build_match = re.match(r'.*: (\d+)', builder) |
+ if build_match: |
+ builder_num = '-b%s' % build_match.group(1) |
+ else: |
+ builder_num = '' |
+ return '%s-r%s%s' % (version, build_id, builder_num) |
+ |
+ |
+ def get_dev_build_id(self): |
+ """Pulls the CHROMEOS_RELEASE_VERSION string from /etc/lsb-release.""" |
+ return self._run('grep CHROMEOS_RELEASE_VERSION' |
+ ' /etc/lsb-release').stdout.split('=')[1].strip() |