public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r13205 - in main/branches/2.1.6: bin man pym/_emerge pym/portage pym/portage/dbapi
@ 2009-03-27  4:25 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-03-27  4:25 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-03-27 04:25:35 +0000 (Fri, 27 Mar 2009)
New Revision: 13205

Modified:
   main/branches/2.1.6/bin/ebuild
   main/branches/2.1.6/man/make.conf.5
   main/branches/2.1.6/pym/_emerge/__init__.py
   main/branches/2.1.6/pym/portage/__init__.py
   main/branches/2.1.6/pym/portage/dbapi/porttree.py
   main/branches/2.1.6/pym/portage/manifest.py
Log:
Add support for FEATURES=parse-eapi-glep-55. This feature is only intended for
experimental purposes and should not be enabled under normal circumstances.
(trunk r13175)


Modified: main/branches/2.1.6/bin/ebuild
===================================================================
--- main/branches/2.1.6/bin/ebuild	2009-03-27 04:16:04 UTC (rev 13204)
+++ main/branches/2.1.6/bin/ebuild	2009-03-27 04:25:35 UTC (rev 13205)
@@ -83,7 +83,14 @@
 
 ebuild = pargs.pop(0)
 
-if not ebuild.endswith(".ebuild"):
+pf = None
+if 'parse-eapi-glep-55' in portage.settings.features:
+	pf, eapi = portage._split_ebuild_name_glep55(
+		os.path.basename(ebuild))
+elif ebuild.endswith(".ebuild"):
+	pf = os.path.basename(ebuild)[:-7]
+
+if pf is None:
 	portage.writemsg("'%s' does not end with '.ebuild'.\n" % \
 		(ebuild,), noiselevel=-1)
 	sys.exit(1)
@@ -120,8 +127,7 @@
 	sys.exit(1)
 
 ebuild_split = ebuild.split("/")
-del ebuild_split[-2]
-cpv = "/".join(ebuild_split[-2:])[:-7]
+cpv = "%s/%s" % (ebuild_split[-3], pf)
 
 if not portage.catpkgsplit(cpv):
 	print "!!! %s does not follow correct package syntax." % (cpv)
@@ -158,8 +164,6 @@
 		portage._doebuild_manifest_exempt_depend += 1
 		pkgdir = os.path.dirname(myebuild)
 		fetchlist_dict = portage.FetchlistDict(pkgdir, mysettings, mydbapi)
-		cat, pkg = pkgdir.split(os.sep)[-2:]
-		cpv = cat + "/" + os.path.basename(myebuild)[:-7]
 		from portage.manifest import Manifest
 		mf = Manifest(pkgdir, mysettings["DISTDIR"],
 			fetchlist_dict=fetchlist_dict, manifest1_compat=False)

Modified: main/branches/2.1.6/man/make.conf.5
===================================================================
--- main/branches/2.1.6/man/make.conf.5	2009-03-27 04:16:04 UTC (rev 13204)
+++ main/branches/2.1.6/man/make.conf.5	2009-03-27 04:25:35 UTC (rev 13205)
@@ -274,6 +274,11 @@
 is only intended for experimental purposes and should not be enabled under
 normal circumstances.
 .TP
+.B parse\-eapi\-glep\-55
+Parse \fBEAPI\fR from the file extension of the ebuild. This feature
+is only intended for experimental purposes and should not be enabled under
+normal circumstances.
+.TP
 .B protect\-owned
 This is identical to the \fIcollision\-protect\fR feature except that files
 may be overwritten if they are not explicitly listed in the contents of a

Modified: main/branches/2.1.6/pym/_emerge/__init__.py
===================================================================
--- main/branches/2.1.6/pym/_emerge/__init__.py	2009-03-27 04:16:04 UTC (rev 13204)
+++ main/branches/2.1.6/pym/_emerge/__init__.py	2009-03-27 04:25:35 UTC (rev 13205)
@@ -3018,9 +3018,16 @@
 		settings.setcpv(self.cpv)
 		ebuild_path = self.ebuild_path
 
-		if 'parse-eapi-ebuild-head' in settings.features:
+		eapi = None
+		if 'parse-eapi-glep-55' in settings.features:
+			pf, eapi = portage._split_ebuild_name_glep55(
+				os.path.basename(ebuild_path))
+		if eapi is None and \
+			'parse-eapi-ebuild-head' in settings.features:
 			eapi = portage._parse_eapi_ebuild_head(codecs.open(ebuild_path,
 				mode='r', encoding='utf_8', errors='replace'))
+
+		if eapi is not None:
 			if not portage.eapi_is_supported(eapi):
 				self.metadata_callback(self.cpv, self.ebuild_path,
 					self.repo_path, {'EAPI' : eapi}, self.ebuild_mtime)

