Improve update version checks to be more robust.
As an added bonus we can now support the new version scheme.
BUG=chromium-os:15706
TEST=Ran run_remote_tests --update_url.
Change-Id: Id644efdab571e01b69ffdb59486e775765518024
Reviewed-on: http://gerrit.chromium.org/gerrit/1483
Reviewed-by: Eric Li <ericli@chromium.org>
Tested-by: Dale Curtis <dalecurtis@chromium.org>
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index 9e4b32d..f2abd31 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -162,7 +162,7 @@
def run_update(self, force_update):
- booted_version = self.get_booted_version()
+ booted_version = self.get_build_id()
if booted_version in self.update_version and not force_update:
logging.info('System is already up to date. Skipping update.')
return False
@@ -193,15 +193,8 @@
return True
- def get_booted_version(self):
- booted_version = self.get_build_id()
- if not booted_version:
- booted_version = self.get_dev_build_id()
- return booted_version
-
-
def check_version(self):
- booted_version = self.get_booted_version()
+ booted_version = self.get_build_id()
if not booted_version in self.update_version:
logging.error('Expected Chromium OS version: %s.'
'Found Chromium OS %s',
@@ -213,24 +206,6 @@
def get_build_id(self):
- """Turns the CHROMEOS_RELEASE_DESCRIPTION into a string that
- matches the build ID."""
- 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 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()