owners_cache: fix EPREFIX miscalculation
authorZac Medico <zmedico@gentoo.org>
Tue, 1 Mar 2011 21:04:41 +0000 (13:04 -0800)
committerZac Medico <zmedico@gentoo.org>
Tue, 1 Mar 2011 21:04:41 +0000 (13:04 -0800)
This reverts commit 43e0b3ea4289aab9b4258d29d06afac40abd6c01 and
renames the root_len variable to eroot_len (for clarity).

pym/portage/dbapi/vartree.py

index 845a5c3b2130aaa432fc85fece9e838ada88a420..af3b5d948042ebff9f3226b613bc73cecb31b311 100644 (file)
@@ -815,11 +815,9 @@ class vardbapi(dbapi):
 
                def __init__(self, vardb):
                        self._vardb = vardb
-                       self._eprefix_split_len = len(x for x in \
-                               vardb.settings["EPREFIX"].split(os.sep) if x)
 
                def add(self, cpv):
-                       root_len = len(self._vardb._eroot)
+                       eroot_len = len(self._vardb._eroot)
                        contents = self._vardb._dblink(cpv).getcontents()
                        pkg_hash = self._hash_pkg(cpv)
                        if not contents:
@@ -831,12 +829,12 @@ class vardbapi(dbapi):
                        # explicitly listed in CONTENTS.
                        added_paths = set()
                        for x in contents:
-                               x = x[root_len:]
+                               x = x[eroot_len:]
                                added_paths.add(x)
                                self._add_path(x, pkg_hash)
                                x_split = x.split(os.sep)
                                x_split.pop()
-                               while len(x_split) > self._eprefix_split_len:
+                               while x_split:
                                        parent = os.sep.join(x_split)
                                        if parent in added_paths:
                                                break