-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael E Brown wrote:
> On Fri, Feb 29, 2008 at 09:58:35AM -0600, Clark Williams wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Michael,
>>
>> I was looking at BZ 233529 on mock and was wondering if the requested
>> behavior seems
>> valid (it does to me, just wanted a sanity check).
>>
>> As far as I can tell, the only time the root cache is invalidated is when it
>> ages out
>> (was looking at the plugin).
>
> This is correct.
>
>> Does it make sense to also invalidate the cache when the
>> .cfg that defines it has a newer modification time?
>
> Makes perfect sense. May be somewhat difficult to implement, I'm not
> sure we store the config file name anywhere that the plugin can get to
> it.
> --
> Michael
Here's a way to do it.
One thing that wasn't immediately apparent to me, but became clear when I
started
installing/debugging was that everytime you install a new mock rpm, the cfg
file will
have a timestamp newer than any existing root-cache file, which means with this
patch
each root-cache will be rebuilt. This seems like a reasonable thing to do
(rebuild
the caches after installing a new mock), but I wonder if it will break anything?
Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAkfIY9cACgkQHyuj/+TTEp07nwCeMSIqBL3c8g9BXmr+BisitT2B
g50An2nDwD5xbJ+Nh6Or/ZDDuWwMecxt
=Ht8F
-----END PGP SIGNATURE-----
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
--
Fedora-buildsys-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list