On 08/27/05  Brian Harring wrote:

> Hola.
> 
> Attached is a patch that 
> A) adds EAPI awareness to portage; mainly, if >0, complain and be 
>    unwilling to merge the package

Actually I just wrote also a patch for it (for 2.1), however instead of
complaining I just masked them (without unmask ability), just add a
check to gvisible() and getmaskingstatus() (actually just calling
dbapi.eapicheck()). That way it should be more transparent to users IMO.
Won't stop people from using ebuild(1) though.

Marius

PS: I'm aware that the cache changes probably aren't 100% correct.

-- 
Public Key at http://www.genone.de/info/gpg-key.pub

In the beginning, there was nothing. And God said, 'Let there be
Light.' And there was still nothing, but you could see a bit better.
--- pym/portage.py.org	2005-08-23 03:23:59.000000000 +0200
+++ pym/portage.py	2005-09-02 05:49:50.000000000 +0200
@@ -91,7 +90,7 @@
 	  MOVE_BINARY, PRELINK_BINARY, WORLD_FILE, MAKE_CONF_FILE, MAKE_DEFAULTS_FILE, \
 	  DEPRECATED_PROFILE_FILE, USER_VIRTUALS_FILE, EBUILD_SH_ENV_FILE, \
 	  INVALID_ENV_FILE, CUSTOM_MIRRORS_FILE, SANDBOX_PIDS_FILE, CONFIG_MEMORY_FILE,\
-	  INCREMENTALS, STICKIES
+	  INCREMENTALS, STICKIES, EAPI_COMPATIBLE
 
 	from portage_data import ostype, lchown, userland, secpass, uid, wheelgid, \
 	                         portage_uid, portage_gid
@@ -2057,6 +2056,13 @@
 		'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com";] or [] if mycpv not found'
 		raise NotImplementedError
 
+	def eapicheck(self, mycpv, verbose=0):
+		myeapi = self.aux_get(mycpv, ["EAPI"])[0]
+		rval = (myeapi in ['']+EAPI_COMPATIBLE.split())
+		if not rval and verbose:
+			writemsg("Warning: EAPI check failed for %s (has EAPI '%s')" % (mycpv, myeapi))
+		return rval
+
 	def match(self,origdep,use_cache=1):
 		mydep=dep_expand(origdep,mydb=self)
 		mykey=portage_dep.dep_getkey(mydep)
@@ -2667,9 +2673,9 @@
   'DEPEND',    'RDEPEND',   'SLOT',      'SRC_URI',
 	'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
 	'KEYWORDS',  'INHERITED', 'IUSE',      'CDEPEND',
-	'PDEPEND',   'PROVIDE',
+	'PDEPEND',   'PROVIDE', 'EAPI'
 	'UNUSED_01', 'UNUSED_02', 'UNUSED_03', 'UNUSED_04',
-	'UNUSED_05', 'UNUSED_06', 'UNUSED_07', 'UNUSED_08',
+	'UNUSED_05', 'UNUSED_06', 'UNUSED_07', 
 	]
 auxdbkeylen=len(auxdbkeys)
 
@@ -2737,7 +2743,7 @@
 			raise KeyError("CPV %s does not exist" % mycpv)
 		mycp=mysplit[0]+"/"+mysplit[1]
 
-		if settings.pmaskdict.has_key(mycp):
+		if "package.mask" in getmaskingstatus(mycpv) and settings.pmaskdict.has_key(mycp):
 			for x in settings.pmaskdict[mycp]:
 				if mycpv in self.xmatch("match-all", x):
 					pmaskfile = open(settings["PORTDIR"]+"/profiles/package.mask")
@@ -2768,6 +2774,11 @@
 	
 		rValue = []
 
+		# EAPI checking
+		
+		if not db["/"]["porttree"].dbapi.eapicheck(mycpv):
+			rValue.append("EAPI")
+
 		# profile checking
 		revmaskdict=settings.prevmaskdict
 		if revmaskdict.has_key(mycp):
@@ -3286,7 +3297,7 @@
 		return newlist
 
 	def gvisible(self,mylist):
-		"strip out group-masked (not in current group) entries"
+		"strip out group-masked (not in current group) entries and entries with wrong EAPIs"
 		global groups
 		if mylist==None:
 			return []
