Blob Blame History Raw
From ad99dc5b2abab27a52f612c7567af5c058543622 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Thu, 29 Jan 2015 22:00:10 +0000
Subject: [PATCH] [plugins] trim leading '../' from links when sysroot is set

When SYSROOT is not '/' relative symlinks need to be trimmed to
remove the extra leading '../' returned by
abspath('/sysroot/...').

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/plugins/__init__.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index d8c6b69..e8224e6 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -271,6 +271,9 @@ class Plugin(object):
         # adjust the target used inside the report to always be relative
         if os.path.isabs(linkdest):
             reldest = os.path.relpath(linkdest, os.path.dirname(srcpath))
+            # trim leading /sysroot
+            if self.use_sysroot():
+                reldest = reldest[len(os.sep + os.pardir):]
             self._log_debug("made link target '%s' relative as '%s'"
                             % (linkdest, reldest))
         else:
-- 
1.9.3