From: Arfrever Frehtes Taifersar Arahesis Date: Fri, 9 Dec 2011 05:51:26 +0000 (+0100) Subject: Delete portage.dbapi.porttree._repo_info class and _repo_info attribute of X-Git-Tag: v2.2.0_alpha80~45 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=611268630be4349727b3bf39a1249953f04e3b7f;p=portage.git Delete portage.dbapi.porttree._repo_info class and _repo_info attribute of portage.dbapi.porttree.portdbapi objects. Migrate consumers to repositories attribute of portage.dbapi.porttree.portdbapi objects. --- diff --git a/bin/egencache b/bin/egencache index 3329a07ca..ba1f18873 100755 --- a/bin/egencache +++ b/bin/egencache @@ -203,7 +203,7 @@ class GenCache(object): # findname, cp_list, and cpv_list to the desired tree. tree = portdb.porttrees[0] self._portdb = portdb - self._eclass_db = portdb._repo_info[tree].eclass_db + self._eclass_db = portdb.repositories.get_repo_for_location(tree).eclass_db self._auxdbkeys = portdb._known_keys # We can globally cleanse stale cache only if we # iterate over every single cp. diff --git a/bin/repoman b/bin/repoman index 8f42a38d0..fc5000f7e 100755 --- a/bin/repoman +++ b/bin/repoman @@ -584,8 +584,8 @@ portdb = trees[root]['porttree'].dbapi # that are specified in layout.conf. repodir = os.path.realpath(portdir_overlay) repo_config = repoman_settings.repositories.get_repo_for_location(repodir) -repo_info = portdb._repo_info[repodir] -portdb.porttrees = list(repo_info.eclass_db.porttrees) +eclass_db = portdb.repositories.get_repo_for_location(repodir).eclass_db +portdb.porttrees = list(eclass_db.porttrees) portdir = portdb.porttrees[0] # In order to disable manifest signatures, repos may set @@ -673,7 +673,7 @@ logging.info('PORTDIR_OVERLAY = "%s"' % env['PORTDIR_OVERLAY']) env['FEATURES'] = env.get('FEATURES', '') + ' -unknown-features-warn' categories = [] -for path in repo_info.eclass_db.porttrees: +for path in eclass_db.porttrees: categories.extend(portage.util.grabfile( os.path.join(path, 'profiles', 'categories'))) repoman_settings.categories = frozenset( diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 54c97743d..b7b3b90e7 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1672,7 +1672,7 @@ def action_metadata(settings, portdb, myopts, porttrees=None): if src_db is not None: porttrees_data.append(TreeData(portdb.auxdb[path], - portdb._repo_info[path].eclass_db, path, src_db)) + portdb.repositories.get_repo_for_location(path).eclass_db, path, src_db)) porttrees = [tree_data.path for tree_data in porttrees_data] diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 94961dda1..e483edb93 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -46,15 +46,6 @@ if sys.hexversion >= 0x3000000: basestring = str long = int -class _repo_info(object): - __slots__ = ('name', 'path', 'eclass_db', 'portdir', 'portdir_overlay') - def __init__(self, name, path, eclass_db): - self.name = name - self.path = path - self.eclass_db = eclass_db - self.portdir = eclass_db.porttrees[0] - self.portdir_overlay = ' '.join(eclass_db.porttrees[1:]) - class portdbapi(dbapi): """this tree will scan a portage directory located at root (passed to init)""" portdbapi_instances = [] @@ -124,14 +115,6 @@ class portdbapi(dbapi): self.xcache = {} self.frozen = 0 - #Create eclass dbs - self._repo_info = {} - for repo in self.repositories: - if repo.location in self._repo_info: - continue - - self._repo_info[repo.location] = _repo_info(repo.name, repo.location, repo.eclass_db) - #Keep a list of repo names, sorted by priority (highest priority first). self._ordered_repo_name_list = tuple(reversed(self.repositories.prepos_order)) @@ -211,7 +194,7 @@ class portdbapi(dbapi): self._known_keys, readonly=True) if cache is not None: try: - cache.ec = self._repo_info[tree].eclass_db + cache.ec = self.repositories.get_repo_for_location(tree).eclass_db except AttributeError: pass return cache @@ -362,8 +345,7 @@ class portdbapi(dbapi): metadata = dict(i) if metadata.get("INHERITED", False): - metadata["_eclasses_"] = self._repo_info[repo_path - ].eclass_db.get_eclass_data(metadata["INHERITED"].split()) + metadata["_eclasses_"] = self.repositories.get_repo_for_location(repo_path).eclass_db.get_eclass_data(metadata["INHERITED"].split()) else: metadata["_eclasses_"] = {} @@ -423,7 +405,7 @@ class portdbapi(dbapi): if ro_auxdb is not None: auxdbs.append(ro_auxdb) auxdbs.append(self.auxdb[repo_path]) - eclass_db = self._repo_info[repo_path].eclass_db + eclass_db = self.repositories.get_repo_for_location(repo_path).eclass_db for auxdb in auxdbs: try: diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index e42d9a41c..4955c662b 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -239,11 +239,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, mysettings["FILESDIR"] = pkg_dir+"/files" mysettings["PF"] = mypv - if hasattr(mydbapi, '_repo_info'): - repo_info = mydbapi._repo_info[mytree] - mysettings['PORTDIR'] = repo_info.portdir - mysettings['PORTDIR_OVERLAY'] = repo_info.portdir_overlay - mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo_info.name + if hasattr(mydbapi, 'repositories'): + repo = mydbapi.repositories.get_repo_for_location(mytree) + mysettings['PORTDIR'] = repo.eclass_db.porttrees[0] + mysettings['PORTDIR_OVERLAY'] = ' '.join(repo.eclass_db.porttrees[1:]) + mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"]) mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"])