Modified: main/branches/2.1.6/pym/portage/__init__.py
===================================================================
--- main/branches/2.1.6/pym/portage/__init__.py	2009-03-27 04:16:04 UTC (rev 13204)
+++ main/branches/2.1.6/pym/portage/__init__.py	2009-03-27 04:25:35 UTC (rev 13205)
@@ -1780,9 +1780,12 @@
 
 			self["FEATURES"] = " ".join(sorted(self.features))
 			self.backup_changes("FEATURES")
-			global _validate_cache_for_unsupported_eapis
+			global _glep_55_enabled, _validate_cache_for_unsupported_eapis
 			if 'parse-eapi-ebuild-head' in self.features:
 				_validate_cache_for_unsupported_eapis = False
+			if 'parse-eapi-glep-55' in self.features:
+				_validate_cache_for_unsupported_eapis = False
+				_glep_55_enabled = True
 
 			self._init_dirs()
 
@@ -4646,8 +4649,14 @@
 		writemsg("!!! Expected: %s\n" % e.value[3], noiselevel=-1)
 		return 0
 	# Make sure that all of the ebuilds are actually listed in the Manifest.
+	glep55 = 'parse-eapi-glep-55' in mysettings.features
 	for f in os.listdir(pkgdir):
-		if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f):
+		pf = None
+		if glep55:
+			pf, eapi = _split_ebuild_name_glep55(f)
+		elif f[-7:] == '.ebuild':
+			pf = f[:-7]
+		if pf is not None and not mf.hasFile("EBUILD", f):
 			writemsg("!!! A file is not listed in the Manifest: '%s'\n" % \
 				os.path.join(pkgdir, f), noiselevel=-1)
 			if strict:
@@ -5041,6 +5050,20 @@
 			break
 	return '0'
 
+# True when FEATURES=parse-eapi-glep-55 is enabled.
+_glep_55_enabled = False
+
+_split_ebuild_name_glep55_re = re.compile(r'^(.*)\.ebuild(-([^.]+))?$')
+
+def _split_ebuild_name_glep55(name):
+	"""
+	@returns: (pkg-ver-rev, eapi)
+	"""
+	m = _split_ebuild_name_glep55_re.match(name)
+	if m is None:
+		return (None, None)
+	return (m.group(1), m.group(3))
+
 def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, mydbapi):
 
 	ebuild_path = os.path.abspath(myebuild)
@@ -5050,7 +5073,14 @@
 		cat = mysettings.configdict["pkg"]["CATEGORY"]
 	else:
 		cat = os.path.basename(normalize_path(os.path.join(pkg_dir, "..")))
-	mypv = os.path.basename(ebuild_path)[:-7]	
+
+	eapi = None
+	if 'parse-eapi-glep-55' in mysettings.features:
+		mypv, eapi = portage._split_ebuild_name_glep55(
+			os.path.basename(myebuild))
+	else:
+		mypv = os.path.basename(ebuild_path)[:-7]
+
 	mycpv = cat+"/"+mypv
 	mysplit=pkgsplit(mypv,silent=0)
 	if mysplit is None:
@@ -5114,14 +5144,20 @@
 		mysettings["PORTAGE_QUIET"] = "1"
 
 	if mydo == 'depend' and \
-		'EAPI' not in mysettings.configdict['pkg'] and \
-		'parse-eapi-ebuild-head' in mysettings.features:
-		eapi = _parse_eapi_ebuild_head(codecs.open(ebuild_path,
-			mode='r', encoding='utf_8', errors='replace'))
-		if not eapi_is_supported(eapi):
-			raise portage.exception.UnsupportedAPIException(mycpv, eapi)
-		mysettings.configdict['pkg']['EAPI'] = eapi
+		'EAPI' not in mysettings.configdict['pkg']:
 
+		if eapi is not None:
+			# From parse-eapi-glep-55 above.
+			mysettings.configdict['pkg']['EAPI'] = eapi
+		elif 'parse-eapi-ebuild-head' in mysettings.features:
+			eapi = _parse_eapi_ebuild_head(codecs.open(ebuild_path,
+				mode='r', encoding='utf_8', errors='replace'))
+
+		if eapi is not None:
+			if not eapi_is_supported(eapi):
+				raise portage.exception.UnsupportedAPIException(mycpv, eapi)
+			mysettings.configdict['pkg']['EAPI'] = eapi
+
 	if mydo != "depend":
 		# Metadata vars such as EAPI and RESTRICT are
 		# set by the above config.setcpv() call.
@@ -5691,8 +5727,14 @@
 
 			# Make sure that all of the ebuilds are
 			# actually listed in the Manifest.
+			glep55 = 'parse-eapi-glep-55' in mysettings.features
 			for f in os.listdir(pkgdir):
