summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2007-10-24 18:18:50 -0500
committerMichael E Brown <michael_e_brown@dell.com>2007-10-24 18:18:50 -0500
commite529d4bffb7acdb0e044f172dc2f18a33bbd31fb (patch)
treed2197a739ec8ade4ee8ed8def71fe268c4ce1cf1
parent0c6265c09a45ce208d5d0f8fab9a48531dfdcdac (diff)
downloadmock-e529d4bffb7acdb0e044f172dc2f18a33bbd31fb.tar.gz
mock-e529d4bffb7acdb0e044f172dc2f18a33bbd31fb.tar.xz
mock-e529d4bffb7acdb0e044f172dc2f18a33bbd31fb.zip
allow noncontiguous cache dir specifications.
-rw-r--r--etc/defaults.cfg4
-rwxr-xr-xsrc/mock.py6
-rw-r--r--src/py-libs/backend.py6
-rw-r--r--src/py-libs/plugins/ccache.py2
-rw-r--r--src/py-libs/plugins/root_cache.py2
-rw-r--r--src/py-libs/plugins/yum_cache.py2
6 files changed, 14 insertions, 8 deletions
diff --git a/etc/defaults.cfg b/etc/defaults.cfg
index e01040d..f9b9fa7 100644
--- a/etc/defaults.cfg
+++ b/etc/defaults.cfg
@@ -19,7 +19,6 @@
# config_opts['cache_topdir'] = '/var/lib/mock/cache'
# config_opts['rpmbuild_timeout'] = 0
# config_opts['use_host_resolv'] = True
-
# the cleanup_on_* options allow you to automatically clean and remove the
# mock build directory, but only take effect if --resultdir is used.
# config_opts provides fine-grained control. cmdline only has big hammer
@@ -38,10 +37,13 @@
# config_opts['plugin_conf']['ccache_enable'] = True
# config_opts['plugin_conf']['ccache_opts']['max_age_days'] =
# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G'
+# config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/"
# config_opts['plugin_conf']['yum_cache_enable'] = True
# config_opts['plugin_conf']['yum_cache_opts']['max_age_days']
+# config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/"
# config_opts['plugin_conf']['root_cache_enable'] = True
# config_opts['plugin_conf']['root_cache_opts']['max_age_days']
+# config_opts['plugin_conf']['yum_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/"
# config_opts['plugin_conf']['bind_mount_enable'] = True
# config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' ))
diff --git a/src/mock.py b/src/mock.py
index 3c1c57a..3ec07d6 100755
--- a/src/mock.py
+++ b/src/mock.py
@@ -125,11 +125,11 @@ def setup_default_config_opts(config_opts):
config_opts['plugin_dir'] = os.path.join(PKGPYTHONDIR, "plugins")
config_opts['plugin_conf'] = {
'ccache_enable': True,
- 'ccache_opts': {'max_age_days': 15, 'max_cache_size': "4G"},
+ 'ccache_opts': {'max_age_days': 15, 'max_cache_size': "4G", 'dir': "%(cache_topdir)s/%(root)s/ccache/"},
'yum_cache_enable': True,
- 'yum_cache_opts': {'max_age_days': 15},
+ 'yum_cache_opts': {'max_age_days': 15, 'dir': "%(cache_topdir)s/%(root)s/yum_cache/"},
'root_cache_enable': True,
- 'root_cache_opts': {'max_age_days': 15},
+ 'root_cache_opts': {'max_age_days': 15, 'dir': "%(cache_topdir)s/%(root)s/root_cache/"},
'bind_mount_enable': True,
'bind_mount_opts': {'dirs': [
# specify like this:
diff --git a/src/py-libs/backend.py b/src/py-libs/backend.py
index 1f24955..0d4f7c3 100644
--- a/src/py-libs/backend.py
+++ b/src/py-libs/backend.py
@@ -73,6 +73,11 @@ class Root(object):
self.plugins = config['plugins']
self.pluginConf = config['plugin_conf']
self.pluginDir = config['plugin_dir']
+ for key in self.pluginConf.keys():
+ if not key.endswith("_opts"): continue
+ self.pluginConf[key]["basedir"] = self.basedir
+ self.pluginConf[key]["cache_topdir"] = self.cachedir
+ self.pluginConf[key]["root"] = self.sharedRootName
# mount/umount
self.umountCmds = ['umount -n %s/proc' % self.rootdir,
@@ -141,7 +146,6 @@ class Root(object):
# --> no /etc/yum.conf symlink (F7 and above)
# create our base directory heirarchy
- mock.util.mkdirIfAbsent(self.cachedir)
mock.util.mkdirIfAbsent(self.basedir)
mock.util.mkdirIfAbsent(self.rootdir)
diff --git a/src/py-libs/plugins/ccache.py b/src/py-libs/plugins/ccache.py
index 7e49221..c72bccc 100644
--- a/src/py-libs/plugins/ccache.py
+++ b/src/py-libs/plugins/ccache.py
@@ -26,7 +26,7 @@ class CCache(object):
def __init__(self, rootObj, conf):
self.rootObj = rootObj
self.ccache_opts = conf
- self.ccachePath = os.path.join(rootObj.cachedir, "ccache")
+ self.ccachePath = self.ccache_opts['dir'] % self.ccache_opts
self.rootdir = rootObj.rootdir
rootObj.ccacheObj = self
rootObj.preExistingDeps = "ccache"
diff --git a/src/py-libs/plugins/root_cache.py b/src/py-libs/plugins/root_cache.py
index 0b33725..bb13357 100644
--- a/src/py-libs/plugins/root_cache.py
+++ b/src/py-libs/plugins/root_cache.py
@@ -28,7 +28,7 @@ class RootCache(object):
def __init__(self, rootObj, conf):
self.rootObj = rootObj
self.root_cache_opts = conf
- self.rootSharedCachePath = os.path.join(rootObj.cachedir, "root_cache")
+ self.rootSharedCachePath = self.root_cache_opts['dir'] % self.root_cache_opts
self.rootCacheFile = os.path.join(self.rootSharedCachePath, "cache.tar.gz")
self.rootCacheLock = None
self.state = rootObj.state
diff --git a/src/py-libs/plugins/yum_cache.py b/src/py-libs/plugins/yum_cache.py
index 1feb3ef..230a1a2 100644
--- a/src/py-libs/plugins/yum_cache.py
+++ b/src/py-libs/plugins/yum_cache.py
@@ -28,7 +28,7 @@ class YumCache(object):
def __init__(self, rootObj, conf):
self.rootObj = rootObj
self.yum_cache_opts = conf
- self.yumSharedCachePath = os.path.join(rootObj.cachedir, "yum_cache")
+ self.yumSharedCachePath = self.yum_cache_opts['dir'] % self.yum_cache_opts
self.state = rootObj.state
self.rootdir = rootObj.rootdir
rootObj.yum_cacheObj = self