Bug 1055014 - Fix mistake in mozdevice.pushDir that is causing an exception while trying to use zip/unzip, r=wlach
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 21 Aug 2014 15:53:34 -0400
changeset 200939 2cd1144d6150de230d7fc370027396d3fff265a1
parent 200938 d0dd7f70b560e7efed5605bef252389b2e45c706
child 200940 e0bd2eb2c3d723d8b5c9ac64cc358c3668d84e06
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
Bug 1055014 - Fix mistake in mozdevice.pushDir that is causing an exception while trying to use zip/unzip, r=wlach
--- a/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
+++ b/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
@@ -2,16 +2,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 import re
 import os
 import shutil
 import tempfile
 import time
+import traceback
 from devicemanager import DeviceManager, DMError
 from mozprocess import ProcessHandler
 import mozfile
 import mozlog
 class DeviceManagerADB(DeviceManager):
@@ -216,28 +217,31 @@ class DeviceManagerADB(DeviceManager):
         # one to get around this limitation
         retryLimit = retryLimit or self.retryLimit
         if not self.dirExists(remoteDir):
         if self._useZip:
                 localZip = tempfile.mktemp() + ".zip"
                 remoteZip = remoteDir + "/adbdmtmp.zip"
-                ProcessHandler(["zip", "-r", localZip, '.'], cwd=localDir,
-                        processOutputLine=self._log).run().wait()
+                proc = ProcessHandler(["zip", "-r", localZip, '.'], cwd=localDir,
+                              processOutputLine=self._log)
+                proc.run()
+                proc.wait()
                 self.pushFile(localZip, remoteZip, retryLimit=retryLimit, createDir=False)
                 data = self._runCmd(["shell", "unzip", "-o", remoteZip,
                                      "-d", remoteDir]).output[0]
                 self._checkCmd(["shell", "rm", remoteZip],
                                retryLimit=retryLimit, timeout=timeout)
                 if re.search("unzip: exiting", data) or re.search("Operation not permitted", data):
                     raise Exception("unzip failed, or permissions error")
-                self._logger.info("zip/unzip failure: falling back to normal push")
+                self._logger.warning(traceback.format_exc())
+                self._logger.warning("zip/unzip failure: falling back to normal push")
                 self._useZip = False
                 self.pushDir(localDir, remoteDir, retryLimit=retryLimit)
             tmpDir = tempfile.mkdtemp()
             # copytree's target dir must not already exist, so create a subdir
             tmpDirTarget = os.path.join(tmpDir, "tmp")
             shutil.copytree(localDir, tmpDirTarget)
             self._checkCmd(["push", tmpDirTarget, remoteDir], retryLimit=retryLimit)