| OLD | NEW |
| 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 |
| 11 from autotest_lib.client.common_lib import error | 11 from autotest_lib.client.common_lib import error |
| 12 from autotest_lib.client.cros import constants as chromeos_constants | 12 from autotest_lib.client.cros import constants as chromeos_constants |
| 13 | 13 |
| 14 STATEFULDEV_UPDATER = '/usr/local/bin/stateful_update' | 14 # TODO(dalecurtis): HACK to bootstrap stateful updater until crosbug.com/8960 is |
| 15 # fixed. |
| 16 LOCAL_STATEFULDEV_UPDATER = ('/home/chromeos-test/chromeos-src/chromeos/src' |
| 17 '/platform/dev/stateful_update') |
| 18 STATEFULDEV_UPDATER = '/tmp/stateful_update' |
| 15 UPDATER_BIN = '/usr/bin/update_engine_client' | 19 UPDATER_BIN = '/usr/bin/update_engine_client' |
| 16 UPDATER_IDLE = 'UPDATE_STATUS_IDLE' | 20 UPDATER_IDLE = 'UPDATE_STATUS_IDLE' |
| 17 UPDATER_NEED_REBOOT = 'UPDATE_STATUS_UPDATED_NEED_REBOOT' | 21 UPDATER_NEED_REBOOT = 'UPDATE_STATUS_UPDATED_NEED_REBOOT' |
| 18 UPDATED_MARKER = '/var/run/update_engine_autoupdate_completed' | 22 UPDATED_MARKER = '/var/run/update_engine_autoupdate_completed' |
| 19 | 23 |
| 20 | 24 |
| 21 class ChromiumOSError(error.InstallError): | 25 class ChromiumOSError(error.InstallError): |
| 22 """Generic error for ChromiumOS-specific exceptions.""" | 26 """Generic error for ChromiumOS-specific exceptions.""" |
| 23 pass | 27 pass |
| 24 | 28 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if status != UPDATER_NEED_REBOOT: | 114 if status != UPDATER_NEED_REBOOT: |
| 111 raise ChromiumOSError('update-engine error on %s: ' | 115 raise ChromiumOSError('update-engine error on %s: ' |
| 112 '"%s" from update-engine' % | 116 '"%s" from update-engine' % |
| 113 (self.host.hostname, status)) | 117 (self.host.hostname, status)) |
| 114 | 118 |
| 115 # Attempt dev & test tools update (which don't live on the | 119 # Attempt dev & test tools update (which don't live on the |
| 116 # rootfs). This must succeed so that the newly installed host | 120 # rootfs). This must succeed so that the newly installed host |
| 117 # is testable after we run the autoupdater. | 121 # is testable after we run the autoupdater. |
| 118 statefuldev_url = self.update_url.replace('update', 'static/archive') | 122 statefuldev_url = self.update_url.replace('update', 'static/archive') |
| 119 | 123 |
| 120 statefuldev_cmd = ' '.join([STATEFULDEV_UPDATER, statefuldev_url, | 124 # TODO(dalecurtis): HACK to bootstrap stateful updater until |
| 121 '2>&1']) | 125 # crosbug.com/8960 is fixed. |
| 126 self.host.send_file(LOCAL_STATEFULDEV_UPDATER, STATEFULDEV_UPDATER, |
| 127 delete_dest=True) |
| 128 statefuldev_cmd = [STATEFULDEV_UPDATER, statefuldev_url] |
| 129 |
| 130 # TODO(dalecurtis): HACK necessary until R10 builds are out of testing. |
| 131 if int(self.update_version.split('.')[1]) > 10: |
| 132 statefuldev_cmd.append('--stateful_change=clean') |
| 133 |
| 134 statefuldev_cmd.append('2>&1') |
| 135 statefuldev_cmd = ' '.join(statefuldev_cmd) |
| 136 |
| 122 logging.info(statefuldev_cmd) | 137 logging.info(statefuldev_cmd) |
| 123 try: | 138 try: |
| 124 self._run(statefuldev_cmd, timeout=600) | 139 self._run(statefuldev_cmd, timeout=600) |
| 125 except error.AutoservRunError, e: | 140 except error.AutoservRunError, e: |
| 126 # TODO(seano): If statefuldev update failed, we must mark | 141 # TODO(seano): If statefuldev update failed, we must mark |
| 127 # the update as failed, and keep the same rootfs after | 142 # the update as failed, and keep the same rootfs after |
| 128 # reboot. | 143 # reboot. |
| 129 self.revert_boot_partition() | 144 self.revert_boot_partition() |
| 130 raise ChromiumOSError('stateful_update failed on %s.' % | 145 raise ChromiumOSError('stateful_update failed on %s.' % |
| 131 self.host.hostname) | 146 self.host.hostname) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 161 builder_num = '-b%s' % build_match.group(1) | 176 builder_num = '-b%s' % build_match.group(1) |
| 162 else: | 177 else: |
| 163 builder_num = '' | 178 builder_num = '' |
| 164 return '%s-r%s%s' % (version, build_id, builder_num) | 179 return '%s-r%s%s' % (version, build_id, builder_num) |
| 165 | 180 |
| 166 | 181 |
| 167 def get_dev_build_id(self): | 182 def get_dev_build_id(self): |
| 168 """Pulls the CHROMEOS_RELEASE_VERSION string from /etc/lsb-release.""" | 183 """Pulls the CHROMEOS_RELEASE_VERSION string from /etc/lsb-release.""" |
| 169 return self._run('grep CHROMEOS_RELEASE_VERSION' | 184 return self._run('grep CHROMEOS_RELEASE_VERSION' |
| 170 ' /etc/lsb-release').stdout.split('=')[1].strip() | 185 ' /etc/lsb-release').stdout.split('=')[1].strip() |
| OLD | NEW |