]> code.ossystems Code Review - openembedded-core.git/commitdiff
sshcontrol.py: in copy_to() always use scp
authorErik Botö <erik.boto@pelagicore.com>
Mon, 6 Nov 2017 18:13:06 +0000 (10:13 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 8 Nov 2017 19:54:23 +0000 (19:54 +0000)
The current implementation is broken when the localpath is a link.
Then only a symlink would be created on the target, instead of copying
the actual file.

[YOCTO #11524]

Signed-off-by: Erik Botö <erik.boto@pelagicore.com>
Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/sshcontrol.py

index 05d65025508cf87ca41f19c8f7c7c71b2c3b3477..d292893c08f2027ae0913491a51a800722684e9a 100644 (file)
@@ -150,12 +150,9 @@ class SSHControl(object):
 
     def copy_to(self, localpath, remotepath):
         if os.path.islink(localpath):
-            link = os.readlink(localpath)
-            dst_dir, dst_base = os.path.split(remotepath)
-            return self.run("cd %s; ln -s %s %s" % (dst_dir, link, dst_base))
-        else:
-            command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]
-            return self._internal_run(command, ignore_status=False)
+            localpath = os.path.dirname(localpath) + "/" + os.readlink(localpath)
+        command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]
+        return self._internal_run(command, ignore_status=False)
 
     def copy_from(self, remotepath, localpath):
         command = self.scp + ['%s@%s:%s' % (self.user, self.ip, remotepath), localpath]