From: Fabian Groffen Date: Fri, 5 Oct 2007 18:43:13 +0000 (-0000) Subject: Merged from trunk 7908:7913 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=04e2b99665fe39650fda9c147a5349a69c664681;p=portage.git Merged from trunk 7908:7913 | 7909 | Bump EAPI from 0 to 1 and fix eapi_is_supported() so that it | | zmedico | works properly with both 0 and 1. | | 7910 | When the metadata cache contains a negative EAPI, it means | | zmedico | that the cache entry was generated by a version of portage | | | that did not support the eapi. When the user upgrades to a | | | version that now supports the previously unsupported EAPI, | | | those cache entries need to be regenerated. Therefore, when | | | a cache entry has a negative EAPI, check if the EAPI would | | | be supported and trigger a regen if appropriate. | | 7911 | Non-integer EAPI isn't supported. In case it's supported in | | zmedico | the future, assume that it's valid (rather than trigger a | | | regen). | | 7912 | Fix UnsupportedAPIException.__str__() to strip the leading | | zmedico | negative sign (-) from the EAPI, to prevent confusion. | | 7913 | Add EAPI masking support for binary packages. | | zmedico | | svn path=/main/branches/prefix/; revision=7954 --- diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index faa5ea758..ad63d5762 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -1770,8 +1770,11 @@ class depgraph(object): 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] @@ -1781,6 +1784,8 @@ class depgraph(object): 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 \ @@ -1938,15 +1943,24 @@ class depgraph(object): 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) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 88c197a91..8481620bc 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3328,7 +3328,20 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None): 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): diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 9fcff61cd..9e32971a0 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -27,7 +27,7 @@ class bindbapi(fakedbapi): 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): diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index dc54efe5c..83c568fa0 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -282,7 +282,19 @@ class portdbapi(dbapi): 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_"]) diff --git a/pym/portage/exception.py b/pym/portage/exception.py index 3d590a563..7802b8016 100644 --- a/pym/portage/exception.py +++ b/pym/portage/exception.py @@ -80,7 +80,11 @@ class UnsupportedAPIException(PortagePackageException): 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