diff options
author | Michael E Brown <mebrown@michaels-house.net> | 2007-10-21 16:07:29 -0500 |
---|---|---|
committer | Michael E Brown <mebrown@michaels-house.net> | 2007-10-21 16:07:29 -0500 |
commit | 2344880763d4417e2d3e6f4690b3da3c6f6d9103 (patch) | |
tree | 22b146aa3b082b1dec9ca8acfe6ceacc8b7ac59a | |
parent | d192e14de3b40d6b736cafb14775f341e01caa19 (diff) | |
download | mock-2344880763d4417e2d3e6f4690b3da3c6f6d9103.tar.gz mock-2344880763d4417e2d3e6f4690b3da3c6f6d9103.tar.xz mock-2344880763d4417e2d3e6f4690b3da3c6f6d9103.zip |
make plugin conf options match: *_opts and *_enable. fix for not doing 'yum install' when --no-clean, but, rather 'yum update'. update defaults.cfg to match new options.
-rw-r--r-- | etc/defaults.cfg | 19 | ||||
-rwxr-xr-x | src/mock.py | 20 | ||||
-rw-r--r-- | src/py-libs/backend.py | 4 |
3 files changed, 24 insertions, 19 deletions
diff --git a/etc/defaults.cfg b/etc/defaults.cfg index 86f2933..6f3e08b 100644 --- a/etc/defaults.cfg +++ b/etc/defaults.cfg @@ -16,6 +16,7 @@ # Things that we recommend you set in defaults.cfg: # # config_opts['basedir'] = '/var/lib/mock/' +# config_opts['cache_topdir'] = '/var/lib/mock/cache' # config_opts['rpmbuild_timeout'] = 0 # config_opts['use_host_resolv'] = True @@ -28,19 +29,21 @@ ############################################################################# # -# Caching related. Below are the defaults. Change to suit your site +# plugin related. Below are the defaults. Change to suit your site # policy. defaults.cfg is a good place to do this. # # NOTE: Some of the caching options can theoretically affect build # reproducability. Change with care. # -# config_opts['cache_topdir'] = '/var/lib/mock/cache' -# config_opts['enable_ccache'] = True -# config_opts['ccache_opts'] = {'max_age_days': 15, 'max_cache_size': "4G"} -# config_opts['enable_yum_cache'] = True -# config_opts['yum_cache_opts'] = {'max_age_days': 15} -# config_opts['enable_root_cache'] = True -# config_opts['root_cache_opts'] = {'max_age_days': 15} +# 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']['yum_cache_enable'] = True +# config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] +# config_opts['plugin_conf']['root_cache_enable'] = True +# config_opts['plugin_conf']['root_cache_opts']['max_age_days'] +# 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 873bf56..64d6f78 100755 --- a/src/mock.py +++ b/src/mock.py @@ -125,18 +125,18 @@ def setup_default_config_opts(config_opts): config_opts['plugins'] = ('ccache', 'yum_cache', 'root_cache', 'bind_mount') config_opts['plugin_dir'] = os.path.join(PKGPYTHONDIR, "plugins") config_opts['plugin_conf'] = { - 'enable_ccache': True, + 'ccache_enable': True, 'ccache_opts': {'max_age_days': 15, 'max_cache_size': "4G"}, - 'enable_yum_cache': True, + 'yum_cache_enable': True, 'yum_cache_opts': {'max_age_days': 15}, - 'enable_root_cache': True, + 'root_cache_enable': True, 'root_cache_opts': {'max_age_days': 15}, - 'enable_bind_mount': True, - 'bind_mount_opts': {'dirs': ( + 'bind_mount_enable': True, + 'bind_mount_opts': {'dirs': [ # specify like this: - # ( '/host/path', '/bind/mount/path/in/chroot/' ) - # ( '/another/host/path', '/another/bind/mount/path/in/chroot/' ) - )}, + # ( '/host/path', '/bind/mount/path/in/chroot/' ), + # ( '/another/host/path', '/another/bind/mount/path/in/chroot/' ), + ]}, } # dependent on guest OS @@ -169,11 +169,11 @@ def set_config_opts_per_cmdline(config_opts, options): for i in options.disabled_plugins: if i not in config_opts['plugins']: raise mock.exception.BadCmdline("Bad option for '--disable-plugins=%s'. Expecting one of: %s" % (i, config_opts['plugins'])) - config_opts['plugin_conf']['enable_%s' % i] = False + config_opts['plugin_conf']['%s_enable' % i] = False for i in options.enabled_plugins: if i not in config_opts['plugins']: raise mock.exception.BadCmdline("Bad option for '--enable-plugins=%s'. Expecting one of: %s" % (i, config_opts['plugins'])) - config_opts['plugin_conf']['enable_%s' % i] = True + config_opts['plugin_conf']['%s_enable' % i] = True if options.cleanup_after and not options.resultdir: raise mock.exception.BadCmdline("Must specify --resultdir when using --cleanup-after") diff --git a/src/py-libs/backend.py b/src/py-libs/backend.py index 47fa8bf..dde616c 100644 --- a/src/py-libs/backend.py +++ b/src/py-libs/backend.py @@ -236,6 +236,8 @@ class Root(object): self.root_log.info('run yum') self._mountall() try: + if not self.chrootWasCleaned: + self.chroot_setup_cmd = 'update' self._yum(self.chroot_setup_cmd) finally: self._umountall() @@ -386,7 +388,7 @@ class Root(object): # Import plugins (simplified copy of what yum does). Can add yum # features later when we prove we need them. for modname, modulefile in [ (p, os.path.join(self.pluginDir, "%s.py" % p)) for p in self.plugins ]: - if not self.pluginConf.get("enable_%s"%modname): continue + if not self.pluginConf.get("%s_enable"%modname): continue fp, pathname, description = imp.find_module(modname, [self.pluginDir]) try: module = imp.load_module(modname, fp, pathname, description) |