diff options
Diffstat (limited to 'py')
-rwxr-xr-x | py/mock.py | 4 | ||||
-rw-r--r-- | py/mock/backend.py | 1 | ||||
-rw-r--r-- | py/mock/plugins/root_cache.py | 11 |
3 files changed, 15 insertions, 1 deletions
@@ -425,9 +425,13 @@ def main(ret): if options.configdir: config_path = options.configdir + # array to save config paths + config_opts['config_paths'] = [] + # 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): + config_opts['config_paths'].append(cfg) execfile(cfg) else: log.error("Could not find required config file: %s" % cfg) diff --git a/py/mock/backend.py b/py/mock/backend.py index 7d11532..6726deb 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.configs = config['config_paths'] 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..5382912 100644 --- a/py/mock/plugins/root_cache.py +++ b/py/mock/plugins/root_cache.py @@ -61,12 +61,21 @@ class RootCache(object): if self.rootCacheLock is None: self.rootCacheLock = open(os.path.join(self.rootSharedCachePath, "rootcache.lock"), "a+") - # check cache age: + # check cache status try: + # see if it aged out 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) + else: + # make sure no config file is newer than the cache file + for cfg in self.rootObj.configs: + if os.stat(cfg).st_mtime > statinfo.st_mtime: + getLog().info("%s newer than root cache; cache will be rebuilt" % cfg) + os.unlink(self.rootCacheFile) + break except OSError: pass |