summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Salz <jsalz@chromium.org>2012-05-25 10:45:03 (GMT)
committerGerrit <chrome-bot@google.com>2012-05-25 11:46:00 (GMT)
commitd24083c95f5aad81c42cc17fe99d3d4ff9670ee6 (patch)
treefba4405870d624e4285b5558962f1fd63dff1fd9
parent2120d46bc920d2eaef5f832a36883e62de0c9b21 (diff)
downloadautotest-d24083c95f5aad81c42cc17fe99d3d4ff9670ee6.tar.gz
autotest-d24083c95f5aad81c42cc17fe99d3d4ff9670ee6.tar.xz
Fix autotest root detection to work properly both on DUT and chroot.
BUG=None TEST=Manual on device and chroot Change-Id: I7a206cb96307811f736fca86db34aa0db5afdb05 Reviewed-on: https://gerrit.chromium.org/gerrit/23636 Commit-Ready: Jon Salz <jsalz@chromium.org> Reviewed-by: Jon Salz <jsalz@chromium.org> Tested-by: Jon Salz <jsalz@chromium.org>
-rw-r--r--client/cros/factory/updater.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/client/cros/factory/updater.py b/client/cros/factory/updater.py
index 62879c6..3602e1b 100644
--- a/client/cros/factory/updater.py
+++ b/client/cros/factory/updater.py
@@ -17,20 +17,6 @@ class UpdaterException(Exception):
pass
-def FindAutotestPath():
- '''Returns the path to the autotest directory containing this script.'''
- # Find the autotest root.
- path_components = os.path.realpath(__file__).split('/')
- for i in reversed(range(len(path_components))):
- if path_components[i] == 'autotest':
- break
- else:
- raise UpdaterException('Unable to find autotest root in %s' %
- path_components)
-
- return '/'.join(path_components[0:i+1])
-
-
def CheckCriticalFiles(autotest_new_path):
'''Raises an exception if certain critical files are missing.'''
critical_files = [
@@ -60,7 +46,10 @@ def TryUpdate(pre_update_hook=None):
True if an update was performed and the machine should be
rebooted.
'''
- autotest_path = FindAutotestPath()
+ # On a real device, this will resolve to 'autotest' (since 'client'
+ # is a symlink to that). In the chroot, this will resolve to the
+ # 'client' directory.
+ autotest_path = factory.CLIENT_PATH
# Determine whether an update is necessary.
md5sum_file = os.path.join(autotest_path, 'MD5SUM')
@@ -86,7 +75,7 @@ def TryUpdate(pre_update_hook=None):
autotest_new_path = '%s.new' % autotest_path
rsync_command = [
'rsync',
- '-a', '--delete',
+ '-a', '--delete', '--stats',
# Use copies of identical files from the old autotest
# as much as possible to save network bandwidth.
'--copy-dest=%s' % autotest_path,