Add stateful partition reset to upgrade process.

The --stateful_change=clean flag is working again for stateful updates. By adding the flag to our upgrade process we ensure that we're always working with a clean base for testing. No more out of space issues due to lingering core dumps or other files.

Change-Id: Iee205df9964bef49f47422b13d2adcf1f38a9dd4

BUG=chromium-os:11971
TEST=Tested flag manually on ToT public, ToT mario, RC mario, and RC agz. Will test code in production.

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=85ce69e

Review URL: http://codereview.chromium.org/6021006
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index 244cbbd..f23a284 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -11,7 +11,11 @@
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.cros import constants as chromeos_constants
 
-STATEFULDEV_UPDATER = '/usr/local/bin/stateful_update'
+# TODO(dalecurtis): HACK to bootstrap stateful updater until crosbug.com/8960 is
+# fixed.
+LOCAL_STATEFULDEV_UPDATER = ('/home/chromeos-test/chromeos-src/chromeos/src'
+                             '/platform/dev/stateful_update')
+STATEFULDEV_UPDATER = '/tmp/stateful_update'
 UPDATER_BIN = '/usr/bin/update_engine_client'
 UPDATER_IDLE = 'UPDATE_STATUS_IDLE'
 UPDATER_NEED_REBOOT = 'UPDATE_STATUS_UPDATED_NEED_REBOOT'
@@ -117,8 +121,19 @@
         # is testable after we run the autoupdater.
         statefuldev_url = self.update_url.replace('update', 'static/archive')
 
-        statefuldev_cmd = ' '.join([STATEFULDEV_UPDATER, statefuldev_url,
-                                    '2>&1'])
+        # TODO(dalecurtis): HACK to bootstrap stateful updater until
+        # crosbug.com/8960 is fixed.
+        self.host.send_file(LOCAL_STATEFULDEV_UPDATER, STATEFULDEV_UPDATER,
+                            delete_dest=True)
+        statefuldev_cmd = [STATEFULDEV_UPDATER, statefuldev_url]
+
+        # TODO(dalecurtis): HACK necessary until R10 builds are out of testing.
+        if int(self.update_version.split('.')[1]) > 10:
+            statefuldev_cmd.append('--stateful_change=clean')
+
+        statefuldev_cmd.append('2>&1')
+        statefuldev_cmd = ' '.join(statefuldev_cmd)
+
         logging.info(statefuldev_cmd)
         try:
             self._run(statefuldev_cmd, timeout=600)