summaryrefslogtreecommitdiffstats
path: root/pym/portage/cache/flat_hash.py
Commit message (Collapse)AuthorAgeFilesLines
* cache/flat_hash.py: unicode_literalsZac Medico2013-01-181-7/+7
|
* Use 'with file' more.Zac Medico2012-12-281-6/+3
| | | | This helps to minimize ResourceWarning triggered by ^C with python3.
* flat_hash.__iter__: validate keysZac Medico2012-11-201-3/+7
|
* layout.conf: add git friendly pregenerated cache formatBrian Harring2011-10-141-2/+7
| | | | | | | | | | | | | | | | | Enabled via cache-format = md5-dict This format is essentially just flat_hash, using md5 rather than mtime, and dropping the path component from _eclasses_ entries. From a speed standpoint, the md5 overhead is ~16% in comparison to mtime, timed on a modern sandybridge; specifically, validating 29k nodes takes ~8.8s for flat_md5, while the pms norm is ~7.7s. That said, the cache is /usable/ in places PMS is not; in those cases, it can definitely be a win since even if the cache is partially old, it's better than regenerating everything from scratch. (cherry picked from commit 95ddf97e2f7e7d3f6a072604b2df5f77e9298558) Change-Id: Ic3561369b7a8be7f86480f339ab1686fddea6dff
* Migrate from codecs.open() to io.open().Zac Medico2011-07-101-7/+12
| | | | | | | | | | | | | | | | | The io.open() function is the same as the built-in open() function in python3, and its implementation is optimized in python-2.7 and later. In addition to the possible performance improvement, this also allows us to avoid any future compatibility issues with codecs.open() that may arise if it is delegated to the built-in open() function as discussed in PEP 400. The main caveat involved with io.open() is that TextIOWrapper.write() raises TypeError if given raw bytes, unlike the streams returned from codecs.open(). This is mainly an issue for python2 since literal strings are raw bytes. We handle this by wrapping TextIOWrapper.write() arguments with our _unicode_decode() function. Also, the atomic_ofstream class overrides the write() method in python2 so that it performs automatic coercion to unicode when necessary.
* Remove all svn $Id keywords.Zac Medico2010-03-241-1/+0
|
* In __iter__, handle OSError from lstat in case a cache entry disappears.Zac Medico2010-01-311-1/+5
| | | | svn path=/main/trunk/; revision=15297
* Make __iter__ use list.pop() instead of pop(0), for greater efficiency.Zac Medico2010-01-311-6/+4
| | | | svn path=/main/trunk/; revision=15296
* Bug #302764 - Inside __iter__, only recurse 1 deep, in order to avoidZac Medico2010-01-311-4/+10
| | | | | | | | iteration over entries from another nested cache instance. This can happen if the user nests an overlay inside /usr/portage/local. Thanks to Vlastimil Babka <caster@g.o> for this patch. svn path=/main/trunk/; revision=15295
* When integer mtime is desired, use stat_obj[stat.ST_MTIME] instead of theZac Medico2009-12-211-1/+1
| | | | | | float st_mtime in order to avoid rounding *up* in some rare cases. svn path=/main/trunk/; revision=15125
* Fix regression in _getitem() from r14398, since myf.read().split("\n")Zac Medico2009-09-241-1/+4
| | | | | | | yields an empty string at the end which is causes _parse_data() to catch a ValueError and raise CacheCorruption. svn path=/main/trunk/; revision=14416
* Misc performance enhancements. Thanks to Marat RadchenkoZac Medico2009-09-241-10/+7
| | | | | | <marat@slonopotamus.org> for this patch from bug #276813. svn path=/main/trunk/; revision=14398
* Define long as int when Python 3 is used.Arfrever Frehtes Taifersar Arahesis2009-09-211-0/+4
| | | | svn path=/main/trunk/; revision=14343
* Update syntax of 'except' statements for compatibility with Python 3.Arfrever Frehtes Taifersar Arahesis2009-09-201-7/+7
| | | | | | (2to3-3.1 -f except -nw ${FILES}) svn path=/main/trunk/; revision=14289
* Use _encodings where appropriate.Zac Medico2009-08-211-6/+13
| | | | svn path=/main/trunk/; revision=14107
* Update imports to import portage.os (with unicode wrappers), and useZac Medico2009-08-111-6/+9
| | | | | | _unicode_encode() and _unicode_decode() where appropriate. svn path=/main/trunk/; revision=14002
* Use readlines() to optimize performance. Thanks to Marat RadchenkoZac Medico2009-07-191-1/+1
| | | | | | <slonopotamusorama@gmail.com> for this patch from bug #276813. svn path=/main/trunk/; revision=13834
* Assume utf_8 encoding in alls reads/writes (unicode handling required for py3k).Zac Medico2009-07-051-3/+6
| | | | svn path=/main/trunk/; revision=13791
* Implement _getitem instead of __getitem__ so that the base class __getitem__Zac Medico2009-03-081-19/+5
| | | | | | implementation is used for _mtime_ and _eclasses_ handling. svn path=/main/trunk/; revision=12781
* Fix __getitem__ to convert mtime to long, and remove unreachable codeZac Medico2009-03-071-8/+10
| | | | | | from _parse_data(). svn path=/main/trunk/; revision=12776
* Tweak exception handling indentation to avoid a bug in 2to3.Zac Medico2009-02-191-2/+4
| | | | svn path=/main/trunk/; revision=12646
* Bug #139134 - Make the flat_hash and metadata modules write the _mtime_Zac Medico2008-11-171-1/+2
| | | | | | | | | | field inside the file instead of mangling the mtime of the cache entry file. Also, fix FsBased._ensure_access() to properly skip the utime() call when no mtime is passed in. Theses cache changes are compatible with current stable portage (2.1.4.x), which uses the _mtime_ field contained in the file when available. svn path=/main/trunk/; revision=11984
* Make flat_hash write keys in alphabetical order.Zac Medico2008-09-261-7/+10
| | | | svn path=/main/trunk/; revision=11552
* Ensure that cache modules always return a dict containing the _eclasses_Zac Medico2008-09-251-0/+2
| | | | | | key. svn path=/main/trunk/; revision=11547
* In order to conserve some space, make _setitem() skip writing keys for whichZac Medico2008-08-071-0/+2
| | | | | | the value is empty. svn path=/main/trunk/; revision=11340
* Implement iterkeys on top of __iter__ instead of vice versa. Thanks to ↵Zac Medico2007-06-211-1/+1
| | | | | | Brian Harring for the suggestion. svn path=/main/trunk/; revision=6918
* Ignore non-existent directories for bug #171809. This is required for ↵Zac Medico2007-03-231-1/+9
| | | | | | readonly mode. svn path=/main/trunk/; revision=6265
* Namespace sanitizing, step 3Marius Mauch2007-01-251-3/+3
| | | | svn path=/main/trunk/; revision=5782
* Namespace sanitizing, step 1Marius Mauch2007-01-251-0/+120
svn path=/main/trunk/; revision=5778