]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/utils/sshcontrol.py: Allows to copy symlinks to target
authorMariano Lopez <mariano.lopez@linux.intel.com>
Tue, 26 Jul 2016 09:38:57 +0000 (09:38 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 4 Aug 2016 14:05:47 +0000 (15:05 +0100)
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]

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/sshcontrol.py

index f5d46e03cc5d816ee9a95b2bf906c601c0ff0c66..da485ee408ad53d79c59c296fd14a2baa67355ee 100644 (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]