Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12330 - main/trunk/pym/portage/dbapi
Date: Thu, 25 Dec 2008 04:46:31
Message-Id: E1LFi76-0006iR-1Z@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-12-25 04:46:23 +0000 (Thu, 25 Dec 2008)
3 New Revision: 12330
4
5 Modified:
6 main/trunk/pym/portage/dbapi/porttree.py
7 Log:
8 Inside portdbapi._metadata_callback(), preserve _eclasses_ when the EAPI is
9 unsupported since the eclass timestamps might be needed in order to decide
10 that the cache entry should be regenerated. Also, make sure that all metadata
11 returned from portdbapi.aux_get() is returned as empty strings when the
12 EAPI is unsupported.
13
14
15 Modified: main/trunk/pym/portage/dbapi/porttree.py
16 ===================================================================
17 --- main/trunk/pym/portage/dbapi/porttree.py 2008-12-25 04:22:46 UTC (rev 12329)
18 +++ main/trunk/pym/portage/dbapi/porttree.py 2008-12-25 04:46:23 UTC (rev 12330)
19 @@ -296,17 +296,6 @@
20 i = metadata.iteritems()
21 metadata = dict(i)
22
23 - if "EAPI" not in metadata or not metadata["EAPI"].strip():
24 - metadata["EAPI"] = "0"
25 -
26 - if not eapi_is_supported(metadata["EAPI"]):
27 - # if newer version, wipe everything and negate eapi
28 - eapi = metadata["EAPI"]
29 - metadata = {}
30 - for x in self._known_keys:
31 - metadata.setdefault(x, "")
32 - metadata["EAPI"] = "-" + eapi
33 -
34 if metadata.get("INHERITED", False):
35 metadata["_eclasses_"] = \
36 self.eclassdb.get_eclass_data(metadata["INHERITED"].split())
37 @@ -315,6 +304,16 @@
38
39 metadata.pop("INHERITED", None)
40 metadata["_mtime_"] = mtime
41 +
42 + eapi = metadata.get("EAPI")
43 + if not eapi or not eapi.strip():
44 + eapi = "0"
45 + metadata["EAPI"] = eapi
46 + if not eapi_is_supported(eapi):
47 + for k in set(metadata).difference(("_mtime_", "_eclasses_")):
48 + metadata[k] = ""
49 + metadata["EAPI"] = "-" + eapi.lstrip("-")
50 +
51 self.auxdb[repo_path][cpv] = metadata
52
53 def _pull_valid_cache(self, cpv, ebuild_path, repo_path):
54 @@ -425,16 +424,22 @@
55 else:
56 mydata["_eclasses_"] = {}
57
58 - if not mydata.setdefault("EAPI", "0"):
59 - mydata["EAPI"] = "0"
60 -
61 # do we have a origin repository name for the current package
62 mydata["repository"] = self._repository_map.get(
63 os.path.sep.join(myebuild.split(os.path.sep)[:-3]), "")
64
65 mydata["INHERITED"] = ' '.join(mydata.get("_eclasses_", []))
66 - mydata["_mtime_"] = st.st_mtime
67 + mydata["_mtime_"] = long(st.st_mtime)
68
69 + eapi = mydata.get("EAPI")
70 + if not eapi:
71 + eapi = "0"
72 + mydata["EAPI"] = eapi
73 + if not eapi_is_supported(eapi):
74 + for k in set(mydata).difference(("_mtime_", "_eclasses_")):
75 + mydata[k] = ""
76 + mydata["EAPI"] = "-" + eapi.lstrip("-")
77 +
78 #finally, we look at our internal cache entry and return the requested data.
79 returnme = [mydata.get(x, "") for x in mylist]