Bug 1307482 - Refactor remote path logic into function; r?ted draft
authorGregory Szorc <gps@mozilla.com>
Tue, 04 Oct 2016 08:29:50 -0700
changeset 426112 061aebb95c4b3f783a0ff5792de2134780158d01
parent 426004 7c8216f48c38a8498f251fe044509b930af44de6
child 426113 a082297b7802b14be2b90b326f4d0a704bd7868a
push id32628
push userbmo:gps@mozilla.com
push dateMon, 17 Oct 2016 22:15:18 +0000
reviewersted
bugs1307482
milestone52.0a1
Bug 1307482 - Refactor remote path logic into function; r?ted We'll call this multiple times in a subsequent commit. I hate DRY violations. MozReview-Commit-ID: Khai4EZkPCS
build/upload.py
--- a/build/upload.py
+++ b/build/upload.py
@@ -222,23 +222,26 @@ def UploadFiles(user, host, path, files,
     if upload_to_temp_dir:
         path = DoSSHCommand("mktemp -d", user, host, port=port, ssh_key=ssh_key)
     if not path.endswith("/"):
         path += "/"
     if base_path is not None:
         base_path = os.path.abspath(base_path)
     remote_files = []
     properties = {}
+
+    def get_remote_path(p):
+        return GetBaseRelativePath(path, os.path.abspath(p), base_path)
+
     try:
         for file in files:
-            file = os.path.abspath(file)
             if not os.path.isfile(file):
                 raise IOError("File not found: %s" % file)
             # first ensure that path exists remotely
-            remote_path = GetBaseRelativePath(path, file, base_path)
+            remote_path = get_remote_path(file)
             DoSSHCommand("mkdir -p " + remote_path, user, host, port=port, ssh_key=ssh_key)
             if verbose:
                 print "Uploading " + file
             DoSCPFile(file, remote_path, user, host, port=port, ssh_key=ssh_key)
             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