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/cache/, pym/portage/repository/
@ 2011-09-30 17:38 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2011-09-30 17:38 UTC (permalink / raw
  To: gentoo-commits

commit:     a72a01746638debe472496bd8fc661992a6ba08b
Author:     Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Fri Sep 30 09:37:04 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 30 17:32:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a72a0174

layout.conf: allow a repository to state the cache is authorative

By authorative, this means "the cache is accurate; skip validation".  While
a useful hint for a slight speedup in validation, the true gain is for
repositories that are distributed in a fashion that doesn't preserve mtime;
git primarily.  Setting authorative-cache = true results in portage
skipping mtime validation checks for the bundled cache, allowing
for git vcs based repos to distribute a cache.

BUG=chromium-os:21049
TEST=dump a cache into metadata/cache, touch it to now, set layout.conf
     to authorative-cache=true, verify it doesn't generate cache entries
     for that repo.

Change-Id: I92423e679bc171d2411a18d6d3ac22e8ef457753

---
 pym/portage/cache/template.py    |    1 +
 pym/portage/dbapi/porttree.py    |   15 +++++++++------
 pym/portage/repository/config.py |    4 +++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py
index f84d8f4..4cb27bf 100644
--- a/pym/portage/cache/template.py
+++ b/pym/portage/cache/template.py
@@ -30,6 +30,7 @@ class database(object):
 		self.readonly = readonly
 		self.sync_rate = 0
 		self.updates = 0
+		self.is_authorative = False
 	
 	def __getitem__(self, cpv):
 		"""set a cpv to values

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index e679f00..ab38247 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -215,10 +215,12 @@ class portdbapi(dbapi):
 				if x in self._pregen_auxdb:
 					continue
 				if os.path.isdir(os.path.join(x, "metadata", "cache")):
-					self._pregen_auxdb[x] = self.metadbmodule(
+					conf = self.repositories.get_repo_for_location(x)
+					cache = self._pregen_auxdb[x] = self.metadbmodule(
 						x, "metadata/cache", filtered_auxdbkeys, readonly=True)
+					cache.is_authorative = conf.cache_is_authorative
 					try:
-						self._pregen_auxdb[x].ec = self._repo_info[x].eclass_db
+						cache.ec = self._repo_info[x].eclass_db
 					except AttributeError:
 						pass
 		# Selectively cache metadata in order to optimize dep matching.
@@ -441,10 +443,11 @@ class portdbapi(dbapi):
 				eapi = metadata.get('EAPI', '').strip()
 				if not eapi:
 					eapi = '0'
-				if not (eapi[:1] == '-' and eapi_is_supported(eapi[1:])) and \
-					emtime == metadata['_mtime_'] and \
-					eclass_db.is_eclass_data_valid(metadata['_eclasses_']):
-					doregen = False
+				if not (eapi[:1] == '-' and eapi_is_supported(eapi[1:])):
+					if auxdb.is_authorative or ( \
+						emtime == metadata['_mtime_'] and \
+						eclass_db.is_eclass_data_valid(metadata['_eclasses_'])):
+						doregen = False
 
 			if not doregen:
 				break

diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index 3cb5501..6924450 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -43,7 +43,7 @@ class RepoConfig(object):
 
 	__slots__ = ['aliases', 'eclass_overrides', 'eclass_locations', 'location', 'user_location', 'masters', 'main_repo',
 		'missing_repo_name', 'name', 'priority', 'sync', 'format', 'sign_manifest', 'thin_manifest',
-		'allow_missing_manifest', 'create_manifest', 'disable_manifest']
+		'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authorative']
 
 	def __init__(self, name, repo_opts):
 		"""Build a RepoConfig with options in repo_opts
@@ -117,6 +117,7 @@ class RepoConfig(object):
 		self.allow_missing_manifest = False
 		self.create_manifest = True
 		self.disable_manifest = False
+		self.cache_is_authorative = False
 
 	def load_manifest(self, *args, **kwds):
 		kwds['thin'] = self.thin_manifest
@@ -357,6 +358,7 @@ class RepoConfigLoader(object):
 			repo.allow_missing_manifest = manifest_policy != 'strict'
 			repo.create_manifest = manifest_policy != 'false'
 			repo.disable_manifest = manifest_policy == 'false'
+			repo.cache_is_authorative = layout_data.get('authorative-cache', 'false').lower() == 'true'
 
 		#Take aliases into account.
 		new_prepos = {}



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/cache/, pym/portage/repository/
@ 2011-09-30 19:08 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2011-09-30 19:08 UTC (permalink / raw
  To: gentoo-commits

commit:     ed3b2b43aa329d007f7bb0eb303b3f74e927970a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 30 19:08:31 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 30 19:08:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ed3b2b43

Fix 'authoritative' spelling.

---
 pym/portage/cache/template.py    |    2 +-
 pym/portage/dbapi/porttree.py    |    4 ++--
 pym/portage/repository/config.py |    6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py
index 4cb27bf..8476836 100644
--- a/pym/portage/cache/template.py
+++ b/pym/portage/cache/template.py
@@ -30,7 +30,7 @@ class database(object):
 		self.readonly = readonly
 		self.sync_rate = 0
 		self.updates = 0
-		self.is_authorative = False
+		self.is_authoritative = False
 	
 	def __getitem__(self, cpv):
 		"""set a cpv to values

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index ab38247..911dbb5 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -218,7 +218,7 @@ class portdbapi(dbapi):
 					conf = self.repositories.get_repo_for_location(x)
 					cache = self._pregen_auxdb[x] = self.metadbmodule(
 						x, "metadata/cache", filtered_auxdbkeys, readonly=True)
-					cache.is_authorative = conf.cache_is_authorative
+					cache.is_authoritative = conf.cache_is_authoritative
 					try:
 						cache.ec = self._repo_info[x].eclass_db
 					except AttributeError:
@@ -444,7 +444,7 @@ class portdbapi(dbapi):
 				if not eapi:
 					eapi = '0'
 				if not (eapi[:1] == '-' and eapi_is_supported(eapi[1:])):
-					if auxdb.is_authorative or ( \
+					if auxdb.is_authoritative or ( \
 						emtime == metadata['_mtime_'] and \
 						eclass_db.is_eclass_data_valid(metadata['_eclasses_'])):
 						doregen = False

diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index 6924450..424b89d 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -43,7 +43,7 @@ class RepoConfig(object):
 
 	__slots__ = ['aliases', 'eclass_overrides', 'eclass_locations', 'location', 'user_location', 'masters', 'main_repo',
 		'missing_repo_name', 'name', 'priority', 'sync', 'format', 'sign_manifest', 'thin_manifest',
-		'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authorative']
+		'allow_missing_manifest', 'create_manifest', 'disable_manifest', 'cache_is_authoritative']
 
 	def __init__(self, name, repo_opts):
 		"""Build a RepoConfig with options in repo_opts
@@ -117,7 +117,7 @@ class RepoConfig(object):
 		self.allow_missing_manifest = False
 		self.create_manifest = True
 		self.disable_manifest = False
-		self.cache_is_authorative = False
+		self.cache_is_authoritative = False
 
 	def load_manifest(self, *args, **kwds):
 		kwds['thin'] = self.thin_manifest
@@ -358,7 +358,7 @@ class RepoConfigLoader(object):
 			repo.allow_missing_manifest = manifest_policy != 'strict'
 			repo.create_manifest = manifest_policy != 'false'
 			repo.disable_manifest = manifest_policy == 'false'
-			repo.cache_is_authorative = layout_data.get('authorative-cache', 'false').lower() == 'true'
+			repo.cache_is_authoritative = layout_data.get('authoritative-cache', 'false').lower() == 'true'
 
 		#Take aliases into account.
 		new_prepos = {}



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/cache/, pym/portage/repository/
@ 2011-10-13 21:31 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2011-10-13 21:31 UTC (permalink / raw
  To: gentoo-commits

commit:     5c7bf4eb09f644813a6f017ffd91665664142560
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 13 21:27:03 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Oct 13 21:27:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5c7bf4eb

layout.conf: revert authoritative-cache support

Those who wanted it have decided to use a different approach.

---
 pym/portage/cache/template.py    |    1 -
 pym/portage/dbapi/porttree.py    |   10 ++++------
 pym/portage/repository/config.py |   27 ++-------------------------
 3 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py
index 8476836..f84d8f4 100644
--- a/pym/portage/cache/template.py
+++ b/pym/portage/cache/template.py
@@ -30,7 +30,6 @@ class database(object):
 		self.readonly = readonly
 		self.sync_rate = 0
 		self.updates = 0
-		self.is_authoritative = False
 	
 	def __getitem__(self, cpv):
 		"""set a cpv to values

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 911dbb5..ef2e088 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -218,7 +218,6 @@ class portdbapi(dbapi):
 					conf = self.repositories.get_repo_for_location(x)
 					cache = self._pregen_auxdb[x] = self.metadbmodule(
 						x, "metadata/cache", filtered_auxdbkeys, readonly=True)
-					cache.is_authoritative = conf.cache_is_authoritative
 					try:
 						cache.ec = self._repo_info[x].eclass_db
 					except AttributeError:
@@ -443,11 +442,10 @@ class portdbapi(dbapi):
 				eapi = metadata.get('EAPI', '').strip()
 				if not eapi:
 					eapi = '0'
-				if not (eapi[:1] == '-' and eapi_is_supported(eapi[1:])):
-					if auxdb.is_authoritative or ( \
-						emtime == metadata['_mtime_'] and \
-						eclass_db.is_eclass_data_valid(metadata['_eclasses_'])):
-						doregen = False
+				if not (eapi[:1] == '-' and eapi_is_supported(eapi[1:])) and \
+					emtime == metadata['_mtime_'] and \
+					eclass_db.is_eclass_data_valid(metadata['_eclasses_']):
+					doregen = False
 
 			if not doregen:
 				break

diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index 8f55177..2490b65 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -44,11 +44,11 @@ class RepoConfig(object):
 	"""Stores config of one repository"""
 
 	__slots__ = ('aliases', 'allow_missing_manifest',
-		'cache_is_authoritative', 'create_manifest', 'disable_manifest',
+		'create_manifest', 'disable_manifest',
 		'eclass_overrides', 'eclass_locations', 'format', 'location',
 		'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name',
 		'name', 'priority', 'sign_manifest', 'sync', 'thin_manifest',
-		'trust_authoritative_cache', 'user_location')
+		'user_location')
 
 	def __init__(self, name, repo_opts):
 		"""Build a RepoConfig with options in repo_opts
@@ -127,13 +127,6 @@ class RepoConfig(object):
 		self.disable_manifest = False
 		self.manifest_hashes = None
 
-		self.cache_is_authoritative = False
-
-		trust_authoritative_cache = repo_opts.get('trust-authoritative-cache')
-		if trust_authoritative_cache is not None:
-			trust_authoritative_cache = trust_authoritative_cache.lower() == 'true'
-		self.trust_authoritative_cache = trust_authoritative_cache
-
 	def load_manifest(self, *args, **kwds):
 		kwds['thin'] = self.thin_manifest
 		kwds['allow_missing'] = self.allow_missing_manifest
@@ -151,8 +144,6 @@ class RepoConfig(object):
 			self.eclass_overrides = new_repo.eclass_overrides
 		if new_repo.masters is not None:
 			self.masters = new_repo.masters
-		if new_repo.trust_authoritative_cache is not None:
-			self.trust_authoritative_cache = new_repo.trust_authoritative_cache
 		if new_repo.name is not None:
 			self.name = new_repo.name
 			self.missing_repo_name = new_repo.missing_repo_name
@@ -240,11 +231,6 @@ class RepoConfigLoader(object):
 		if prepos['DEFAULT'].masters is not None:
 			default_repo_opts['masters'] = \
 				' '.join(prepos['DEFAULT'].masters)
-		if prepos['DEFAULT'].trust_authoritative_cache is not None:
-			if prepos['DEFAULT'].trust_authoritative_cache:
-				default_repo_opts['trust-authoritative-cache'] = 'true'
-			else:
-				default_repo_opts['trust-authoritative-cache'] = 'false'
 
 		if overlays:
 			#overlay priority is negative because we want them to be looked before any other repo
@@ -265,11 +251,6 @@ class RepoConfigLoader(object):
 						if repo_conf_opts.masters is not None:
 							repo_opts['masters'] = \
 								' '.join(repo_conf_opts.masters)
-						if repo_conf_opts.trust_authoritative_cache is not None:
-							if repo_conf_opts.trust_authoritative_cache:
-								repo_opts['trust-authoritative-cache'] = 'true'
-							else:
-								repo_opts['trust-authoritative-cache'] = 'false'
 
 					repo = RepoConfig(repo.name, repo_opts)
 					if repo.name in prepos:
@@ -425,10 +406,6 @@ class RepoConfigLoader(object):
 						DeprecationWarning)
 			repo.manifest_hashes = manifest_hashes
 
-			repo.cache_is_authoritative = layout_data.get('authoritative-cache', 'false').lower() == 'true'
-			if not repo.trust_authoritative_cache:
-				repo.cache_is_authoritative = False
-
 		#Take aliases into account.
 		new_prepos = {}
 		for repo_name, repo in prepos.items():



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-13 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 17:38 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/cache/, pym/portage/repository/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-09-30 19:08 Zac Medico
2011-10-13 21:31 Zac Medico

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