summaryrefslogtreecommitdiffstats
path: root/src/py-libs/plugins/bind.py
diff options
context:
space:
mode:
authorMichael E Brown <mebrown@michaels-house.net>2007-10-21 06:14:00 -0500
committerMichael E Brown <mebrown@michaels-house.net>2007-10-21 06:14:00 -0500
commit117457586196119f9b4b9c80e2e761e81e21fecb (patch)
tree90391668335f0ac37d02148e3c77c186f4fc49a0 /src/py-libs/plugins/bind.py
parentd115ea6765917221d8113459f381267598f4e076 (diff)
downloadmock-117457586196119f9b4b9c80e2e761e81e21fecb.tar.gz
mock-117457586196119f9b4b9c80e2e761e81e21fecb.tar.xz
mock-117457586196119f9b4b9c80e2e761e81e21fecb.zip
new plugin to optionally bind-mount host dirs into buildroot. not configured by default.
Diffstat (limited to 'src/py-libs/plugins/bind.py')
-rw-r--r--src/py-libs/plugins/bind.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/py-libs/plugins/bind.py b/src/py-libs/plugins/bind.py
new file mode 100644
index 0000000..e2da4d7
--- /dev/null
+++ b/src/py-libs/plugins/bind.py
@@ -0,0 +1,40 @@
+# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
+# License: GPL2 or later see COPYING
+# Written by Michael Brown
+# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
+
+# python library imports
+import logging
+import os
+
+# our imports
+from mock.trace_decorator import traceLog
+import mock.util
+
+# set up logging, module options
+moduleLog = logging.getLogger("mock")
+requires_api_version = "1.0"
+
+# plugin entry point
+def init(rootObj, conf):
+ bind = BindMount(rootObj, conf)
+
+# classes
+class BindMount(object):
+ """bind mount dirs from host into chroot"""
+ @traceLog(moduleLog)
+ def __init__(self, rootObj, conf):
+ self.rootObj = rootObj
+ self.bind_opts = conf
+ self.rootdir = rootObj.rootdir
+ rootObj.bindMountObj = self
+ rootObj.addHook("preinit", self._bindMountPreInitHook)
+ #rootObj.umountCmds.append('umount -n %s/tmp/ccache' % rootObj.rootdir)
+ #rootObj.mountCmds.append('mount -n --bind %s %s/tmp/ccache' % (self.ccachePath, rootObj.rootdir))
+
+ @traceLog(moduleLog)
+ def _bindMountPreInitHook(self):
+ #mock.util.mkdirIfAbsent(os.path.join(self.rootdir, 'tmp/ccache'))
+ pass
+
+