portage_plugin: use public portage 3.0.77 APIs
- Remove portage.const._ENABLE_SET_CONFIG = True (default True since portage 2.2+) - Replace portdbapi._aux_cache.clear() with flush_cache() only (redundant clear before new instance creation) - Replace vardbapi._clear_cache() with vardbapi.flush_cache() (public API) - Replace portdbapi._aux_cache_keys with portage.auxdbkeys (public module-level tuple) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -608,8 +608,6 @@ class PortagePlugin(SpmPlugin):
|
||||
|
||||
# importing portage stuff
|
||||
import portage.const
|
||||
# Portage 2.1.9x, enable package sets for overlay.
|
||||
portage.const._ENABLE_SET_CONFIG = True
|
||||
import portage
|
||||
import portage.util
|
||||
self._portage = portage
|
||||
@@ -652,9 +650,7 @@ class PortagePlugin(SpmPlugin):
|
||||
del sys.modules[key]
|
||||
# now reimport everything
|
||||
|
||||
# Portage 2.1.9x, enable package sets for overlay.
|
||||
import portage.const
|
||||
portage.const._ENABLE_SET_CONFIG = True
|
||||
import portage
|
||||
import portage.util
|
||||
# reassign portage variable, pointing to a fresh object
|
||||
@@ -668,15 +664,13 @@ class PortagePlugin(SpmPlugin):
|
||||
dbapi = tree.dbapi
|
||||
|
||||
dbapi.melt()
|
||||
dbapi._aux_cache.clear()
|
||||
dbapi.flush_cache()
|
||||
tree.dbapi = portage.dbapi.porttree.portdbapi(
|
||||
mysettings=dbapi.settings)
|
||||
|
||||
for root, tree in list(PortagePlugin.CACHE['vartree'].items()):
|
||||
dbapi = tree.dbapi
|
||||
if hasattr(dbapi, "_clear_cache"):
|
||||
dbapi._clear_cache()
|
||||
dbapi.flush_cache()
|
||||
|
||||
gc.collect()
|
||||
|
||||
@@ -699,17 +693,8 @@ class PortagePlugin(SpmPlugin):
|
||||
"""
|
||||
Reimplemented from SpmPlugin class.
|
||||
"""
|
||||
# return what's inside vartree because it's more complete
|
||||
dbapi = self._get_portage_vartree().dbapi
|
||||
if hasattr(dbapi, '_aux_cache_keys'):
|
||||
return list(dbapi._aux_cache_keys)
|
||||
|
||||
sys.stderr.write("PortagePlugin: missing vardb._aux_cache_keys !\n")
|
||||
return ["CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
|
||||
"EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
|
||||
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
|
||||
"BDEPEND", "repository", "RESTRICT", "SLOT", "USE"
|
||||
]
|
||||
# return all portage metadata keys (public module-level tuple)
|
||||
return list(self._portage.auxdbkeys)
|
||||
|
||||
def get_cache_directory(self, root = None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user