From: Zac Medico Date: Thu, 25 Dec 2008 05:05:14 +0000 (-0000) Subject: Inside portdbapi._metadata_callback(), preserve _eclasses_ when the EAPI is X-Git-Tag: v2.1.6.3~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=582d080f9f5dc75d7dbf164de4d8b6ab3d2b2fc5;p=portage.git Inside portdbapi._metadata_callback(), preserve _eclasses_ when the EAPI is unsupported since the eclass timestamps might be needed in order to decide that the cache entry should be regenerated. Also, make sure that all metadata returned from portdbapi.aux_get() is returned as empty strings when the EAPI is unsupported. (trunk r12330) svn path=/main/branches/2.1.6/; revision=12336 --- diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 19010bc62..77e6ae494 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -296,17 +296,6 @@ class portdbapi(dbapi): i = metadata.iteritems() metadata = dict(i) - if "EAPI" not in metadata or not metadata["EAPI"].strip(): - metadata["EAPI"] = "0" - - if not eapi_is_supported(metadata["EAPI"]): - # if newer version, wipe everything and negate eapi - eapi = metadata["EAPI"] - metadata = {} - for x in self._known_keys: - metadata.setdefault(x, "") - metadata["EAPI"] = "-" + eapi - if metadata.get("INHERITED", False): metadata["_eclasses_"] = \ self.eclassdb.get_eclass_data(metadata["INHERITED"].split()) @@ -315,6 +304,16 @@ class portdbapi(dbapi): metadata.pop("INHERITED", None) metadata["_mtime_"] = mtime + + eapi = metadata.get("EAPI") + if not eapi or not eapi.strip(): + eapi = "0" + metadata["EAPI"] = eapi + if not eapi_is_supported(eapi): + for k in set(metadata).difference(("_mtime_", "_eclasses_")): + metadata[k] = "" + metadata["EAPI"] = "-" + eapi.lstrip("-") + self.auxdb[repo_path][cpv] = metadata def _pull_valid_cache(self, cpv, ebuild_path, repo_path): @@ -425,15 +424,21 @@ class portdbapi(dbapi): else: mydata["_eclasses_"] = {} - if not mydata.setdefault("EAPI", "0"): - mydata["EAPI"] = "0" - # do we have a origin repository name for the current package mydata["repository"] = self._repository_map.get( os.path.sep.join(myebuild.split(os.path.sep)[:-3]), "") mydata["INHERITED"] = ' '.join(mydata.get("_eclasses_", [])) - mydata["_mtime_"] = st.st_mtime + mydata["_mtime_"] = long(st.st_mtime) + + eapi = mydata.get("EAPI") + if not eapi: + eapi = "0" + mydata["EAPI"] = eapi + if not eapi_is_supported(eapi): + for k in set(mydata).difference(("_mtime_", "_eclasses_")): + mydata[k] = "" + mydata["EAPI"] = "-" + eapi.lstrip("-") #finally, we look at our internal cache entry and return the requested data. returnme = [mydata.get(x, "") for x in mylist]