experimental purposes and should not be enabled under normal circumstances.
(trunk r13175)
svn path=/main/branches/2.1.6/; revision=13205
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)
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)
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)
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
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)
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()
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:
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)
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:
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
# 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()
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):
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):
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]
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" % \
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):
for f in pkgdir_files:
if f[:1] == ".":
continue
- elif f[-7:] == ".ebuild":
- mytype = "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"
ps = portage.versions.pkgsplit(pf)
cpv = "%s/%s" % (cat, pf)
if not ps: