From: Zac Medico Date: Wed, 25 Oct 2006 02:36:00 +0000 (-0000) Subject: Improve reconstruct_eclasses error handling. X-Git-Tag: v2.1.2~554 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5919e8578c68f8eda4ec2f446a66d4477117c288;p=portage.git Improve reconstruct_eclasses error handling. svn path=/main/trunk/; revision=4814 --- 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