@@ -3297,7 +3308,7 @@
 			#we need to update this next line when we have fully integrated the new db api
 			auxerr=0
 			try:
-				myaux=db["/"]["porttree"].dbapi.aux_get(mycpv, ["KEYWORDS"])
+				myaux=db["/"]["porttree"].dbapi.aux_get(mycpv, ["KEYWORDS", "EAPI"])
 			except (KeyError,IOError,TypeError):
 				continue
 			if not myaux[0]:
@@ -3305,6 +3316,7 @@
 				#print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"
 				continue
 			mygroups=myaux[0].split()
+			myeapi=myaux[1]
 			pgroups=groups[:]
 			cp = portage_dep.dep_getkey(mycpv)
 			if cp in pkgdict:
@@ -3334,7 +3346,7 @@
 						if gp[0] != "-":
 							match=1
 							break
-			if match:
+			if match and db["/"]["porttree"].dbapi.eapicheck(mycpv):
 				newlist.append(mycpv)
 		return newlist
 
--- bin/ebuild.sh.org	2005-08-23 03:23:46.000000000 +0200
+++ bin/ebuild.sh	2005-09-02 04:29:37.000000000 +0200
@@ -640,6 +640,7 @@
 			[ "$CDEPEND:-unset}" != "unset" ] && 		speak "CDEPEND=$(echo $CDEPEND)"
 			[ "$PDEPEND:-unset}" != "unset" ] && 		speak "PDEPEND=$(echo $PDEPEND)"
 			[ "$PROVIDE:-unset}" != "unset" ] && 		speak "PROVIDE=$(echo $PROVIDE)"
+			[ "$EAPI:-unset}" != "unset" ] && 		speak "EAPI=$(echo $EAPI)"
 			speak 'end_keys'
 			set +f
 			;;
--- bin/ebuild-default-functions.sh.org	2005-08-23 03:24:26.000000000 +0200
+++ bin/ebuild-default-functions.sh	2005-09-02 04:30:05.000000000 +0200
@@ -344,6 +340,7 @@
 	echo "$RDEPEND"		> RDEPEND
 	echo "$RESTRICT"	> RESTRICT
 	echo "$SLOT"		> SLOT
+	echo "$EAPI"		> EAPI
 	echo "$USE"		> USE
 	export_environ "${PORTAGE_BUILDDIR}/build-info/environment.bz2" 'bzip2 -c9'
 	cp "${EBUILD}" "${PF}.ebuild"
--- pym/portage_const.py.org	2005-08-23 01:18:53.000000000 +0200
+++ pym/portage_const.py	2005-09-02 05:44:43.000000000 +0200
@@ -63,3 +63,4 @@
 CVS_BIN                 = "/usr/bin/cvs"
 
 EBUILD_PHASES			= "setup unpack compile test install preinst postinst prerm postrm"
+EAPI_COMPATIBLE			= "0"
--- pym/cache/flat_list.py.org	2005-08-23 01:17:51.000000000 +0200
+++ pym/cache/flat_list.py	2005-09-02 05:14:27.000000000 +0200
@@ -11,7 +11,7 @@
 	auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
 		'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
 		'KEYWORDS',  'IUSE', 'CDEPEND',
-		'PDEPEND',   'PROVIDE','_eclasses_')
+		'PDEPEND',   'PROVIDE', 'EAPI', '_eclasses_')
 
 	def __init__(self, label, auxdbkeys, **config):
 		super(database,self).__init__(label, auxdbkeys, **config)
--- pym/cache/metadata.py.org	2005-08-23 01:17:51.000000000 +0200
+++ pym/cache/metadata.py	2005-09-02 05:53:41.000000000 +0200
@@ -8,7 +8,7 @@
 	auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
 		'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
 		'KEYWORDS',  'INHERITED', 'IUSE', 'CDEPEND',
-		'PDEPEND',   'PROVIDE')
+		'PDEPEND',   'PROVIDE', 'EAPI')
 
 	def __init__(self, label, auxdbkeys, **config):
 		super(database,self).__init__(label, auxdbkeys, **config)

Reply via email to