From 307b1d6253079689102a9d92fd1af2482ee52435 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Sun, 25 Jan 2015 23:08:37 +0000
Subject: [PATCH 64/93] [plugin] add tmp_in_sysroot() method
Add a method that plugins can test to determine whether the
archive's temporary directory is inside sysroot. This is always
true when sysroot is '/'. When sysroot is a subdirectory of root
the temporary directory may be inaccessible from the chroot
namespace. Plugins can test this method to determine where to
write output.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
sos/plugins/__init__.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index bff11be..5df40ff 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -169,6 +169,10 @@ class Plugin(object):
def use_sysroot(self):
return self.sysroot != os.path.abspath(os.sep)
+ def tmp_in_sysroot(self):
+ paths = [self.sysroot, self.archive.get_tmp_dir()]
+ return os.path.commonprefix(paths) == self.sysroot
+
def is_installed(self, package_name):
'''Is the package $package_name installed?'''
return self.policy().pkg_by_name(package_name) is not None
--
1.9.3