diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-03-31 20:14:03 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-03-31 20:14:03 +0000 |
commit | 98961815eda7c7ff44cfca3643d8b280f3873d47 (patch) | |
tree | 9d86d7c131d8a6c64ca6f33f4c428dc32f0835ff /pym/portage/cache/cache_errors.py | |
parent | 4bed54db77464c13f3fc059997286cd9c06562da (diff) | |
download | portage-98961815eda7c7ff44cfca3643d8b280f3873d47.tar.gz portage-98961815eda7c7ff44cfca3643d8b280f3873d47.tar.bz2 portage-98961815eda7c7ff44cfca3643d8b280f3873d47.zip |
Add a new egencache --rsync option which enables a stat collision workaround
for cases in which the content of a cache entry changes and neither the file
mtime nor size changes (preventing rsync from detecting changes). See bug
#139134. This option should only be needed for distribution via something
like rsync, which relies on timestamps and file sizes to detect changes. It's
not needed with git since that uses a more thorough mechanism which allows it
to detect changed inode numbers (described in racy-git.txt in the git
technical docs).
svn path=/main/trunk/; revision=13262
Diffstat (limited to 'pym/portage/cache/cache_errors.py')
-rw-r--r-- | pym/portage/cache/cache_errors.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pym/portage/cache/cache_errors.py b/pym/portage/cache/cache_errors.py index f63e5994b..e1e8eead0 100644 --- a/pym/portage/cache/cache_errors.py +++ b/pym/portage/cache/cache_errors.py @@ -39,3 +39,25 @@ class ReadOnlyRestriction(CacheError): self.info = info def __str__(self): return "cache is non-modifiable"+str(self.info) + +class StatCollision(CacheError): + """ + If the content of a cache entry changes and neither the file mtime nor + size changes, it will prevent rsync from detecting changes. Cache backends + may raise this exception from _setitem() if they detect this type of stat + collision. See bug #139134. + """ + def __init__(self, key, filename, mtime, size): + self.key = key + self.filename = filename + self.mtime = mtime + self.size = size + + def __str__(self): + return "%s has stat collision with size %s and mtime %s" % \ + (self.key, self.size, self.mtime) + + def __repr__(self): + return "portage.cache.cache_errors.StatCollision(%s)" % \ + (', '.join((repr(self.key), repr(self.filename), + repr(self.mtime), repr(self.size))),) |