diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-10-25 02:36:00 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-10-25 02:36:00 +0000 |
commit | 5919e8578c68f8eda4ec2f446a66d4477117c288 (patch) | |
tree | f95212a17a278b2732b28004eb07b6389bd4c4c8 | |
parent | 866ed9e73c14c8bc26a8899a861aa789ab7e3d40 (diff) | |
download | portage-5919e8578c68f8eda4ec2f446a66d4477117c288.tar.gz portage-5919e8578c68f8eda4ec2f446a66d4477117c288.tar.bz2 portage-5919e8578c68f8eda4ec2f446a66d4477117c288.zip |
Improve reconstruct_eclasses error handling.
svn path=/main/trunk/; revision=4814
-rw-r--r-- | pym/cache/template.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/pym/cache/template.py b/pym/cache/template.py index 547490e29..1e3c9abe8 100644 --- a/pym/cache/template.py +++ b/pym/cache/template.py @@ -170,16 +170,15 @@ def reconstruct_eclasses(cpv, eclass_string): if len(eclasses) % 2 != 0 and len(eclasses) % 3 != 0: raise cache_errors.CacheCorruption(cpv, "_eclasses_ was of invalid len %i" % len(eclasses)) d={} - has_paths = False try: - long(eclasses[1]) + if eclasses[1].isdigit(): + for x in xrange(0, len(eclasses), 2): + d[eclasses[x]] = long(eclasses[x + 1]) + else: + # The old format contains paths that will be discarded. + for x in xrange(0, len(eclasses), 3): + d[eclasses[x]] = long(eclasses[x + 2]) except ValueError: - has_paths = True - if has_paths: - for x in range(0, len(eclasses), 3): - d[eclasses[x]] = long(eclasses[x + 2]) - else: - for x in range(0, len(eclasses), 2): - d[eclasses[x]] = long(eclasses[x + 1]) + raise cache_errors.CacheCorruption(cpv, "_eclasses_ mtime conversion to long failed") del eclasses return d |