oeqa/utils/sshcontrol.py: Allows to copy symlinks to target

Currently when copying a symlink to the target it will fail
throwing an exception. This will recreate symlinks from the
system performing the tests to the device under tests.

[YOCTO #9932]

(From OE-Core rev: 5705b7a55bc300e14c34b0530f4d49df101edd3c)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mariano Lopez
2016-07-26 09:38:57 +00:00
committed by Richard Purdie
parent 65459f5b6d
commit 37f1e0c154

View File

@@ -147,8 +147,13 @@ class SSHControl(object):
return self._internal_run(command, timeout, self.ignore_status)
def copy_to(self, localpath, remotepath):
command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, remotepath)]
return self._internal_run(command, ignore_status=False)
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)
def copy_from(self, remotepath, localpath):
command = self.scp + ['%s@%s:%s' % (self.user, self.ip, remotepath), localpath]