-				if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f):
+				pf = None
+				if glep55:
+					pf, eapi = _split_ebuild_name_glep55(f)
+				elif f[-7:] == '.ebuild':
+					pf = f[:-7]
+				if pf is not None and not mf.hasFile("EBUILD", f):
 					f = os.path.join(pkgdir, f)
 					if f not in _doebuild_broken_ebuilds:
 						out = portage.output.EOutput()

Modified: main/branches/2.1.6/pym/portage/dbapi/porttree.py
===================================================================
--- main/branches/2.1.6/pym/portage/dbapi/porttree.py	2009-03-27 04:16:04 UTC (rev 13204)
+++ main/branches/2.1.6/pym/portage/dbapi/porttree.py	2009-03-27 04:25:35 UTC (rev 13205)
@@ -279,8 +279,24 @@
 		else:
 			mytrees = self.porttrees[:]
 			mytrees.reverse()
-		if psplit:
+		if 'parse-eapi-glep-55' in self.doebuild_settings.features:
+			glep55_startswith = '%s.ebuild-' % mysplit[1]
 			for x in mytrees:
+				filename = os.path.join(x, mysplit[0], psplit[0],
+					mysplit[1] + ".ebuild")
+				if os.access(filename, os.R_OK):
+					return (filename, x)
+
+				pkgdir = os.path.join(x, mysplit[0], psplit[0])
+				try:
+					files = os.listdir(pkgdir)
+				except OSError:
+					continue
+				for y in files:
+					if y.startswith(glep55_startswith):
+						return (os.path.join(pkgdir, y), x)
+		else:
+			for x in mytrees:
 				file=x+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
 				if os.access(file, os.R_OK):
 					return[file, x]
@@ -421,9 +437,15 @@
 			mydata = {}
 			eapi = None
 
-			if 'parse-eapi-ebuild-head' in self.doebuild_settings.features:
+			if 'parse-eapi-glep-55' in self.doebuild_settings.features:
+				pf, eapi = portage._split_ebuild_name_glep55(
+					os.path.basename(myebuild))
+			if eapi is None and \
+				'parse-eapi-ebuild-head' in self.doebuild_settings.features:
 				eapi = portage._parse_eapi_ebuild_head(codecs.open(myebuild,
 					mode='r', encoding='utf_8', errors='replace'))
+
+			if eapi is not None:
 				self.doebuild_settings.configdict['pkg']['EAPI'] = eapi
 
 			if eapi is not None and not portage.eapi_is_supported(eapi):
@@ -666,6 +688,7 @@
 				return cachelist[:]
 		mysplit = mycp.split("/")
 		invalid_category = mysplit[0] not in self._categories
+		glep55 = 'parse-eapi-glep-55' in self.doebuild_settings.features
 		d={}
 		if mytree:
 			mytrees = [mytree]
@@ -677,8 +700,14 @@
 			except OSError:
 				continue
 			for x in file_list:
-				if x.endswith(".ebuild"):
+
+				pf = None
+				if glep55:
+					pf, eapi = portage._split_ebuild_name_glep55(x)
+				elif x[-7:] == '.ebuild':
 					pf = x[:-7]
+
+				if pf is not None:
 					ps = pkgsplit(pf)
 					if not ps:
 						writemsg("\nInvalid ebuild name: %s\n" % \

Modified: main/branches/2.1.6/pym/portage/manifest.py
===================================================================
--- main/branches/2.1.6/pym/portage/manifest.py	2009-03-27 04:16:04 UTC (rev 13204)
+++ main/branches/2.1.6/pym/portage/manifest.py	2009-03-27 04:25:35 UTC (rev 13205)
@@ -27,6 +27,10 @@
 
 def manifest2MiscfileFilter(filename):
 	filename = filename.strip(os.sep)
+	if portage._glep_55_enabled:
+		pf, eapi = portage._split_ebuild_name_glep55(filename)
+		if pf is not None:
+			return False
 	return not (filename in ["CVS", ".svn", "files", "Manifest"] or filename.endswith(".ebuild"))
 
 def guessManifestFileType(filename):
@@ -307,9 +311,13 @@
 		for f in pkgdir_files:
 			if f[:1] == ".":
 				continue
-			elif f[-7:] == ".ebuild":
+			pf = None
+			if portage._glep_55_enabled:
+				pf, eapi = portage._split_ebuild_name_glep55(f)
+			elif f[-7:] == '.ebuild':
+				pf = f[:-7]
+			if pf is not None:
 				mytype = "EBUILD"
-				pf = f[:-7]
 				ps = portage.versions.pkgsplit(pf)
 				cpv = "%s/%s" % (cat, pf)
 				if not ps:




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

only message in thread, other threads:[~2009-03-27  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-27  4:25 [gentoo-commits] portage r13205 - in main/branches/2.1.6: bin man pym/_emerge pym/portage pym/portage/dbapi Zac Medico (zmedico)

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