From 70c1c399615ae3a2ed15d1684a99f32126305d15 Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gentoo.org>
Date: Sat, 4 Jun 2011 17:08:08 -0700
Subject: [PATCH] Uniformly check EAPI when avoiding setcpv calls.

---
 pym/portage/dbapi/_MergeProcess.py     | 2 +-
 pym/portage/dbapi/vartree.py           | 2 +-
 pym/portage/package/ebuild/doebuild.py | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
index 78e1ecd67..3b9ad8284 100644
--- a/pym/portage/dbapi/_MergeProcess.py
+++ b/pym/portage/dbapi/_MergeProcess.py
@@ -41,7 +41,7 @@ class MergeProcess(SpawnProcess):
 		cpv = "%s/%s" % (self.mycat, self.mypkg)
 		settings = self.settings
 		if cpv != settings.mycpv or \
-			"IUSE" not in settings.configdict["pkg"]:
+			"EAPI" not in settings.configdict["pkg"]:
 			settings.reload()
 			settings.reset()
 			settings.setcpv(cpv, mydb=self.mydbapi)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 16cf48b76..5c6166ca4 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1676,7 +1676,7 @@ class dblink(object):
 				break
 
 		if self.mycpv != self.settings.mycpv or \
-			"SLOT" not in self.settings.configdict["pkg"]:
+			"EAPI" 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)
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 4cdd76593..5c81fbd45 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -167,12 +167,12 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 			# call would lead to infinite 'depend' phase recursion.
 			mysettings.setcpv(mycpv)
 	else:
-		# If IUSE isn't in configdict['pkg'], it means that setcpv()
+		# If EAPI isn't in configdict["pkg"], it means that setcpv()
 		# hasn't been called with the mydb argument, so we have to
 		# call it here (portage code always calls setcpv properly,
 		# but api consumers might not).
 		if mycpv != mysettings.mycpv or \
-			'IUSE' not in mysettings.configdict['pkg']:
+			"EAPI" not in mysettings.configdict["pkg"]:
 			# Reload env.d variables and reset any previous settings.
 			mysettings.reload()
 			mysettings.reset()
-- 
2.26.2