Bug 1307482 - Log uploading when it actually happens; r?ted draft
authorGregory Szorc <gps@mozilla.com>
Tue, 04 Oct 2016 08:46:46 -0700
changeset 426114 ddfa9759bd16c88f4a497f898c03ea17d7770fd4
parent 426113 a082297b7802b14be2b90b326f4d0a704bd7868a
child 426115 f80237b4035b1baf610793984355d49bd6d9617d
push id32628
push userbmo:gps@mozilla.com
push dateMon, 17 Oct 2016 22:15:18 +0000
reviewersted
bugs1307482
milestone52.0a1
Bug 1307482 - Log uploading when it actually happens; r?ted In preparation of using a thread pool to call DoSCPFile(). MozReview-Commit-ID: Ab2gk8UTQWK
build/upload.py
--- a/build/upload.py
+++ b/build/upload.py
@@ -105,19 +105,22 @@ def DoSSHCommand(command, user, host, po
             print '=' * 20
             print e.output
             print '=' * 20
             raise
         return output
 
     raise Exception("Command %s returned non-zero exit code" % cmdline)
 
-def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None):
+def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None,
+              log=False):
     """Upload file to user@host:remote_path using scp. Optionally use
     port and ssh_key, if provided."""
+    if log:
+        print 'Uploading %s' % file
     cmdline = ["scp"]
     AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key)
     cmdline.extend([WindowsPathToMsysPath(file),
                     "%s@%s:%s" % (user, host, remote_path)])
     with redo.retrying(check_call, sleeptime=10) as f:
         f(cmdline)
         return
 
@@ -243,19 +246,18 @@ def UploadFiles(user, host, path, files,
 
         # If we wanted to, we could reduce the remote paths if they are a parent
         # of any entry.
         for p in sorted(remote_paths):
             DoSSHCommand("mkdir -p " + p, user, host, port=port, ssh_key=ssh_key)
 
         for file in files:
             remote_path = get_remote_path(file)
-            if verbose:
-                print "Uploading " + file
-            DoSCPFile(file, remote_path, user, host, port=port, ssh_key=ssh_key)
+            DoSCPFile(file, remote_path, user, host, port=port, ssh_key=ssh_key,
+                      log=verbose)
             remote_files.append(remote_path + '/' + os.path.basename(file))
         if post_upload_command is not None:
             if verbose:
                 print "Running post-upload command: " + post_upload_command
             file_list = '"' + '" "'.join(remote_files) + '"'
             output = DoSSHCommand('%s "%s" %s' % (post_upload_command, path, file_list), user, host, port=port, ssh_key=ssh_key)
             # We print since mozharness may parse URLs from the output stream.
             print output