Bug 720663 - devicemanagerADB pushDir fallback not always tried. r=gbrown
authorChris Lord <chrislord.net@gmail.com>
Wed, 25 Jan 2012 09:49:30 +0000
changeset 86555 63db726e7634fd9ead1f636e5068d6467a88a8bc
parent 86554 4034e454bfbbc10a85ea08ce3b16ff655d8030ed
child 86556 93e51ab759cbbb189ef9b89a0af3b46262eec1f1
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs720663
milestone12.0a1
Bug 720663 - devicemanagerADB pushDir fallback not always tried. r=gbrown The devicemanagerADB.py pushDir method has two paths, one that uses zip/unzip and the other that just pushes each file one at a time. The idea is that the first path is chosen, and if it fails, the second is tried before bailing out, but it's possible for the first failure not to be detected in such a way that activates the fallback path. Add a try/except block to catch exceptions in the first path and fall back to the second.
build/mobile/devicemanagerADB.py
--- a/build/mobile/devicemanagerADB.py
+++ b/build/mobile/devicemanagerADB.py
@@ -110,24 +110,27 @@ class DeviceManagerADB(DeviceManager):
     # adb "push" accepts a directory as an argument, but if the directory
     # contains symbolic links, the links are pushed, rather than the linked
     # files; we either zip/unzip or push file-by-file to get around this 
     # limitation
     try:
       if (not self.dirExists(remoteDir)):
         self.mkDirs(remoteDir+"/x")
       if (self.useZip):
-        localZip = tempfile.mktemp()+".zip"
-        remoteZip = remoteDir + "/adbdmtmp.zip"
-        subprocess.check_output(["zip", "-r", localZip, '.'], cwd=localDir)
-        self.pushFile(localZip, remoteZip)
-        os.remove(localZip)
-        data = self.runCmdAs(["shell", "unzip", "-o", remoteZip, "-d", remoteDir]).stdout.read()
-        self.checkCmdAs(["shell", "rm", remoteZip])
-        if (re.search("unzip: exiting", data) or re.search("Operation not permitted", data)):
+        try:
+          localZip = tempfile.mktemp()+".zip"
+          remoteZip = remoteDir + "/adbdmtmp.zip"
+          subprocess.check_output(["zip", "-r", localZip, '.'], cwd=localDir)
+          self.pushFile(localZip, remoteZip)
+          os.remove(localZip)
+          data = self.runCmdAs(["shell", "unzip", "-o", remoteZip, "-d", remoteDir]).stdout.read()
+          self.checkCmdAs(["shell", "rm", remoteZip])
+          if (re.search("unzip: exiting", data) or re.search("Operation not permitted", data)):
+            raise Exception("unzip failed, or permissions error")
+        except:
           print "zip/unzip failure: falling back to normal push"
           self.useZip = False
           self.pushDir(localDir, remoteDir)
       else:
         for root, dirs, files in os.walk(localDir, followlinks='true'):
           relRoot = os.path.relpath(root, localDir)
           for file in files:
             localFile = os.path.join(root, file)