From a576ffb7147d25b81ba94f30190599abaa5e9847 Mon Sep 17 00:00:00 2001 From: astokes Date: Thu, 19 Nov 2009 20:05:43 +0000 Subject: more symlink work git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@665 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- src/lib/sos/plugintools.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py index 39f592d4..cd4864e8 100644 --- a/src/lib/sos/plugintools.py +++ b/src/lib/sos/plugintools.py @@ -119,7 +119,7 @@ class PluginBase: return [] # Methods for copying files and shelling out - def doCopyFileOrDir(self, srcpath): + def doCopyFileOrDir(self, srcpath, symlinks=True): # pylint: disable-msg = R0912 # pylint: disable-msg = R0915 ''' Copy file or directory to the destination tree. If a directory, then everything @@ -147,7 +147,10 @@ class PluginBase: if symlinks and os.path.islink(srcpath): link = os.readlink(srcpath) os.symlink(link, dstslname) - rpth = sosRelPath(os.path.dirname(dstslname), os.path.join(self.cInfo['dstroot'], link.lstrip(os.path.sep))) + if os.path.isabs(srcpath): + rpth = sosRelPath(os.path.dirname(dstslname), os.path.join(self.cInfo['dstroot'], link.lstrip(os.path.sep))) + else: + rpth = link self.copiedFiles.append({'srcpath':srcpath, 'dstpath':rpth, 'symlink':"yes", 'pointsto':link}) elif os.path.isdir(srcpath): shutil.copytree(srcpath, dstslname, symlinks) -- cgit