sshcontrol.py: in copy_to() always use scp

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]

(From OE-Core rev: a9d446d9c42a67109ae87a156ae43dcbb0f56e1e)

(From OE-Core rev: fc0cdeca1b9820e070175a0b8d9fefa40eaed15d)

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>
Signed-off-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Erik Botö 2017-11-06 10:13:06 -08:00 committed by Richard Purdie
parent e629e05a1f
commit 768dad3469
1 changed files with 3 additions and 6 deletions

View 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]