diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-05-12 02:25:39 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-05-12 02:32:31 -0700 |
commit | f75f2f3169a63e8b39cea1087e099e176d90e20e (patch) | |
tree | 19a18973328229c3163813b4b07b995298a2bd7f /pym/portage/dbapi | |
parent | catpkgsplit: don't cache results (diff) | |
download | portage-f75f2f3169a63e8b39cea1087e099e176d90e20e.tar.gz portage-f75f2f3169a63e8b39cea1087e099e176d90e20e.tar.bz2 portage-f75f2f3169a63e8b39cea1087e099e176d90e20e.zip |
Add a _pkg_str class to cache catpkgsplit results
This will compensate for the removal of the catpkgsplit cache in commit
68888b0450b1967cb70673a5f06b04c167ef879c.
Diffstat (limited to 'pym/portage/dbapi')
-rw-r--r-- | pym/portage/dbapi/bintree.py | 6 | ||||
-rw-r--r-- | pym/portage/dbapi/porttree.py | 4 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 12 |
3 files changed, 14 insertions, 8 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 810163d0f..52b85b88e 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -16,7 +16,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.util:atomic_ofstream,ensure_dirs,normalize_path,' + \ 'writemsg,writemsg_stdout', 'portage.util.listdir:listdir', - 'portage.versions:best,catpkgsplit,catsplit', + 'portage.versions:best,catpkgsplit,catsplit,_pkg_str', ) from portage.cache.mappings import slot_dict_class @@ -236,7 +236,7 @@ def _pkgindex_cpv_map_latest_build(pkgindex): if other_btime and (not btime or other_btime > btime): continue - cpv_map[cpv] = d + cpv_map[_pkg_str(cpv)] = d return cpv_map @@ -658,6 +658,7 @@ class binarytree(object): if mycpv in pkg_paths: # discard duplicates (All/ is preferred) continue + mycpv = _pkg_str(mycpv) pkg_paths[mycpv] = mypath # update the path if the package has been moved oldpath = d.get("PATH") @@ -733,6 +734,7 @@ class binarytree(object): (mycpv, self.settings["PORTAGE_CONFIGROOT"]), noiselevel=-1) continue + mycpv = _pkg_str(mycpv) pkg_paths[mycpv] = mypath self.dbapi.cpv_inject(mycpv) update_pkgindex = True diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index f348a1529..663b62dc3 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -14,7 +14,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.package.ebuild.doebuild:doebuild', 'portage.util:ensure_dirs,shlex_split,writemsg,writemsg_level', 'portage.util.listdir:listdir', - 'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp', + 'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp,_pkg_str', ) from portage.cache import volatile @@ -708,7 +708,7 @@ class portdbapi(dbapi): writemsg(_("\nInvalid ebuild version: %s\n") % \ os.path.join(oroot, mycp, x), noiselevel=-1) continue - d[mysplit[0]+"/"+pf] = None + d[_pkg_str(mysplit[0]+"/"+pf)] = None if invalid_category and d: writemsg(_("\n!!! '%s' has a category that is not listed in " \ "%setc/portage/categories\n") % \ diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 158fc4a02..fe352c5f8 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -31,7 +31,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry', 'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap', 'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,pkgcmp,' + \ - '_pkgsplit@pkgsplit', + '_pkgsplit@pkgsplit,_pkg_str', 'subprocess', 'tarfile', ) @@ -87,6 +87,9 @@ except ImportError: if sys.hexversion >= 0x3000000: basestring = str long = int + _unicode = str +else: + _unicode = unicode class vardbapi(dbapi): @@ -386,7 +389,7 @@ class vardbapi(dbapi): continue if len(mysplit) > 1: if ps[0] == mysplit[1]: - returnme.append(mysplit[0]+"/"+x) + returnme.append(_pkg_str(mysplit[0]+"/"+x)) self._cpv_sort_ascending(returnme) if use_cache: self.cpcache[mycp] = [mystat, returnme[:]] @@ -680,7 +683,8 @@ class vardbapi(dbapi): cache_data.update(metadata) for aux_key in cache_these: cache_data[aux_key] = mydata[aux_key] - self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data) + self._aux_cache["packages"][_unicode(mycpv)] = \ + (mydir_mtime, cache_data) self._aux_cache["modified"].add(mycpv) if _slot_re.match(mydata['SLOT']) is None: @@ -1059,7 +1063,7 @@ class vardbapi(dbapi): counter = int(counter) except ValueError: counter = 0 - return (cpv, counter, mtime) + return (_unicode(cpv), counter, mtime) class _owners_db(object): |