chost = pkgsettings["CHOST"]
eprefix = pkgsettings["EPREFIX"]
myeb_pkg_matches = []
+ bindb_keys = ["CHOST","EAPI"]
for pkg in bindb.match(x):
- if chost != bindb.aux_get(pkg, ["CHOST"])[0]:
+ metadata = dict(izip(bindb_keys,
+ bindb.aux_get(pkg, bindb_keys)))
+ if chost != metadata["CHOST"]:
continue
pkg_eprefix = bindb.aux_get(pkg, ["EPREFIX"])[0]
if len(pkg_eprefix) < len(eprefix):
continue
+ if not portage.eapi_is_supported(metadata["EAPI"]):
+ continue
# Remove any binary package entries that are
# masked in the portage tree (#55871).
if not usepkgonly and \
if alleb:
chost = pkgsettings["CHOST"]
eprefix = pkgsettings["EPREFIX"]
+ bindb_keys = ["CHOST","EAPI","EPREFIX"]
for p in alleb:
mreasons = []
- pkg_chost = bindb.aux_get(p, ["CHOST"])[0]
- if chost != pkg_chost:
- mreasons.append("CHOST: %s" % pkg_chost)
- pkg_eprefix = bindb.aux_get(p, ["EPREFIX"])[0]
- if not pkg_eprefix:
+ metadata = dict(izip(bindb_keys,
+ bindb.aux_get(pkg, bindb_keys)))
+ if chost != metadata["CHOST"]:
+ mreasons.append("CHOST: %s" % \
+ metadata["CHOST"])
+ if not portage.eapi_is_supported(
+ metadata["EAPI"]):
+ mreasons.append(("required EAPI %s" + \
+ ", supported EAPI %s") % \
+ (metadata["EAPI"],
+ portage.const.EAPI))
+ if not metadata["EPREFIX"]:
mreasons.append("missing EPREFIX")
- elif len(pkg_eprefix.strip()) < len(eprefix):
+ elif len(metadata["EPREFIX"].strip()) < \
+ len(eprefix):
mreasons.append("EPREFIX too small")
print "- "+p+" (masked by: "+", ".join(mreasons)+")"
print "!!! "+red("There are no packages available to satisfy: ")+green(xinfo)
def eapi_is_supported(eapi):
- return str(eapi).strip() == str(portage.const.EAPI).strip()
+ # PREFIX HACK: in prefix we still use EAPI="prefix". To avoid
+ # getting eapi = -1 here and an error by Python because
+ # portage.const.EAPI is a string, we revert to a string compare for
+ # now. Once we use a number, we should remove this crude hack.
+ if portage.const.EAPI == "prefix":
+ return str(eapi).strip() == str(portage.const.EAPI).strip()
+
+ try:
+ eapi = int(str(eapi).strip())
+ except ValueError:
+ eapi = -1
+ if eapi < 0:
+ return False
+ return eapi <= portage.const.EAPI
def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, mydbapi):
self.settings = settings
self._match_cache = {}
# Selectively cache metadata in order to optimize dep matching.
- self._aux_cache_keys = set(["CHOST","SLOT","EPREFIX"])
+ self._aux_cache_keys = set(["CHOST","EAPI","SLOT","EPREFIX"])
self._aux_cache = {}
def match(self, *pargs, **kwargs):
try:
mydata = self.auxdb[mylocation][mycpv]
- if emtime != long(mydata.get("_mtime_", 0)):
+ eapi = mydata.get("EAPI","").strip()
+ if not eapi:
+ eapi = 0
+ try:
+ eapi = int(eapi)
+ except ValueError:
+ # Non-integer EAPI isn't supported. In case it's supported in
+ # the future, assume that it's valid (rather than trigger a
+ # regen).
+ eapi = None
+ if eapi is not None and eapi < 0 and eapi_is_supported(-eapi):
+ doregen = True
+ elif emtime != long(mydata.get("_mtime_", 0)):
doregen = True
elif len(mydata.get("_eclasses_", [])) > 0:
doregen = not self.eclassdb.is_eclass_data_valid(mydata["_eclasses_"])
def __init__(self, cpv, eapi):
self.cpv, self.eapi = cpv, eapi
def __str__(self):
- return "Unable to do any operations on '%s', due to the fact it's EAPI is higher then this portage versions. Please upgrade to a portage version that supports EAPI %s" % (self.cpv, self.eapi)
+ msg = ("Unable to do any operations on '%s', since " + \
+ "it's EAPI is higher than this portage version's. Please upgrade" + \
+ " to a portage version that supports EAPI '%s'.") % \
+ (self.cpv, str(self.eapi).lstrip("-"))
+ return msg