diff --git a/py/mock.py b/py/mock.py index d5afbbe..cbd9ffe 100755 --- a/py/mock.py +++ b/py/mock.py @@ -425,6 +425,9 @@ def main(ret): if options.configdir: config_path = options.configdir + # save for use in Root object + config_opts['config_path'] = config_path + # Read in the config files: default, and then user specified for cfg in ( os.path.join(config_path, 'site-defaults.cfg'), '%s/%s.cfg' % (config_path, options.chroot)): if os.path.exists(cfg): diff --git a/py/mock/backend.py b/py/mock/backend.py index 7d11532..274ea40 100644 --- a/py/mock/backend.py +++ b/py/mock/backend.py @@ -50,6 +50,7 @@ class Root(object): self._state_log = getLog("mock.Root.state") # config options + self.configfile = os.path.join(config['config_path'], config['chroot_name']) + ".cfg" self.chrootuid = config['chrootuid'] self.chrootuser = 'mockbuild' self.chrootgid = config['chrootgid'] diff --git a/py/mock/plugins/root_cache.py b/py/mock/plugins/root_cache.py index 9cb0a13..d1ed152 100644 --- a/py/mock/plugins/root_cache.py +++ b/py/mock/plugins/root_cache.py @@ -66,6 +66,11 @@ class RootCache(object): statinfo = os.stat(self.rootCacheFile) file_age_days = (time.time() - statinfo.st_ctime) / (60 * 60 * 24) if file_age_days > self.root_cache_opts['max_age_days']: + getLog().info("root cache aged out! cache will be rebuilt") + os.unlink(self.rootCacheFile) + + elif os.stat(self.rootObj.configfile).st_mtime > statinfo.st_mtime: + getLog().info("root cache older than %s; cache will be rebuilt" % self.rootObj.configfile) os.unlink(self.rootCacheFile) except OSError: pass