public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/repository/
@ 2011-12-09  4:45 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; only message in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-12-09  4:45 UTC (permalink / raw
  To: gentoo-commits

commit:     4e87ba4eb94c0ad1615c9926650a8925d5688393
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Fri Dec  9 04:43:20 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Fri Dec  9 04:43:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4e87ba4e

Add eclass_db attribute in portage.repository.config.RepoConfig objects.

---
 pym/portage/dbapi/porttree.py    |   16 ++--------------
 pym/portage/repository/config.py |   24 +++++++++++++++++++++---
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 15f1faf..94961dd 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -111,7 +111,7 @@ class portdbapi(dbapi):
 					":".join(filter(None, sandbox_write))
 
 		self.porttrees = list(self.settings.repositories.repoLocationList())
-		self.eclassdb = eclass_cache.cache(self.settings.repositories.mainRepoLocation())
+		self.eclassdb = self.repositories.mainRepo().eclass_db
 
 		# This is used as sanity check for aux_get(). If there is no
 		# root eclass dir, we assume that PORTDIR is invalid or
@@ -126,23 +126,11 @@ class portdbapi(dbapi):
 
 		#Create eclass dbs
 		self._repo_info = {}
-		eclass_dbs = {self.settings.repositories.mainRepoLocation() : self.eclassdb}
 		for repo in self.repositories:
 			if repo.location in self._repo_info:
 				continue
 
-			eclass_db = None
-			for eclass_location in repo.eclass_locations:
-				tree_db = eclass_dbs.get(eclass_location)
-				if tree_db is None:
-					tree_db = eclass_cache.cache(eclass_location)
-					eclass_dbs[eclass_location] = tree_db
-				if eclass_db is None:
-					eclass_db = tree_db.copy()
-				else:
-					eclass_db.append(tree_db)
-
-			self._repo_info[repo.location] = _repo_info(repo.name, repo.location, eclass_db)
+			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))

diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index ed0f64d..4a8d866 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -15,7 +15,7 @@ try:
 		from configparser import SafeConfigParser
 except ImportError:
 	from ConfigParser import SafeConfigParser, ParsingError
-from portage import os
+from portage import eclass_cache, os
 from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH,
 	REPO_NAME_LOC, USER_CONFIG_PATH)
 from portage.env.loaders import KeyValuePairFileLoader
@@ -47,7 +47,7 @@ class RepoConfig(object):
 
 	__slots__ = ('aliases', 'allow_missing_manifest',
 		'cache_formats', 'create_manifest', 'disable_manifest',
-		'eclass_overrides', 'eclass_locations', 'format', 'location',
+		'eclass_db', 'eclass_locations', 'eclass_overrides', 'format', 'location',
 		'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name',
 		'name', 'priority', 'sign_manifest', 'sync', 'thin_manifest',
 		'update_changelog', 'user_location', 'portage1_profiles',
@@ -66,7 +66,8 @@ class RepoConfig(object):
 		if eclass_overrides is not None:
 			eclass_overrides = tuple(eclass_overrides.split())
 		self.eclass_overrides = eclass_overrides
-		#Locations are computed later.
+		# Eclass databases and locations are computed later.
+		self.eclass_db = None
 		self.eclass_locations = None
 
 		# Masters from repos.conf override layout.conf.
@@ -543,6 +544,23 @@ class RepoConfigLoader(object):
 							level=logging.ERROR, noiselevel=-1)
 			repo.eclass_locations = tuple(eclass_locations)
 
+		eclass_dbs = {}
+		for repo_name, repo in prepos.items():
+			if repo_name == "DEFAULT":
+				continue
+
+			eclass_db = None
+			for eclass_location in repo.eclass_locations:
+				tree_db = eclass_dbs.get(eclass_location)
+				if tree_db is None:
+					tree_db = eclass_cache.cache(eclass_location)
+					eclass_dbs[eclass_location] = tree_db
+				if eclass_db is None:
+					eclass_db = tree_db.copy()
+				else:
+					eclass_db.append(tree_db)
+			repo.eclass_db = eclass_db
+
 		self._prepos_changed = True
 		self._repo_location_list = []
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-09  4:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09  4:45 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/repository/ Arfrever Frehtes Taifersar Arahesis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox