public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-04 20:03 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-04 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     0bae81245b1700dd74369aeabf6c0c7c9269ee51
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May  3 03:00:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May  4 19:54:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0bae8124

cpv_expand: avoid old-style virtual code

This allows portageq calls to avoid loading vdb_metadata.pickle in
most cases, which greatly improves performance.

---
 pym/portage/dbapi/cpv_expand.py |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/pym/portage/dbapi/cpv_expand.py b/pym/portage/dbapi/cpv_expand.py
index c42e427..9ce0d3d 100644
--- a/pym/portage/dbapi/cpv_expand.py
+++ b/pym/portage/dbapi/cpv_expand.py
@@ -17,8 +17,6 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
 	mysplit = _pkgsplit(myslash[-1])
 	if settings is None:
 		settings = globals()["settings"]
-	virts = settings.getvirtuals()
-	virts_p = settings.get_virts_p()
 	if len(myslash)>2:
 		# this is illegal case.
 		mysplit=[]
@@ -28,24 +26,21 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
 			mykey=myslash[0]+"/"+mysplit[0]
 		else:
 			mykey=mycpv
-		if mydb and virts and mykey in virts:
-			writemsg("mydb.__class__: %s\n" % (mydb.__class__), 1)
-			if hasattr(mydb, "cp_list"):
-				if not mydb.cp_list(mykey, use_cache=use_cache):
-					writemsg("virts[%s]: %s\n" % (str(mykey),virts[mykey]), 1)
-					mykey_orig = mykey[:]
-					for vkey in virts[mykey]:
+		if hasattr(mydb, "cp_list") and \
+			not mydb.cp_list(mykey, use_cache=use_cache):
+				virts = settings.getvirtuals().get(mykey)
+				if virts:
+					mykey_orig = mykey
+					for vkey in virts:
 						# The virtuals file can contain a versioned atom, so
 						# it may be necessary to remove the operator and
 						# version from the atom before it is passed into
 						# dbapi.cp_list().
 						if mydb.cp_list(vkey.cp):
 							mykey = str(vkey)
-							writemsg(_("virts chosen: %s\n") % (mykey), 1)
 							break
 					if mykey == mykey_orig:
-						mykey = str(virts[mykey][0])
-						writemsg(_("virts defaulted: %s\n") % (mykey), 1)
+						mykey = str(virts[0])
 			#we only perform virtual expansion if we are passed a dbapi
 	else:
 		#specific cpv, no category, ie. "foo-1.0"
@@ -81,8 +76,9 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
 			mykey=matches[0]
 
 		if not mykey and not isinstance(mydb, list):
-			if myp in virts_p:
-				mykey=virts_p[myp][0]
+			virts_p = settings.get_virts_p().get(myp)
+			if virts_p:
+				mykey = virts_p[0]
 			#again, we only perform virtual expansion if we have a dbapi (not a list)
 		if not mykey:
 			mykey="null/"+myp



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-27  2:56 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-27  2:56 UTC (permalink / raw
  To: gentoo-commits

commit:     59835b2473cad2981ffe5e3fde9badf3a0c08af6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 27 02:55:28 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri May 27 02:55:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=59835b24

dblink.merge: populate vardbapi cache for new pkg

This is similar to commit 4b5ab00fd0fd08af8c9075acdbb3921cf39d41a3 from
the master branch, but in this branch it doesn't fit in MergeProcess.

---
 pym/portage/dbapi/vartree.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index f93652b..b8daa3e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -4092,6 +4092,14 @@ class dblink(object):
 							self, mydbapi, myebuild, "clean")
 
 		finally:
+
+			# Populate the vardbapi cache for the new package
+			# while its inodes are still hot.
+			try:
+				self.vartree.dbapi.aux_get(self.mycpv, ["EAPI"])
+			except KeyError:
+				pass
+
 			self.settings.pop('REPLACING_VERSIONS', None)
 			if self.vartree.dbapi._linkmap is None:
 				# preserve-libs is entirely disabled



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-27  2:16 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-27  2:16 UTC (permalink / raw
  To: gentoo-commits

commit:     c71146ee4ae7c9c9c15a17de6bd8f3abf376d1d6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 27 02:14:20 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri May 27 02:16:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c71146ee

counter_tick_core: flush the cache (periodically)

Since we hold a lock, this is a good opportunity to flush the cache.
Note that this will only flush the cache periodically in the main
process when _aux_cache_threshold is exceeded.

---
 pym/portage/dbapi/vartree.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 0ff2f7d..f93652b 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -798,6 +798,12 @@ class vardbapi(dbapi):
 					self.settings._init_dirs()
 					write_atomic(self._counter_path, str(counter))
 			self._cached_counter = counter
+
+			# Since we hold a lock, this is a good opportunity
+			# to flush the cache. Note that this will only
+			# flush the cache periodically in the main process
+			# when _aux_cache_threshold is exceeded.
+			self.flush_cache()
 		finally:
 			self.unlock()
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-27  0:05 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-27  0:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a18beb8fba56bfb21478d954e9b8f5dcce1a2c5d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 27 00:00:22 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri May 27 00:05:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a18beb8f

unmerge: remove redundant builddir_locked var

---
 pym/portage/dbapi/vartree.py |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 5394895..0ff2f7d 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1642,19 +1642,17 @@ class dblink(object):
 		self._prune_plib_registry(unmerge=True, needed=needed,
 			preserve_paths=preserve_paths)
 
-		builddir_locked = "PORTAGE_BUILDIR_LOCKED" in self.settings
 		builddir_lock = None
 		scheduler = self._scheduler
 		retval = os.EX_OK
 		try:
 			# Only create builddir_lock if the caller
 			# has not already acquired the lock.
-			if not builddir_locked:
+			if "PORTAGE_BUILDIR_LOCKED" not in self.settings:
 				builddir_lock = EbuildBuildDir(
 					scheduler=(scheduler or PollScheduler().sched_iface),
 					settings=self.settings)
 				builddir_lock.lock()
-				builddir_locked = True
 				prepare_build_dirs(settings=self.settings, cleanup=True)
 				log_path = self.settings.get("PORTAGE_LOG_FILE")
 
@@ -1700,8 +1698,7 @@ class dblink(object):
 
 		finally:
 			self.vartree.dbapi._bump_mtime(self.mycpv)
-			if builddir_locked:
-				try:
+			try:
 					if not eapi_unsupported and os.path.isfile(myebuildpath):
 						if retval != os.EX_OK:
 							msg_lines = []
@@ -1745,7 +1742,7 @@ class dblink(object):
 						elog_process(self.mycpv, self.settings,
 							phasefilter=('prerm', 'postrm'))
 
-					if retval == os.EX_OK and builddir_locked:
+					if retval == os.EX_OK:
 						try:
 							doebuild_environment(myebuildpath, "cleanrm",
 								settings=self.settings, db=self.vartree.dbapi)
@@ -1757,7 +1754,7 @@ class dblink(object):
 							scheduler.dblinkEbuildPhase(
 								self, self.vartree.dbapi,
 								myebuildpath, "cleanrm")
-				finally:
+			finally:
 					if builddir_lock is not None:
 						builddir_lock.unlock()
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     ea942032976b5bfa9673d650726bcbeab8414583
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 26 01:37:55 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ea942032

counter_tick: respect incrementing param always

Every package install must have a unique counter, since a slotmove
update can move two packages into the same SLOT and in that case it's
important that both packages have different COUNTER metadata.

---
 pym/portage/dbapi/vartree.py |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4c7dd14..b75d69a 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -773,27 +773,31 @@ class vardbapi(dbapi):
 	def counter_tick_core(self, myroot=None, incrementing=1, mycpv=None):
 		"""
 		This method will grab the next COUNTER value and record it back
-		to the global file.  Returns new counter value.
+		to the global file. Note that every package install must have
+		a unique counter, since a slotmove update can move two packages
+		into the same SLOT and in that case it's important that both
+		packages have different COUNTER metadata.
 
 		@param myroot: ignored, self._eroot is used instead
 		@param mycpv: ignored
+		@rtype: int
+		@returns: new counter value
 		"""
 		myroot = None
 		mycpv = None
 		self.lock()
 		try:
 			counter = self.get_counter_tick_core() - 1
-			if self._cached_counter != counter:
-				if incrementing:
-					#increment counter
-					counter += 1
-					# update new global counter file
-					try:
-						write_atomic(self._counter_path, str(counter))
-					except InvalidLocation:
-						self.settings._init_dirs()
-						write_atomic(self._counter_path, str(counter))
-				self._cached_counter = counter
+			if incrementing:
+				#increment counter
+				counter += 1
+				# update new global counter file
+				try:
+					write_atomic(self._counter_path, str(counter))
+				except InvalidLocation:
+					self.settings._init_dirs()
+					write_atomic(self._counter_path, str(counter))
+			self._cached_counter = counter
 		finally:
 			self.unlock()
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     318b20fcd16111a51dd2e91be3772de8287740d5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 26 00:57:05 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=318b20fc

unmerge: fix logging for unsupported EAPI

---
 pym/portage/dbapi/vartree.py |   51 +++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index b257aac..4c7dd14 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1623,37 +1623,48 @@ class dblink(object):
 					write_atomic(os.path.join(self.dbdir, "PF"), self.pkg+"\n")
 				break
 
-		self.settings.setcpv(self.mycpv, mydb=self.vartree.dbapi)
-		if myebuildpath:
-			try:
-				doebuild_environment(myebuildpath, "prerm",
-					settings=self.settings, db=self.vartree.dbapi)
-			except UnsupportedAPIException as e:
-				failures += 1
-				# Sometimes this happens due to corruption of the EAPI file.
-				showMessage(_("!!! FAILED prerm: %s\n") % \
-					os.path.join(self.dbdir, "EAPI"),
-					level=logging.ERROR, noiselevel=-1)
-				showMessage(_unicode_decode("%s\n") % (e,),
-					level=logging.ERROR, noiselevel=-1)
-				myebuildpath = None
+		if self.mycpv != self.settings.mycpv or \
+			"SLOT" not in self.settings.configdict["pkg"]:
+			# We avoid a redundant setcpv call here when
+			# the caller has already taken care of it.
+			self.settings.setcpv(self.mycpv, mydb=self.vartree.dbapi)
+
+		eapi_unsupported = False
+		try:
+			doebuild_environment(myebuildpath, "prerm",
+				settings=self.settings, db=self.vartree.dbapi)
+		except UnsupportedAPIException as e:
+			eapi_unsupported = e
 
 		self._prune_plib_registry(unmerge=True, needed=needed,
 			preserve_paths=preserve_paths)
 
+		builddir_locked = "PORTAGE_BUILDIR_LOCKED" in self.settings
 		builddir_lock = None
 		scheduler = self._scheduler
 		retval = os.EX_OK
 		try:
-			if myebuildpath:
+			# Only create builddir_lock if the caller
+			# has not already acquired the lock.
+			if not builddir_locked:
 				builddir_lock = EbuildBuildDir(
 					scheduler=(scheduler or PollScheduler().sched_iface),
 					settings=self.settings)
 				builddir_lock.lock()
-
 				prepare_build_dirs(settings=self.settings, cleanup=True)
 				log_path = self.settings.get("PORTAGE_LOG_FILE")
 
+			# Log the error after PORTAGE_LOG_FILE is initialized
+			# by prepare_build_dirs above.
+			if eapi_unsupported:
+				# Sometimes this happens due to corruption of the EAPI file.
+				failures += 1
+				showMessage(_("!!! FAILED prerm: %s\n") % \
+					os.path.join(self.dbdir, "EAPI"),
+					level=logging.ERROR, noiselevel=-1)
+				showMessage(_unicode_decode("%s\n") % (eapi_unsupported,),
+					level=logging.ERROR, noiselevel=-1)
+			elif myebuildpath:
 				if scheduler is None:
 					retval = _spawn_phase('prerm', self.settings)
 				else:
@@ -1669,7 +1680,7 @@ class dblink(object):
 			self._unmerge_pkgfiles(pkgfiles, others_in_slot)
 			self._clear_contents_cache()
 
-			if myebuildpath:
+			if myebuildpath and not eapi_unsupported:
 				ebuild_phase = "postrm"
 				if scheduler is None:
 					retval = _spawn_phase(ebuild_phase, self.settings)
@@ -1685,9 +1696,9 @@ class dblink(object):
 
 		finally:
 			self.vartree.dbapi._bump_mtime(self.mycpv)
-			if builddir_lock:
+			if builddir_locked:
 				try:
-					if myebuildpath:
+					if myebuildpath and not eapi_unsupported:
 						if retval != os.EX_OK:
 							msg_lines = []
 							msg = _("The '%(ebuild_phase)s' "
@@ -1730,7 +1741,7 @@ class dblink(object):
 						elog_process(self.mycpv, self.settings,
 							phasefilter=('prerm', 'postrm'))
 
-					if retval == os.EX_OK and builddir_lock is not None:
+					if retval == os.EX_OK and builddir_locked:
 						# myebuildpath might be None, so ensure
 						# it has a sane value for the clean phase,
 						# even though it won't really be sourced.



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     174e63d3894c7d8acce9ac79a617969506210b7f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 26 02:32:42 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=174e63d3

dblink.unmerge: always initialize myebuildpath

This is required for the doebuild_environment() call. Also, set
builddir_locked = True when appropriate.

---
 pym/portage/dbapi/vartree.py |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index b75d69a..5394895 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1612,14 +1612,13 @@ class dblink(object):
 		contents = self.getcontents()
 		# Now, don't assume that the name of the ebuild is the same as the
 		# name of the dir; the package may have been moved.
-		myebuildpath = None
+		myebuildpath = os.path.join(self.dbdir, self.pkg + ".ebuild")
 		failures = 0
 		ebuild_phase = "prerm"
 		log_path = None
 		mystuff = os.listdir(self.dbdir)
 		for x in mystuff:
 			if x.endswith(".ebuild"):
-				myebuildpath = os.path.join(self.dbdir, self.pkg + ".ebuild")
 				if x[:-7] != self.pkg:
 					# Clean up after vardbapi.move_ent() breakage in
 					# portage versions before 2.1.2
@@ -1655,6 +1654,7 @@ class dblink(object):
 					scheduler=(scheduler or PollScheduler().sched_iface),
 					settings=self.settings)
 				builddir_lock.lock()
+				builddir_locked = True
 				prepare_build_dirs(settings=self.settings, cleanup=True)
 				log_path = self.settings.get("PORTAGE_LOG_FILE")
 
@@ -1668,7 +1668,7 @@ class dblink(object):
 					level=logging.ERROR, noiselevel=-1)
 				showMessage(_unicode_decode("%s\n") % (eapi_unsupported,),
 					level=logging.ERROR, noiselevel=-1)
-			elif myebuildpath:
+			elif os.path.isfile(myebuildpath):
 				if scheduler is None:
 					retval = _spawn_phase('prerm', self.settings)
 				else:
@@ -1684,7 +1684,7 @@ class dblink(object):
 			self._unmerge_pkgfiles(pkgfiles, others_in_slot)
 			self._clear_contents_cache()
 
-			if myebuildpath and not eapi_unsupported:
+			if not eapi_unsupported and os.path.isfile(myebuildpath):
 				ebuild_phase = "postrm"
 				if scheduler is None:
 					retval = _spawn_phase(ebuild_phase, self.settings)
@@ -1702,7 +1702,7 @@ class dblink(object):
 			self.vartree.dbapi._bump_mtime(self.mycpv)
 			if builddir_locked:
 				try:
-					if myebuildpath and not eapi_unsupported:
+					if not eapi_unsupported and os.path.isfile(myebuildpath):
 						if retval != os.EX_OK:
 							msg_lines = []
 							msg = _("The '%(ebuild_phase)s' "
@@ -1746,11 +1746,6 @@ class dblink(object):
 							phasefilter=('prerm', 'postrm'))
 
 					if retval == os.EX_OK and builddir_locked:
-						# myebuildpath might be None, so ensure
-						# it has a sane value for the clean phase,
-						# even though it won't really be sourced.
-						myebuildpath = os.path.join(self.dbdir,
-							self.pkg + ".ebuild")
 						try:
 							doebuild_environment(myebuildpath, "cleanrm",
 								settings=self.settings, db=self.vartree.dbapi)



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     268f176c75d6a8b4f92efbfa7e8367f1d63d8889
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 05:01:35 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=268f176c

dblink: use config._init_dirs() when necessary

---
 pym/portage/dbapi/vartree.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index aa57ab7..1c08906 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3637,9 +3637,13 @@ class dblink(object):
 		# write out our collection of md5sums
 		if cfgfiledict != cfgfiledict_orig:
 			cfgfiledict.pop("IGNORE", None)
-			ensure_dirs(os.path.dirname(conf_mem_file),
-				gid=portage_gid, mode=0o2750, mask=0o2)
-			writedict(cfgfiledict, conf_mem_file)
+			try:
+				writedict(cfgfiledict, conf_mem_file)
+			except IOError as e:
+				if e.errno != errno.ENOENT:
+					raise
+				self.settings._init_dirs()
+				writedict(cfgfiledict, conf_mem_file)
 
 		return os.EX_OK
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     ed17d97bfaef379c2e6e27d66bd3b0c8ad53ce07
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 05:09:43 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ed17d97b

treewalk: reset cloned config instances

---
 pym/portage/dbapi/vartree.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1c08906..b7d3710 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3002,6 +3002,7 @@ class dblink(object):
 			# we need it to have private ${T} etc... for things like elog.
 			settings_clone = config(clone=self.settings)
 			settings_clone.pop("PORTAGE_BUILDIR_LOCKED", None)
+			settings_clone.reset()
 			others_in_slot.append(dblink(self.cat, catsplit(cur_cpv)[1],
 				settings=settings_clone,
 				vartree=self.vartree, treetype="vartree",



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     ed640f020b59d46876e74aae9e347242744442b3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 04:36:36 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ed640f02

vardbapi: use config._init_dirs() when necessary

---
 pym/portage/dbapi/vartree.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1db7d9e..aa57ab7 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -37,7 +37,7 @@ from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
 from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_PRESERVE_LIBS
 from portage.dbapi import dbapi
 from portage.exception import CommandNotFound, \
-	InvalidData, InvalidPackageName, \
+	InvalidData, InvalidLocation, InvalidPackageName, \
 	FileNotFound, PermissionDenied, UnsupportedAPIException
 from portage.localization import _
 from portage.util.movefile import movefile
@@ -787,11 +787,12 @@ class vardbapi(dbapi):
 				if incrementing:
 					#increment counter
 					counter += 1
-					# use same permissions as config._init_dirs()
-					ensure_dirs(os.path.dirname(self._counter_path),
-						gid=portage_gid, mode=0o2750, mask=0o2)
 					# update new global counter file
-					write_atomic(self._counter_path, str(counter))
+					try:
+						write_atomic(self._counter_path, str(counter))
+					except InvalidLocation:
+						self.settings._init_dirs()
+						write_atomic(self._counter_path, str(counter))
 				self._cached_counter = counter
 		finally:
 			self.unlock()



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     665e83018b7bcce3d9412c83d84c408ce8def256
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 04:07:31 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=665e8301

cleanrm: handle UnsupportedAPIException

---
 pym/portage/dbapi/vartree.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 8fd5f55..1db7d9e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1735,8 +1735,11 @@ class dblink(object):
 						# even though it won't really be sourced.
 						myebuildpath = os.path.join(self.dbdir,
 							self.pkg + ".ebuild")
-						doebuild_environment(myebuildpath, "cleanrm",
-							settings=self.settings, db=self.vartree.dbapi)
+						try:
+							doebuild_environment(myebuildpath, "cleanrm",
+								settings=self.settings, db=self.vartree.dbapi)
+						except UnsupportedAPIException:
+							pass
 						if scheduler is None:
 							_spawn_phase("cleanrm", self.settings)
 						else:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d3713109698009ad5b0bfd951073ee70b88808b2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 10:40:23 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 04:31:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d3713109

treewalk: fix PORTAGE_BUILDIR_LOCKED state

This fixes breakage from commit
f0f1bbe8fa9d3f698cbe529d2a11eec1ce437119.

---
 pym/portage/dbapi/vartree.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 6e92c9e..8fd5f55 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2996,8 +2996,10 @@ class dblink(object):
 		for cur_cpv in slot_matches:
 			# Clone the config in case one of these has to be unmerged since
 			# we need it to have private ${T} etc... for things like elog.
+			settings_clone = config(clone=self.settings)
+			settings_clone.pop("PORTAGE_BUILDIR_LOCKED", None)
 			others_in_slot.append(dblink(self.cat, catsplit(cur_cpv)[1],
-				settings=config(clone=self.settings),
+				settings=settings_clone,
 				vartree=self.vartree, treetype="vartree",
 				scheduler=self._scheduler))
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     3e8d70b67ea14b5c76478d24472e9c71f2339476
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 14:22:00 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:47:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e8d70b6

treewalk: force AUTOCLEAN=yes if libs preserved

---
 pym/portage/dbapi/vartree.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 566861e..6e92c9e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3387,7 +3387,12 @@ class dblink(object):
 		else:
 			emerge_log = scheduler.dblinkEmergeLog
 
-		autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes"
+		# If we have any preserved libraries then autoclean
+		# is forced so that preserve-libs logic doesn't have
+		# to account for the additional complexity of the
+		# AUTOCLEAN=no mode.
+		autoclean = self.settings.get("AUTOCLEAN", "yes") == "yes" \
+			or preserve_paths
 
 		if autoclean:
 			emerge_log(_(" >>> AUTOCLEAN: %s") % (slot_atom,))



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     9af34ca89e7216e3c8a582d6d865ffa5ba518182
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 13:09:46 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:47:24 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9af34ca8

_prune_plib_registry: correct _match_contents use

---
 pym/portage/dbapi/vartree.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d0fb86c..566861e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1507,7 +1507,7 @@ class dblink(object):
 					if unmerge_preserve:
 						for path in sorted(unmerge_preserve):
 							contents_key = self._match_contents(path)
-							if contents_key is None:
+							if not contents_key:
 								continue
 							obj_type = self.getcontents()[contents_key][0]
 							self._display_merge(_(">>> needed   %s %s\n") % \



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     60e57112f493f5a3935ee51a77b9af8abbb11a15
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 05:38:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:22:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60e57112

_find_libs_to_preserve: always return set

---
 pym/portage/dbapi/vartree.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 31e1fa6..d0fb86c 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2298,7 +2298,7 @@ class dblink(object):
 			self.vartree.dbapi._plib_registry is None or \
 			(not unmerge and self._installed_instance is None) or \
 			"preserve-libs" not in self.settings.features:
-			return None
+			return set()
 
 		os = _os_merge
 		linkmap = self.vartree.dbapi._linkmap



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     b9f024495f2d15590a9e268f5ec5cdcd89d256ec
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 05:27:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:22:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b9f02449

preserve-libs: check for broken linkmap more

---
 pym/portage/dbapi/vartree.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 6ac1611..31e1fa6 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1474,8 +1474,10 @@ class dblink(object):
 	def _prune_plib_registry(self, unmerge=False,
 		needed=None, preserve_paths=None):
 		# remove preserved libraries that don't have any consumers left
-		plib_registry = self.vartree.dbapi._plib_registry
-		if plib_registry:
+		if not (self._linkmap_broken or
+			self.vartree.dbapi._linkmap is None or
+			self.vartree.dbapi._plib_registry is None):
+			plib_registry = self.vartree.dbapi._plib_registry
 			plib_registry.lock()
 			try:
 				plib_registry.load()
@@ -3351,7 +3353,8 @@ class dblink(object):
 
 		preserve_paths = set()
 		needed = None
-		if not (linkmap is None or plib_registry is None):
+		if not (self._linkmap_broken or linkmap is None or
+			plib_registry is None):
 			plib_registry.lock()
 			try:
 				plib_registry.load()



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d858639445745b36b40dfbc33b4db2017abd8902
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May 16 01:25:59 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:03:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d8586394

preserve-libs: lock vardb for removeFromContents

---
 pym/portage/dbapi/vartree.py |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 8de7945..6ac1611 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1523,10 +1523,14 @@ class dblink(object):
 					unmerge_no_replacement)
 				if cpv_lib_map:
 					self._remove_preserved_libs(cpv_lib_map)
-					for cpv, removed in cpv_lib_map.items():
-						if not self.vartree.dbapi.cpv_exists(cpv):
-							continue
-						self.vartree.dbapi.removeFromContents(cpv, removed)
+					self.vartree.dbapi.lock()
+					try:
+						for cpv, removed in cpv_lib_map.items():
+							if not self.vartree.dbapi.cpv_exists(cpv):
+								continue
+							self.vartree.dbapi.removeFromContents(cpv, removed)
+					finally:
+						self.vartree.dbapi.unlock()
 
 				plib_registry.store()
 			finally:
@@ -3455,12 +3459,19 @@ class dblink(object):
 						# same cpv then the vdb entry no longer belongs
 						# to it, so we'll have to get the slot and counter
 						# from plib_registry._data instead.
+						self.vartree.dbapi.lock()
 						try:
-							slot, counter = self.vartree.dbapi.aux_get(
-								cpv, ["SLOT", "COUNTER"])
-							has_vdb_entry = True
-						except KeyError:
-							pass
+							try:
+								slot, counter = self.vartree.dbapi.aux_get(
+									cpv, ["SLOT", "COUNTER"])
+							except KeyError:
+								pass
+							else:
+								has_vdb_entry = True
+								self.vartree.dbapi.removeFromContents(
+									cpv, paths)
+						finally:
+							self.vartree.dbapi.unlock()
 
 					if not has_vdb_entry:
 						# It's possible for previously unmerged packages
@@ -3484,8 +3495,6 @@ class dblink(object):
 
 					remaining = [f for f in plib_dict[cpv] if f not in paths]
 					plib_registry.register(cpv, slot, counter, remaining)
-					if has_vdb_entry:
-						self.vartree.dbapi.removeFromContents(cpv, paths)
 
 				plib_registry.store()
 			finally:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     98c5747c9a7fd278b90fa663badae91068b3d4d2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 21:25:16 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 02:47:22 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=98c5747c

treewalk: fix plib_collisions with same cpv

---
 pym/portage/dbapi/vartree.py |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 01c8b0e..db081e1 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3426,14 +3426,20 @@ class dblink(object):
 				for cpv, paths in plib_collisions.items():
 					if cpv not in plib_dict:
 						continue
-					if cpv == self.mycpv:
-						continue
-					has_vdb_entry = True
-					try:
-						slot, counter = self.vartree.dbapi.aux_get(
-							cpv, ["SLOT", "COUNTER"])
-					except KeyError:
-						has_vdb_entry = False
+					has_vdb_entry = False
+					if cpv != self.mycpv:
+						# If we've replaced another instance with the
+						# same cpv then the vdb entry no longer belongs
+						# to it, so we'll have to get the slot and couter
+						# from plib_registry._data instead.
+						try:
+							slot, counter = self.vartree.dbapi.aux_get(
+								cpv, ["SLOT", "COUNTER"])
+							has_vdb_entry = True
+						except KeyError:
+							pass
+
+					if not has_vdb_entry:
 						# It's possible for previously unmerged packages
 						# to have preserved libs in the registry, so try
 						# to retrieve the slot and counter from there.



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     6792105073822a6d508ee17e8f792566566b8dda
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 21:41:22 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 02:47:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=67921050

prune_plib_registry: display preserved libs

Since commit c64d4abee145d083c70273be8fd23bd56dffe7ec, sometimes we
preserve libs for unmerged packages here (bug #286714), so we should
display them like we do in _add_preserve_libs_to_contents().

---
 pym/portage/dbapi/vartree.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index db081e1..189b47a 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1512,6 +1512,13 @@ class dblink(object):
 					plib_registry.unregister(self.mycpv,
 						self.settings["SLOT"], counter)
 					if unmerge_preserve:
+						for path in sorted(unmerge_preserve):
+							contents_key = self._match_contents(path)
+							if contents_key is None:
+								continue
+							obj_type = self.getcontents()[contents_key][0]
+							self._display_merge(_(">>> needed   %s %s\n") % \
+								(obj_type, contents_key), noiselevel=-1)
 						plib_registry.register(self.mycpv,
 							self.settings["SLOT"], counter, unmerge_preserve)
 						# Remove the preserved files from our contents



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     a01ef3f6009f07726461b08a0390efeb51fe8424
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 22:14:45 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 02:47:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a01ef3f6

find_unused_preserved_libs: fix unmerge handling

Since commit c64d4abee145d083c70273be8fd23bd56dffe7ec (bug #286714),
preserved libs have not been properly garbage collected when packages
are unmerged without replacement, due to a difference in LinkageMap
state. It should behave correcly now.

---
 pym/portage/dbapi/vartree.py |   46 ++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 189b47a..d7f945e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1494,20 +1494,11 @@ class dblink(object):
 				self._linkmap_rebuild(exclude_pkgs=exclude_pkgs,
 					include_file=needed, preserve_paths=preserve_paths)
 
-				unmerge_preserve = None
-				if unmerge and not unmerge_with_replacement:
-					unmerge_preserve = \
-						self._find_libs_to_preserve(unmerge=True)
-
-				cpv_lib_map = self._find_unused_preserved_libs()
-				if cpv_lib_map:
-					self._remove_preserved_libs(cpv_lib_map)
-					for cpv, removed in cpv_lib_map.items():
-						if not self.vartree.dbapi.cpv_exists(cpv):
-							continue
-						self.vartree.dbapi.removeFromContents(cpv, removed)
-
 				if unmerge:
+					unmerge_preserve = None
+					if not unmerge_with_replacement:
+						unmerge_preserve = \
+							self._find_libs_to_preserve(unmerge=True)
 					counter = self.vartree.dbapi.cpv_counter(self.mycpv)
 					plib_registry.unregister(self.mycpv,
 						self.settings["SLOT"], counter)
@@ -1526,6 +1517,17 @@ class dblink(object):
 						self.vartree.dbapi.removeFromContents(self,
 							unmerge_preserve)
 
+				unmerge_no_replacement = \
+					unmerge and not unmerge_with_replacement
+				cpv_lib_map = self._find_unused_preserved_libs(
+					unmerge_no_replacement)
+				if cpv_lib_map:
+					self._remove_preserved_libs(cpv_lib_map)
+					for cpv, removed in cpv_lib_map.items():
+						if not self.vartree.dbapi.cpv_exists(cpv):
+							continue
+						self.vartree.dbapi.removeFromContents(cpv, removed)
+
 				plib_registry.store()
 			finally:
 				plib_registry.unlock()
@@ -2281,7 +2283,7 @@ class dblink(object):
 	def _find_libs_to_preserve(self, unmerge=False):
 		"""
 		Get set of relative paths for libraries to be preserved. When
-		unmerge is False, file paths to preserver are selected from
+		unmerge is False, file paths to preserve are selected from
 		self._installed_instance. Otherwise, paths are selected from
 		self.
 		"""
@@ -2448,7 +2450,7 @@ class dblink(object):
 		outfile.close()
 		self._clear_contents_cache()
 
-	def _find_unused_preserved_libs(self):
+	def _find_unused_preserved_libs(self, unmerge_no_replacement):
 		"""
 		Find preserved libraries that don't have any consumers left.
 		"""
@@ -2501,12 +2503,26 @@ class dblink(object):
 		# installed library that is not preserved. This eliminates
 		# libraries that are erroneously preserved due to a move from one
 		# directory to another.
+		# Also eliminate consumers that are going to be unmerged if
+		# unmerge_no_replacement is True.
 		provider_cache = {}
 		for preserved_node in preserved_nodes:
 			soname = linkmap.getSoname(preserved_node)
 			for consumer_node in lib_graph.parent_nodes(preserved_node):
 				if consumer_node in preserved_nodes:
 					continue
+				if unmerge_no_replacement:
+					will_be_unmerged = True
+					for path in consumer_node.alt_paths:
+						if not self.isowner(path):
+							will_be_unmerged = False
+							break
+					if will_be_unmerged:
+						# This consumer is not preserved and it is
+						# being unmerged, so drop this edge.
+						lib_graph.remove_edge(preserved_node, consumer_node)
+						continue
+
 				providers = provider_cache.get(consumer_node)
 				if providers is None:
 					providers = linkmap.findProviders(consumer_node)



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-26  6:18 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-26  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     6e6660af2244aed5bc2be5cb7b202e7b02e7058a
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Sat May 14 22:56:35 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 02:47:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6e6660af

Fix a typo in a comment.

---
 pym/portage/dbapi/vartree.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d7f945e..4e19b10 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3453,7 +3453,7 @@ class dblink(object):
 					if cpv != self.mycpv:
 						# If we've replaced another instance with the
 						# same cpv then the vdb entry no longer belongs
-						# to it, so we'll have to get the slot and couter
+						# to it, so we'll have to get the slot and counter
 						# from plib_registry._data instead.
 						try:
 							slot, counter = self.vartree.dbapi.aux_get(



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12 20:13 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12 20:13 UTC (permalink / raw
  To: gentoo-commits

commit:     161437273b668f4b276f9669aae89ef99213d40d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 19:02:27 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 19:20:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=16143727

porttree: use pure volatile cache if necessary

---
 pym/portage/dbapi/porttree.py |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 231d1fb..429f8cf 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -286,12 +286,18 @@ class portdbapi(dbapi):
 		# to the cache entries/directories.
 		if secpass < 1 or not depcachedir_w_ok:
 			for x in self.porttrees:
-				db_ro = self.auxdbmodule(self.depcachedir, x,
-					filtered_auxdbkeys, gid=portage_gid, readonly=True)
-				self.auxdb[x] = metadata_overlay.database(
-					self.depcachedir, x, filtered_auxdbkeys,
-					gid=portage_gid, db_rw=volatile.database,
-					db_ro=db_ro)
+				try:
+					db_ro = self.auxdbmodule(self.depcachedir, x,
+						filtered_auxdbkeys, readonly=True, **cache_kwargs)
+				except CacheError:
+					self.auxdb[x] = volatile.database(
+						self.depcachedir, x, filtered_auxdbkeys,
+						**cache_kwargs)
+				else:
+					self.auxdb[x] = metadata_overlay.database(
+						self.depcachedir, x, filtered_auxdbkeys,
+						db_rw=volatile.database, db_ro=db_ro,
+						**cache_kwargs)
 		else:
 			for x in self.porttrees:
 				if x in self.auxdb:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12 17:58 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     c3a191c1c38b98428e457c9e9ab3cf84b773e173
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 17:51:08 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 17:51:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c3a191c1

expand_new_virt: return early for non-virtual cat

---
 pym/portage/dbapi/_expand_new_virt.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/_expand_new_virt.py b/pym/portage/dbapi/_expand_new_virt.py
index 6fccd16..6d6a27d 100644
--- a/pym/portage/dbapi/_expand_new_virt.py
+++ b/pym/portage/dbapi/_expand_new_virt.py
@@ -13,6 +13,11 @@ def expand_new_virt(vardb, atom):
 	"""
 	if not isinstance(atom, Atom):
 		atom = Atom(atom)
+
+	if not atom.cp.startswith("virtual/"):
+		yield atom
+		return
+
 	traversed = set()
 	stack = [atom]
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  7:13 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  7:13 UTC (permalink / raw
  To: gentoo-commits

commit:     6416b9c83047419818c4cb18cc90fb64dfd1d179
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 07:09:19 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 07:13:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6416b9c8

expand_new_virt: skip match for non-virtual cat

---
 pym/portage/dbapi/_expand_new_virt.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/_expand_new_virt.py b/pym/portage/dbapi/_expand_new_virt.py
index 7a233f1..6fccd16 100644
--- a/pym/portage/dbapi/_expand_new_virt.py
+++ b/pym/portage/dbapi/_expand_new_virt.py
@@ -18,7 +18,8 @@ def expand_new_virt(vardb, atom):
 
 	while stack:
 		atom = stack.pop()
-		if atom.blocker:
+		if atom.blocker or \
+			not atom.cp.startswith("virtual/"):
 			yield atom
 			continue
 



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:47 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:47 UTC (permalink / raw
  To: gentoo-commits

commit:     294afa2858aca7f5ba94b4c09cdbe059758d5280
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 05:35:40 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:36:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=294afa28

treewalk: fix inverted counter init logic

---
 pym/portage/dbapi/vartree.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a54adc0..079743c 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3243,7 +3243,7 @@ class dblink(object):
 			self.copyfile(inforoot+"/"+x)
 
 		# write local package counter for recording
-		if counter is not None:
+		if counter is None:
 			counter = self.vartree.dbapi.counter_tick(mycpv=self.mycpv)
 		codecs.open(_unicode_encode(os.path.join(self.dbtmpdir, 'COUNTER'),
 			encoding=_encodings['fs'], errors='strict'),



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:47 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:47 UTC (permalink / raw
  To: gentoo-commits

commit:     042e0231b4fa8ab7b5de707e64e5f427530caac6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 05:38:47 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:38:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=042e0231

dblink: fix broken counter references

---
 pym/portage/dbapi/vartree.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 079743c..1edda24 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3915,10 +3915,10 @@ class dblink(object):
 
 		return self._merge(mergeroot, inforoot,
 				myebuild=myebuild, cleanup=cleanup,
-				mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+				mydbapi=mydbapi, prev_mtimes=prev_mtimes, counter=counter)
 
 	def _merge(self, mergeroot, inforoot, myroot=None, myebuild=None, cleanup=0,
-		mydbapi=None, prev_mtimes=None):
+		mydbapi=None, prev_mtimes=None, counter=None):
 		"""
 		@param myroot: ignored, self._eroot is used instead
 		"""



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     7b7632a5576236a370a129df6e9bf366f0092051
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 01:14:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:23:07 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7b7632a5

portdbapi: tweak cache permission handling

This is a reponse to the following issue:

  http://code.google.com/p/chromium-os/issues/detail?id=15234

---
 pym/portage/dbapi/porttree.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 11cc452..231d1fb 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -18,6 +18,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
 	'portage.versions:best,catpkgsplit,_pkgsplit@pkgsplit,ver_regexp',
 )
 
+from portage.cache import metadata_overlay, volatile
 from portage.cache.cache_errors import CacheError
 from portage.cache.mappings import Mapping
 from portage.const import REPO_NAME_LOC
@@ -42,6 +43,7 @@ import codecs
 import logging
 import stat
 import sys
+import traceback
 import warnings
 
 if sys.hexversion >= 0x3000000:
@@ -275,17 +277,14 @@ class portdbapi(dbapi):
 			'perms'   : 0o664
 		}
 
-		if secpass < 1:
-			# portage_gid is irrelevant, so just obey umask
-			cache_kwargs['gid']   = -1
-			cache_kwargs['perms'] = -1
-
 		# XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys
 		# ~harring
 		filtered_auxdbkeys = [x for x in auxdbkeys if not x.startswith("UNUSED_0")]
 		filtered_auxdbkeys.sort()
-		from portage.cache import metadata_overlay, volatile
-		if not depcachedir_w_ok:
+		# If secpass < 1, we don't want to write to the cache
+		# since then we won't be able to apply group permissions
+		# to the cache entries/directories.
+		if secpass < 1 or not depcachedir_w_ok:
 			for x in self.porttrees:
 				db_ro = self.auxdbmodule(self.depcachedir, x,
 					filtered_auxdbkeys, gid=portage_gid, readonly=True)
@@ -465,7 +464,12 @@ class portdbapi(dbapi):
 				metadata[k] = ""
 			metadata["EAPI"] = "-" + eapi.lstrip("-")
 
-		self.auxdb[repo_path][cpv] = metadata
+		try:
+			self.auxdb[repo_path][cpv] = metadata
+		except CacheError:
+			# Normally this shouldn't happen, so we'll show
+			# a traceback for debugging purposes.
+			traceback.print_exc()
 		return metadata
 
 	def _pull_valid_cache(self, cpv, ebuild_path, repo_path):



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     e0b4f2971245506750cb013a4fda8251111e1c46
Author:     David James <davidjames <AT> chromium <DOT> org>
AuthorDate: Tue May 10 04:11:47 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:19:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e0b4f297

Cache counter values, avoiding I/O when it doesn't change.

This improves merge times by up to 25%, since looping over the vardb for
each package install is slow.

TEST=Emerge a bunch of packages, notice 25% speed improvement.
BUG=chromium-os:15112

Change-Id: I51dd617219cd1820ceeb702291bd790990995be4

---
 pym/portage/dbapi/vartree.py |   71 ++++++++++++++++++++++-------------------
 1 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1302556..a129973 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -158,6 +158,8 @@ class vardbapi(dbapi):
 			self._linkmap = LinkageMap(self)
 		self._owners = self._owners_db(self)
 
+		self._cached_counter = None
+
 	def getpath(self, mykey, filename=None):
 		# This is an optimized hotspot, so don't use unicode-wrapped
 		# os module and don't use os.path.join().
@@ -715,17 +717,6 @@ class vardbapi(dbapi):
 		@param myroot: ignored, self._eroot is used instead
 		"""
 		myroot = None
-		cp_list = self.cp_list
-		max_counter = 0
-		for cp in self.cp_all():
-			for cpv in cp_list(cp):
-				try:
-					counter = int(self.aux_get(cpv, ["COUNTER"])[0])
-				except (KeyError, OverflowError, ValueError):
-					continue
-				if counter > max_counter:
-					max_counter = counter
-
 		new_vdb = False
 		counter = -1
 		try:
@@ -753,16 +744,27 @@ class vardbapi(dbapi):
 				writemsg("!!! %s\n" % str(e), noiselevel=-1)
 				del e
 
-		# We must ensure that we return a counter
-		# value that is at least as large as the
-		# highest one from the installed packages,
-		# since having a corrupt value that is too low
-		# can trigger incorrect AUTOCLEAN behavior due
-		# to newly installed packages having lower
-		# COUNTERs than the previous version in the
-		# same slot.
-		if counter > max_counter:
+		if self._cached_counter == counter:
+			max_counter = counter
+		else:
+			# We must ensure that we return a counter
+			# value that is at least as large as the
+			# highest one from the installed packages,
+			# since having a corrupt value that is too low
+			# can trigger incorrect AUTOCLEAN behavior due
+			# to newly installed packages having lower
+			# COUNTERs than the previous version in the
+			# same slot.
+			cp_list = self.cp_list
 			max_counter = counter
+			for cp in self.cp_all():
+				for cpv in cp_list(cp):
+					try:
+						pkg_counter = int(self.aux_get(cpv, ["COUNTER"])[0])
+					except (KeyError, OverflowError, ValueError):
+						continue
+					if pkg_counter > max_counter:
+						max_counter = pkg_counter
 
 		if counter < 0 and not new_vdb:
 			writemsg(_("!!! Initializing COUNTER to " \
@@ -780,18 +782,19 @@ class vardbapi(dbapi):
 		"""
 		myroot = None
 		mycpv = None
-
 		self.lock()
 		try:
 			counter = self.get_counter_tick_core() - 1
-			if incrementing:
-				#increment counter
-				counter += 1
-				# use same permissions as config._init_dirs()
-				ensure_dirs(os.path.dirname(self._counter_path),
-					gid=portage_gid, mode=0o2750, mask=0o2)
-				# update new global counter file
-				write_atomic(self._counter_path, str(counter))
+			if self._cached_counter != counter:
+				if incrementing:
+					#increment counter
+					counter += 1
+					# use same permissions as config._init_dirs()
+					ensure_dirs(os.path.dirname(self._counter_path),
+						gid=portage_gid, mode=0o2750, mask=0o2)
+					# update new global counter file
+					write_atomic(self._counter_path, str(counter))
+				self._cached_counter = counter
 		finally:
 			self.unlock()
 
@@ -2824,7 +2827,7 @@ class dblink(object):
 			env=env)
 
 	def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
-		mydbapi=None, prev_mtimes=None):
+		mydbapi=None, prev_mtimes=None, counter=None):
 		"""
 		
 		This function does the following:
@@ -3242,7 +3245,8 @@ class dblink(object):
 			self.copyfile(inforoot+"/"+x)
 
 		# write local package counter for recording
-		counter = self.vartree.dbapi.counter_tick(mycpv=self.mycpv)
+		if counter is not None:
+			counter = self.vartree.dbapi.counter_tick(mycpv=self.mycpv)
 		codecs.open(_unicode_encode(os.path.join(self.dbtmpdir, 'COUNTER'),
 			encoding=_encodings['fs'], errors='strict'),
 			'w', encoding=_encodings['repo.content'], errors='backslashreplace'
@@ -3857,7 +3861,7 @@ class dblink(object):
 				showMessage(zing + " " + mydest + "\n")
 
 	def merge(self, mergeroot, inforoot, myroot=None, myebuild=None, cleanup=0,
-		mydbapi=None, prev_mtimes=None):
+		mydbapi=None, prev_mtimes=None, counter=None):
 		"""
 		If portage is reinstalling itself, create temporary
 		copies of PORTAGE_BIN_PATH and PORTAGE_PYM_PATH in order
@@ -3926,7 +3930,8 @@ class dblink(object):
 		self.vartree.dbapi._bump_mtime(self.mycpv)
 		try:
 			retval = self.treewalk(mergeroot, myroot, inforoot, myebuild,
-				cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+				cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes,
+				counter=counter)
 
 			# If PORTAGE_BUILDDIR doesn't exist, then it probably means
 			# fail-clean is enabled, and the success/die hooks have



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     d53dfac16cfc793b7f55069bfa49c3544a73bd2a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May 10 05:05:40 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:19:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d53dfac1

get_counter_tick_core: use cpv_all

It's more efficient to use cpv_all since cp_all calls cpv_all anyway,
and calls to cp_list induce additional stat calls.

---
 pym/portage/dbapi/vartree.py |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a129973..a54adc0 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -755,16 +755,14 @@ class vardbapi(dbapi):
 			# to newly installed packages having lower
 			# COUNTERs than the previous version in the
 			# same slot.
-			cp_list = self.cp_list
 			max_counter = counter
-			for cp in self.cp_all():
-				for cpv in cp_list(cp):
-					try:
-						pkg_counter = int(self.aux_get(cpv, ["COUNTER"])[0])
-					except (KeyError, OverflowError, ValueError):
-						continue
-					if pkg_counter > max_counter:
-						max_counter = pkg_counter
+			for cpv in self.cpv_all():
+				try:
+					pkg_counter = int(self.aux_get(cpv, ["COUNTER"])[0])
+				except (KeyError, OverflowError, ValueError):
+					continue
+				if pkg_counter > max_counter:
+					max_counter = pkg_counter
 
 		if counter < 0 and not new_vdb:
 			writemsg(_("!!! Initializing COUNTER to " \



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     32c4d1d7f05b8ab10a97a5ef965be14a8dd7e10b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 03:05:21 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:17:11 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=32c4d1d7

vardbapi: acquire lock during counter_tick_core

---
 pym/portage/dbapi/vartree.py |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1b13e13..1302556 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -776,17 +776,25 @@ class vardbapi(dbapi):
 		to the global file.  Returns new counter value.
 
 		@param myroot: ignored, self._eroot is used instead
+		@param mycpv: ignored
 		"""
 		myroot = None
-		counter = self.get_counter_tick_core(mycpv=mycpv) - 1
-		if incrementing:
-			#increment counter
-			counter += 1
-			# use same permissions as config._init_dirs()
-			ensure_dirs(os.path.dirname(self._counter_path),
-				gid=portage_gid, mode=0o2750, mask=0o2)
-			# update new global counter file
-			write_atomic(self._counter_path, str(counter))
+		mycpv = None
+
+		self.lock()
+		try:
+			counter = self.get_counter_tick_core() - 1
+			if incrementing:
+				#increment counter
+				counter += 1
+				# use same permissions as config._init_dirs()
+				ensure_dirs(os.path.dirname(self._counter_path),
+					gid=portage_gid, mode=0o2750, mask=0o2)
+				# update new global counter file
+				write_atomic(self._counter_path, str(counter))
+		finally:
+			self.unlock()
+
 		return counter
 
 	def _dblink(self, cpv):



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     97accf02abc066fe72c33778765b2b097464bba6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May  9 06:23:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:09:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=97accf02

cpv_expand: populate old-style virts on demand

If old-style virtuals code is triggered here and we are given a
vartree, use it to avoid creating a temporary instance.

---
 pym/portage/dbapi/cpv_expand.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/cpv_expand.py b/pym/portage/dbapi/cpv_expand.py
index 26f9948..b77c283 100644
--- a/pym/portage/dbapi/cpv_expand.py
+++ b/pym/portage/dbapi/cpv_expand.py
@@ -28,6 +28,8 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
 			mykey=mycpv
 		if hasattr(mydb, "cp_list") and \
 			not mydb.cp_list(mykey, use_cache=use_cache):
+				if hasattr(mydb, "vartree"):
+					settings._populate_treeVirtuals_if_needed(mydb.vartree)
 				virts = settings.getvirtuals().get(mykey)
 				if virts:
 					mykey_orig = mykey
@@ -76,6 +78,8 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
 			mykey=matches[0]
 
 		if not mykey and not isinstance(mydb, list):
+			if hasattr(mydb, "vartree"):
+				settings._populate_treeVirtuals_if_needed(mydb.vartree)
 			virts_p = settings.get_virts_p().get(myp)
 			if virts_p:
 				mykey = virts_p[0]



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-12  5:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-12  5:24 UTC (permalink / raw
  To: gentoo-commits

commit:     6634fce99179845d4c1efc7c7ed2f1a248bfa9c0
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon May  9 20:36:22 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 05:09:46 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6634fce9

cpv_expand: avoid old-style virtuals more

---
 pym/portage/dbapi/cpv_expand.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/cpv_expand.py b/pym/portage/dbapi/cpv_expand.py
index b77c283..7077b1f 100644
--- a/pym/portage/dbapi/cpv_expand.py
+++ b/pym/portage/dbapi/cpv_expand.py
@@ -26,7 +26,14 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
 			mykey=myslash[0]+"/"+mysplit[0]
 		else:
 			mykey=mycpv
-		if hasattr(mydb, "cp_list") and \
+
+		# Since Gentoo stopped using old-style virtuals in
+		# 2011, typically it's possible to avoid getvirtuals()
+		# calls entirely. Therefore, only call getvirtuals()
+		# if the atom category is "virtual" and cp_list()
+		# returns nothing.
+		if mykey.startswith("virtual/") and \
+			hasattr(mydb, "cp_list") and \
 			not mydb.cp_list(mykey, use_cache=use_cache):
 				if hasattr(mydb, "vartree"):
 					settings._populate_treeVirtuals_if_needed(mydb.vartree)



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-08 20:50 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-08 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     af0e347c4cf509d0ef3b0ed75a661475cf69ece2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 20:46:40 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May  8 20:48:59 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af0e347c

Add back cpv_exists check from previous commit.

---
 pym/portage/dbapi/vartree.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 7072ce0..1b13e13 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1485,6 +1485,8 @@ class dblink(object):
 				if cpv_lib_map:
 					self._remove_preserved_libs(cpv_lib_map)
 					for cpv, removed in cpv_lib_map.items():
+						if not self.vartree.dbapi.cpv_exists(cpv):
+							continue
 						self.vartree.dbapi.removeFromContents(cpv, removed)
 
 				if unmerge:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-08 20:50 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-08 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     e32d4fc7d06831bc52200d0bef9cedbbdae3d548
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 20:19:47 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May  8 20:48:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e32d4fc7

Remove obsolete others_in_slot plibs code.

This code dates back to commit 79a2ade5a6cb5a6c2d7ace838a39a634265c5522
and the preserve-libs logic was different back then. At that time, the
dblink._preserve_libs() method would earlier register preserved libs
for the new package currently being merged, while the vardb entry was
still a -MERGING- node. Current code does not register preserve_paths
until later, so this others_in_slot code is obsolete.

---
 pym/portage/dbapi/vartree.py |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 156defc..7072ce0 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1462,7 +1462,7 @@ class dblink(object):
 		self.contentscache = pkgfiles
 		return pkgfiles
 
-	def _prune_plib_registry(self, unmerge=False, others_in_slot=[],
+	def _prune_plib_registry(self, unmerge=False,
 		needed=None, preserve_paths=None):
 		# remove preserved libraries that don't have any consumers left
 		plib_registry = self.vartree.dbapi._plib_registry
@@ -1485,15 +1485,6 @@ class dblink(object):
 				if cpv_lib_map:
 					self._remove_preserved_libs(cpv_lib_map)
 					for cpv, removed in cpv_lib_map.items():
-						if not self.vartree.dbapi.cpv_exists(cpv):
-							for dblnk in others_in_slot:
-								if dblnk.mycpv == cpv:
-									# This one just got merged so it doesn't
-									# register with cpv_exists() yet.
-									self.vartree.dbapi.removeFromContents(
-										dblnk, removed)
-									break
-							continue
 						self.vartree.dbapi.removeFromContents(cpv, removed)
 
 				if unmerge:
@@ -1645,8 +1636,7 @@ class dblink(object):
 					showMessage(_("!!! FAILED postrm: %s\n") % retval,
 						level=logging.ERROR, noiselevel=-1)
 
-			self._prune_plib_registry(unmerge=True,
-				others_in_slot=others_in_slot, needed=needed,
+			self._prune_plib_registry(unmerge=True, needed=needed,
 				preserve_paths=preserve_paths)
 		finally:
 			self.vartree.dbapi._bump_mtime(self.mycpv)



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-08 20:50 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-08 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     4a77dba61d86ddf23ad65d6aeefc184cc3fb150f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 19:31:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May  8 19:36:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4a77dba6

treewalk: always initialize "needed"

---
 pym/portage/dbapi/vartree.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 7bef2fc..156defc 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3292,9 +3292,9 @@ class dblink(object):
 		linkmap = self.vartree.dbapi._linkmap
 		plib_registry = self.vartree.dbapi._plib_registry
 		include_file = None
-		if linkmap is None or plib_registry is None:
-			preserve_paths = None
-		else:
+		preserve_paths = None
+		needed = None
+		if not (linkmap is None or plib_registry is None):
 			plib_registry.lock()
 			try:
 				plib_registry.load()



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-05-08 20:50 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-05-08 20:50 UTC (permalink / raw
  To: gentoo-commits

commit:     803ae0b64fd86c66100dc4cf2bd6bb5f2ca71439
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 02:57:29 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May  8 18:50:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=803ae0b6

Add vardbapi reentrant lock/unlock methods.

---
 pym/portage/dbapi/vartree.py |   61 ++++++++++++++++++++++++++---------------
 1 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index c9a02d5..7bef2fc 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -128,6 +128,10 @@ class vardbapi(dbapi):
 				DeprecationWarning, stacklevel=2)
 
 		self._eroot = settings['EROOT']
+		self._dbroot = self._eroot + VDB_PATH
+		self._lock = None
+		self._lock_count = 0
+
 		if vartree is None:
 			vartree = portage.db[self.root]["vartree"]
 		self.vartree = vartree
@@ -164,6 +168,38 @@ class vardbapi(dbapi):
 			rValue = _os.path.join(rValue, filename)
 		return rValue
 
+	def lock(self):
+		"""
+		Acquire a reentrant lock, blocking, for cooperation with concurrent
+		processes. State is inherited by subprocesses, allowing subprocesses
+		to reenter a lock that was acquired by a parent process. However,
+		a lock can be released only by the same process that acquired it.
+		"""
+		if self._lock_count:
+			self._lock_count += 1
+		else:
+			if self._lock is not None:
+				raise AssertionError("already locked")
+			# At least the parent needs to exist for the lock file.
+			ensure_dirs(self._dbroot)
+			self._lock = lockdir(self._dbroot)
+			self._lock_count += 1
+
+	def unlock(self):
+		"""
+		Release a lock, decrementing the recursion level. Each unlock() call
+		must be matched with a prior lock() call, or else an AssertionError
+		will be raised if unlock() is called while not locked.
+		"""
+		if self._lock_count > 1:
+			self._lock_count -= 1
+		else:
+			if self._lock is None:
+				raise AssertionError("not locked")
+			self._lock_count = 0
+			unlockdir(self._lock)
+			self._lock = None
+
 	def _bump_mtime(self, cpv):
 		"""
 		This is called before an after any modifications, so that consumers
@@ -1239,9 +1275,6 @@ class dblink(object):
 		self.dbpkgdir = self.dbcatdir+"/"+pkg
 		self.dbtmpdir = self.dbcatdir+"/-MERGING-"+pkg
 		self.dbdir = self.dbpkgdir
-
-		self._lock_vdb = None
-
 		self.settings = mysettings
 		self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
 
@@ -1280,26 +1313,10 @@ class dblink(object):
 		self._get_protect_obj().updateprotect()
 
 	def lockdb(self):
-		if self._lock_vdb:
-			raise AssertionError("Lock already held.")
-		# At least the parent needs to exist for the lock file.
-		ensure_dirs(self.dbroot)
-		if self._scheduler is None:
-			self._lock_vdb = lockdir(self.dbroot)
-		else:
-			async_lock = AsynchronousLock(path=self.dbroot,
-				scheduler=self._scheduler)
-			async_lock.start()
-			async_lock.wait()
-			self._lock_vdb = async_lock
+		self.vartree.dbapi.lock()
 
 	def unlockdb(self):
-		if self._lock_vdb is not None:
-			if isinstance(self._lock_vdb, AsynchronousLock):
-				self._lock_vdb.unlock()
-			else:
-				unlockdir(self._lock_vdb)
-			self._lock_vdb = None
+		self.vartree.dbapi.unlock()
 
 	def getpath(self):
 		"return path to location of db information (for >>> informational display)"
@@ -4052,8 +4069,8 @@ def unmerge(cat, pkg, myroot=None, settings=None,
 	mylink = dblink(cat, pkg, settings=settings, treetype="vartree",
 		vartree=vartree, scheduler=scheduler)
 	vartree = mylink.vartree
+	mylink.lockdb()
 	try:
-		mylink.lockdb()
 		if mylink.exists():
 			retval = mylink.unmerge(ldpath_mtimes=ldpath_mtimes)
 			if retval == os.EX_OK:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-27 21:00 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-27 21:00 UTC (permalink / raw
  To: gentoo-commits

commit:     e988ead0427787a40f2e9b0c4827d67b876bbda4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 20:57:35 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 21:00:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e988ead0

unmerge: fix lock/UnsupportedAPIException logic

---
 pym/portage/dbapi/vartree.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a9e8ede..8ef7127 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1669,7 +1669,7 @@ class dblink(object):
 						elog_process(self.mycpv, self.settings,
 							phasefilter=('prerm', 'postrm'))
 
-					if retval == os.EX_OK:
+					if retval == os.EX_OK and builddir_lock is not None:
 						# myebuildpath might be None, so ensure
 						# it has a sane value for the clean phase,
 						# even though it won't really be sourced.



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-18 21:12 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-18 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     56a0b8f58a51d1107e11267e39f53c7fd7becc90
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 16 20:58:17 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 18 19:46:59 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=56a0b8f5

iter_owners: try the hashed approach in any case

Previously, the slow approach was used whenever more than 10 files were
given as input. However, large numbers of files don't necessarily
mean the hashed approach is a bad choice, so try it in any case.

---
 pym/portage/dbapi/vartree.py |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 2170335..ce94fa4 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -953,15 +953,7 @@ class vardbapi(dbapi):
 
 			if not isinstance(path_iter, list):
 				path_iter = list(path_iter)
-
-			if len(path_iter) > 10:
-				for x in self._iter_owners_low_mem(path_iter,
-					scheduler=scheduler):
-					yield x
-				return
-
 			owners_cache = self._populate(scheduler=scheduler)
-
 			vardb = self._vardb
 			root = vardb._eroot
 			hash_pkg = owners_cache._hash_pkg



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-14 16:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-14 16:24 UTC (permalink / raw
  To: gentoo-commits

commit:     bc487168cbf3f174bc45318ac1c56f60276c91d9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  7 17:34:02 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 16:22:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bc487168

portdbapi: source ebuilds when eclass dir missing

This will fix bug #357581.

---
 pym/portage/dbapi/porttree.py |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index a407b9d..e1340d1 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -554,8 +554,6 @@ class portdbapi(dbapi):
 		if doregen:
 			if myebuild in self._broken_ebuilds:
 				raise KeyError(mycpv)
-			if not self._have_root_eclass_dir:
-				raise KeyError(mycpv)
 
 			self.doebuild_settings.setcpv(mycpv)
 			eapi = None



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-14 16:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-14 16:24 UTC (permalink / raw
  To: gentoo-commits

commit:     cf7984f4bf2a050be26551c4e696a905711f3c8c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  2 19:46:57 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 16:03:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=cf7984f4

Remove redundant CONTENTS parent dir generation.

This code is redunant now, since similar code has been added to
dblink.getcontents() in commit
e0b4048274b2cfc1617f2eff379cbe8435e13ed4.

---
 pym/portage/dbapi/vartree.py |   29 +----------------------------
 1 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 52f0fba..7395d5d 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -823,23 +823,8 @@ class vardbapi(dbapi):
 				# Empty path is a code used to represent empty contents.
 				self._add_path("", pkg_hash)
 
-			# When adding paths, implicitly add parent directories,
-			# since we can't necessarily assume that they are
-			# explicitly listed in CONTENTS.
-			added_paths = set()
 			for x in contents:
-				x = x[eroot_len:]
-				added_paths.add(x)
-				self._add_path(x, pkg_hash)
-				x_split = x.split(os.sep)
-				x_split.pop()
-				while x_split:
-					parent = os.sep.join(x_split)
-					if parent in added_paths:
-						break
-					added_paths.add(parent)
-					self._add_path(parent, pkg_hash)
-					x_split.pop()
+				self._add_path(x[eroot_len:], pkg_hash)
 
 			self._vardb._aux_cache["modified"].add(cpv)
 
@@ -1893,18 +1878,6 @@ class dblink(object):
 							os = portage.os
 							perf_md5 = portage.checksum.perform_md5
 
-				# Try to unmerge parent directories of everything
-				# listed in CONTENTS, since we can't necessarily
-				# assume that directories are listed in CONTENTS.
-				obj_split = obj.split(os.sep)
-				obj_split.pop()
-				while len(obj_split) > eroot_split_len:
-					parent = os.sep.join(obj_split)
-					if parent in mydirs:
-						break
-					mydirs.add(parent)
-					obj_split.pop()
-
 				file_data = pkgfiles[objkey]
 				file_type = file_data[0]
 				statobj = None



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-14 16:24 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-14 16:24 UTC (permalink / raw
  To: gentoo-commits

commit:     efd2f0cc74a743fcc15f95ff5edae817c341cc49
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  2 18:51:41 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 16:03:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=efd2f0cc

dblink.getcontents(): generate parent directories

We can't necessarily assume that they are explicitly listed in
CONTENTS, and they are crucial for callers such as dblink.isowner().

---
 pym/portage/dbapi/vartree.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 3bc30af..52f0fba 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1403,6 +1403,9 @@ class dblink(object):
 		myroot = self.settings['ROOT']
 		if myroot == os.path.sep:
 			myroot = None
+		# used to generate parent dir entries
+		dir_entry = (_unicode_decode("dir"),)
+		eroot_split_len = len(self.settings["EROOT"].split(os.sep)) - 1
 		pos = 0
 		errors = []
 		for pos, line in enumerate(mylines):
@@ -1447,6 +1450,19 @@ class dblink(object):
 			if myroot is not None:
 				path = os.path.join(myroot, path.lstrip(os.path.sep))
 
+			# Implicitly add parent directories, since we can't necessarily
+			# assume that they are explicitly listed in CONTENTS, and it's
+			# useful for callers if they can rely on parent directory entries
+			# being generated here (crucial for things like dblink.isowner()).
+			path_split = path.split(os.sep)
+			path_split.pop()
+			while len(path_split) > eroot_split_len:
+				parent = os.sep.join(path_split)
+				if parent in pkgfiles:
+					break
+				pkgfiles[parent] = dir_entry
+				path_split.pop()
+
 			pkgfiles[path] = data
 
 		if errors:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-01 21:54 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-01 21:54 UTC (permalink / raw
  To: gentoo-commits

commit:     99e88f2d30761fa7c72660a97da1f516f1075256
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  1 21:20:59 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar  1 21:54:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=99e88f2d

unmerge: log pre/postrm FAILED messages

---
 pym/portage/dbapi/vartree.py |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index fdfbc77..3bc30af 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1518,6 +1518,7 @@ class dblink(object):
 		# Now, don't assume that the name of the ebuild is the same as the
 		# name of the dir; the package may have been moved.
 		myebuildpath = None
+		failures = 0
 		ebuild_phase = "prerm"
 		log_path = None
 		mystuff = os.listdir(self.dbdir)
@@ -1537,16 +1538,18 @@ class dblink(object):
 				doebuild_environment(myebuildpath, "prerm",
 					settings=self.settings, db=self.vartree.dbapi)
 			except UnsupportedAPIException as e:
+				failures += 1
 				# Sometimes this happens due to corruption of the EAPI file.
-				writemsg(_("!!! FAILED prerm: %s\n") % \
-					os.path.join(self.dbdir, "EAPI"), noiselevel=-1)
-				writemsg("%s\n" % str(e), noiselevel=-1)
+				showMessage(_("!!! FAILED prerm: %s\n") % \
+					os.path.join(self.dbdir, "EAPI"),
+					level=logging.ERROR, noiselevel=-1)
+				showMessage("%s\n" % (e,),
+					level=logging.ERROR, noiselevel=-1)
 				myebuildpath = None
 
 		builddir_lock = None
 		scheduler = self._scheduler
 		retval = os.EX_OK
-		failures = 0
 		try:
 			if myebuildpath:
 				builddir_lock = EbuildBuildDir(
@@ -1566,7 +1569,8 @@ class dblink(object):
 				# XXX: Decide how to handle failures here.
 				if retval != os.EX_OK:
 					failures += 1
-					writemsg(_("!!! FAILED prerm: %s\n") % retval, noiselevel=-1)
+					showMessage(_("!!! FAILED prerm: %s\n") % retval,
+						level=logging.ERROR, noiselevel=-1)
 
 			self._unmerge_pkgfiles(pkgfiles, others_in_slot)
 			self._clear_contents_cache()
@@ -1591,7 +1595,8 @@ class dblink(object):
 				# XXX: Decide how to handle failures here.
 				if retval != os.EX_OK:
 					failures += 1
-					writemsg(_("!!! FAILED postrm: %s\n") % retval, noiselevel=-1)
+					showMessage(_("!!! FAILED postrm: %s\n") % retval,
+						level=logging.ERROR, noiselevel=-1)
 
 			# Skip this if another package in the same slot has just been
 			# merged on top of this package, since the other package has



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-01 21:06 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-01 21:06 UTC (permalink / raw
  To: gentoo-commits

commit:     1ea61accd6003965c6a1e55285f7fed7b0587014
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  1 21:04:41 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar  1 21:05:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1ea61acc

owners_cache: fix EPREFIX miscalculation

This reverts commit 43e0b3ea4289aab9b4258d29d06afac40abd6c01 and
renames the root_len variable to eroot_len (for clarity).

---
 pym/portage/dbapi/vartree.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index dc1925d..fdfbc77 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -814,11 +814,9 @@ class vardbapi(dbapi):
 
 		def __init__(self, vardb):
 			self._vardb = vardb
-			self._eprefix_split_len = len(x for x in \
-				vardb.settings["EPREFIX"].split(os.sep) if x)
 
 		def add(self, cpv):
-			root_len = len(self._vardb._eroot)
+			eroot_len = len(self._vardb._eroot)
 			contents = self._vardb._dblink(cpv).getcontents()
 			pkg_hash = self._hash_pkg(cpv)
 			if not contents:
@@ -830,12 +828,12 @@ class vardbapi(dbapi):
 			# explicitly listed in CONTENTS.
 			added_paths = set()
 			for x in contents:
-				x = x[root_len:]
+				x = x[eroot_len:]
 				added_paths.add(x)
 				self._add_path(x, pkg_hash)
 				x_split = x.split(os.sep)
 				x_split.pop()
-				while len(x_split) > self._eprefix_split_len:
+				while x_split:
 					parent = os.sep.join(x_split)
 					if parent in added_paths:
 						break



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-01 20:55 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-01 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     f9895ac7a04ee31af370151f238409cae4ac1a01
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  1 20:07:53 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar  1 20:54:01 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f9895ac7

unmerge: implicitly unmerge parent directories

We can't necessarily assume that they are explicitly listed in
CONTENTS.

---
 pym/portage/dbapi/vartree.py |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index b8881c8..a7a7d40 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1784,7 +1784,7 @@ class dblink(object):
 			mykeys.reverse()
 
 			#process symlinks second-to-last, directories last.
-			mydirs = []
+			mydirs = set()
 			ignored_unlink_errnos = (
 				errno.EBUSY, errno.ENOENT,
 				errno.ENOTDIR, errno.EISDIR)
@@ -1846,6 +1846,7 @@ class dblink(object):
 
 			real_root = self.settings['ROOT']
 			real_root_len = len(real_root) - 1
+			eroot_split_len = len(self.settings["EROOT"].split(os.sep)) - 1
 
 			for i, objkey in enumerate(mykeys):
 
@@ -1871,6 +1872,18 @@ class dblink(object):
 							os = portage.os
 							perf_md5 = portage.checksum.perform_md5
 
+				# Try to unmerge parent directories of everything
+				# listed in CONTENTS, since we can't necessarily
+				# assume that directories are listed in CONTENTS.
+				obj_split = obj.split(os.sep)
+				obj_split.pop()
+				while len(obj_split) > eroot_split_len:
+					parent = os.sep.join(obj_split)
+					if parent in mydirs:
+						break
+					mydirs.add(parent)
+					obj_split.pop()
+
 				file_data = pkgfiles[objkey]
 				file_type = file_data[0]
 				statobj = None
@@ -1939,7 +1952,7 @@ class dblink(object):
 					if lstatobj is None or not stat.S_ISDIR(lstatobj.st_mode):
 						show_unmerge("---", unmerge_desc["!dir"], file_type, obj)
 						continue
-					mydirs.append(obj)
+					mydirs.add(obj)
 				elif pkgfiles[objkey][0] == "sym":
 					if not islink:
 						show_unmerge("---", unmerge_desc["!sym"], file_type, obj)
@@ -1991,7 +2004,7 @@ class dblink(object):
 				elif pkgfiles[objkey][0] == "dev":
 					show_unmerge("---", "", file_type, obj)
 
-			mydirs.sort()
+			mydirs = sorted(mydirs)
 			mydirs.reverse()
 
 			for obj in mydirs:



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-01 20:55 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-01 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     467c37c27fec6b05eb046fb06d4395087bf3565a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  1 20:42:56 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar  1 20:54:29 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=467c37c2

owners_cache: add parent dirs deeper than EPREFIX

---
 pym/portage/dbapi/vartree.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a7a7d40..dc1925d 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -814,6 +814,8 @@ class vardbapi(dbapi):
 
 		def __init__(self, vardb):
 			self._vardb = vardb
+			self._eprefix_split_len = len(x for x in \
+				vardb.settings["EPREFIX"].split(os.sep) if x)
 
 		def add(self, cpv):
 			root_len = len(self._vardb._eroot)
@@ -833,7 +835,7 @@ class vardbapi(dbapi):
 				self._add_path(x, pkg_hash)
 				x_split = x.split(os.sep)
 				x_split.pop()
-				while x_split:
+				while len(x_split) > self._eprefix_split_len:
 					parent = os.sep.join(x_split)
 					if parent in added_paths:
 						break



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-03-01 20:55 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-03-01 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     908f430504c6142a0c0e452e9d9a9dcd808f87c6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Mar  1 18:06:01 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Mar  1 20:53:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=908f4305

owners_cache: implicitly add parent directories

We can't necessarily assume that they are explicitly listed in
CONTENTS.

---
 pym/portage/dbapi/vartree.py |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 9be12fb..b8881c8 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -822,8 +822,25 @@ class vardbapi(dbapi):
 			if not contents:
 				# Empty path is a code used to represent empty contents.
 				self._add_path("", pkg_hash)
+
+			# When adding paths, implicitly add parent directories,
+			# since we can't necessarily assume that they are
+			# explicitly listed in CONTENTS.
+			added_paths = set()
 			for x in contents:
-				self._add_path(x[root_len:], pkg_hash)
+				x = x[root_len:]
+				added_paths.add(x)
+				self._add_path(x, pkg_hash)
+				x_split = x.split(os.sep)
+				x_split.pop()
+				while x_split:
+					parent = os.sep.join(x_split)
+					if parent in added_paths:
+						break
+					added_paths.add(parent)
+					self._add_path(parent, pkg_hash)
+					x_split.pop()
+
 			self._vardb._aux_cache["modified"].add(cpv)
 
 		def _add_path(self, path, pkg_hash):



^ permalink raw reply related	[flat|nested] 47+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/
@ 2011-02-14  4:31 Zac Medico
  0 siblings, 0 replies; 47+ messages in thread
From: Zac Medico @ 2011-02-14  4:31 UTC (permalink / raw
  To: gentoo-commits

commit:     b4fdd78bb0e61c5cca3a55b23fdd2ac3b5141543
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 14 03:59:24 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 14 04:30:55 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b4fdd78b

Fix unhandled FileNotFound from previous commit.

There is an existing handler for EnvironmentError, so raise that
instead of FileNotFound.

---
 pym/portage/dbapi/bintree.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 0271bfa..29c8783 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -807,7 +807,7 @@ class binarytree(object):
 						success = portage.getbinpkg.file_get(url,
 						     tmp_dirname, fcmd=fcmd, filename=tmp_basename)
 						if not success:
-							raise portage.exception.FileNotFound(url)
+							raise EnvironmentError("%s failed" % (setting,))
 						f = open(tmp_filename, 'rb')
 
 				f_dec = codecs.iterdecode(f,



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

end of thread, other threads:[~2011-05-27  2:56 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 20:03 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-05-27  2:56 Zac Medico
2011-05-27  2:16 Zac Medico
2011-05-27  0:05 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-26  6:18 Zac Medico
2011-05-12 20:13 Zac Medico
2011-05-12 17:58 Zac Medico
2011-05-12  7:13 Zac Medico
2011-05-12  5:47 Zac Medico
2011-05-12  5:47 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-12  5:24 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-05-08 20:50 Zac Medico
2011-03-27 21:00 Zac Medico
2011-03-18 21:12 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-01 21:54 Zac Medico
2011-03-01 21:06 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-03-01 20:55 Zac Medico
2011-02-14  4: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