Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r14442 - in main/trunk/pym: _emerge portage/dbapi
Date: Sat, 26 Sep 2009 23:37:38
Message-Id: E1Mrgpb-0003SV-Cr@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-09-26 23:37:34 +0000 (Sat, 26 Sep 2009)
3 New Revision: 14442
4
5 Modified:
6 main/trunk/pym/_emerge/EbuildBinpkg.py
7 main/trunk/pym/_emerge/EbuildBuild.py
8 main/trunk/pym/_emerge/EbuildBuildDir.py
9 main/trunk/pym/_emerge/EbuildFetcher.py
10 main/trunk/pym/_emerge/EbuildFetchonly.py
11 main/trunk/pym/_emerge/MetadataRegen.py
12 main/trunk/pym/_emerge/Scheduler.py
13 main/trunk/pym/_emerge/depgraph.py
14 main/trunk/pym/portage/dbapi/porttree.py
15 Log:
16 Bug #286522 - Check all portdbapi.findname return values in case it
17 returns None, and raise 'ebuild not found' exceptions when necessary.
18
19
20 Modified: main/trunk/pym/_emerge/EbuildBinpkg.py
21 ===================================================================
22 --- main/trunk/pym/_emerge/EbuildBinpkg.py 2009-09-26 20:48:32 UTC (rev 14441)
23 +++ main/trunk/pym/_emerge/EbuildBinpkg.py 2009-09-26 23:37:34 UTC (rev 14442)
24 @@ -18,7 +18,9 @@
25 root_config = pkg.root_config
26 portdb = root_config.trees["porttree"].dbapi
27 bintree = root_config.trees["bintree"]
28 - ebuild_path = portdb.findname(self.pkg.cpv)
29 + ebuild_path = portdb.findname(pkg.cpv)
30 + if ebuild_path is None:
31 + raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
32 settings = self.settings
33 debug = settings.get("PORTAGE_DEBUG") == "1"
34
35
36 Modified: main/trunk/pym/_emerge/EbuildBuild.py
37 ===================================================================
38 --- main/trunk/pym/_emerge/EbuildBuild.py 2009-09-26 20:48:32 UTC (rev 14441)
39 +++ main/trunk/pym/_emerge/EbuildBuild.py 2009-09-26 23:37:34 UTC (rev 14442)
40 @@ -37,7 +37,9 @@
41 portdb = root_config.trees[tree].dbapi
42 settings.setcpv(pkg)
43 settings.configdict["pkg"]["EMERGE_FROM"] = pkg.type_name
44 - ebuild_path = portdb.findname(self.pkg.cpv)
45 + ebuild_path = portdb.findname(pkg.cpv)
46 + if ebuild_path is None:
47 + raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
48 self._ebuild_path = ebuild_path
49
50 prefetcher = self.prefetcher
51
52 Modified: main/trunk/pym/_emerge/EbuildBuildDir.py
53 ===================================================================
54 --- main/trunk/pym/_emerge/EbuildBuildDir.py 2009-09-26 20:48:32 UTC (rev 14441)
55 +++ main/trunk/pym/_emerge/EbuildBuildDir.py 2009-09-26 23:37:34 UTC (rev 14442)
56 @@ -31,6 +31,9 @@
57 root_config = self.pkg.root_config
58 portdb = root_config.trees["porttree"].dbapi
59 ebuild_path = portdb.findname(self.pkg.cpv)
60 + if ebuild_path is None:
61 + raise AssertionError(
62 + "ebuild not found for '%s'" % self.pkg.cpv)
63 settings = self.settings
64 settings.setcpv(self.pkg)
65 debug = settings.get("PORTAGE_DEBUG") == "1"
66
67 Modified: main/trunk/pym/_emerge/EbuildFetcher.py
68 ===================================================================
69 --- main/trunk/pym/_emerge/EbuildFetcher.py 2009-09-26 20:48:32 UTC (rev 14441)
70 +++ main/trunk/pym/_emerge/EbuildFetcher.py 2009-09-26 23:37:34 UTC (rev 14442)
71 @@ -22,6 +22,8 @@
72 root_config = self.pkg.root_config
73 portdb = root_config.trees["porttree"].dbapi
74 ebuild_path = portdb.findname(self.pkg.cpv)
75 + if ebuild_path is None:
76 + raise AssertionError("ebuild not found for '%s'" % self.pkg.cpv)
77 settings = self.config_pool.allocate()
78 settings.setcpv(self.pkg)
79
80
81 Modified: main/trunk/pym/_emerge/EbuildFetchonly.py
82 ===================================================================
83 --- main/trunk/pym/_emerge/EbuildFetchonly.py 2009-09-26 20:48:32 UTC (rev 14441)
84 +++ main/trunk/pym/_emerge/EbuildFetchonly.py 2009-09-26 23:37:34 UTC (rev 14442)
85 @@ -17,6 +17,8 @@
86 pkg = self.pkg
87 portdb = pkg.root_config.trees["porttree"].dbapi
88 ebuild_path = portdb.findname(pkg.cpv)
89 + if ebuild_path is None:
90 + raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
91 settings.setcpv(pkg)
92 debug = settings.get("PORTAGE_DEBUG") == "1"
93
94 @@ -64,6 +66,8 @@
95 root_config = pkg.root_config
96 portdb = root_config.trees["porttree"].dbapi
97 ebuild_path = portdb.findname(pkg.cpv)
98 + if ebuild_path is None:
99 + raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
100 debug = settings.get("PORTAGE_DEBUG") == "1"
101 retval = portage.doebuild(ebuild_path, "fetch",
102 self.settings["ROOT"], self.settings, debug=debug,
103
104 Modified: main/trunk/pym/_emerge/MetadataRegen.py
105 ===================================================================
106 --- main/trunk/pym/_emerge/MetadataRegen.py 2009-09-26 20:48:32 UTC (rev 14441)
107 +++ main/trunk/pym/_emerge/MetadataRegen.py 2009-09-26 23:37:34 UTC (rev 14442)
108 @@ -60,6 +60,8 @@
109 for cpv in cpv_list:
110 valid_pkgs.add(cpv)
111 ebuild_path, repo_path = portdb.findname2(cpv)
112 + if ebuild_path is None:
113 + raise AssertionError("ebuild not found for '%s'" % cpv)
114 metadata, st, emtime = portdb._pull_valid_cache(
115 cpv, ebuild_path, repo_path)
116 if metadata is not None:
117
118 Modified: main/trunk/pym/_emerge/Scheduler.py
119 ===================================================================
120 --- main/trunk/pym/_emerge/Scheduler.py 2009-09-26 20:48:32 UTC (rev 14441)
121 +++ main/trunk/pym/_emerge/Scheduler.py 2009-09-26 23:37:34 UTC (rev 14442)
122 @@ -580,11 +580,8 @@
123 continue
124 portdb = x.root_config.trees['porttree'].dbapi
125 ebuild_path = portdb.findname(x.cpv)
126 - if not ebuild_path:
127 - writemsg_level(
128 - "!!! Could not locate ebuild for '%s'.\n" \
129 - % x.cpv, level=logging.ERROR, noiselevel=-1)
130 - return 1
131 + if ebuild_path is None:
132 + raise AssertionError("ebuild not found for '%s'" % x.cpv)
133 pkgsettings['O'] = os.path.dirname(ebuild_path)
134 if not portage.digestgen([], pkgsettings, myportdb=portdb):
135 writemsg_level(
136 @@ -628,7 +625,10 @@
137 root_config = x.root_config
138 portdb = root_config.trees["porttree"].dbapi
139 quiet_config = quiet_settings[root_config.root]
140 - quiet_config["O"] = os.path.dirname(portdb.findname(x.cpv))
141 + ebuild_path = portdb.findname(x.cpv)
142 + if ebuild_path is None:
143 + raise AssertionError("ebuild not found for '%s'" % x.cpv)
144 + quiet_config["O"] = os.path.dirname(ebuild_path)
145 if not portage.digestcheck([], quiet_config, strict=True):
146 failures |= 1
147
148
149 Modified: main/trunk/pym/_emerge/depgraph.py
150 ===================================================================
151 --- main/trunk/pym/_emerge/depgraph.py 2009-09-26 20:48:32 UTC (rev 14441)
152 +++ main/trunk/pym/_emerge/depgraph.py 2009-09-26 23:37:34 UTC (rev 14442)
153 @@ -4097,10 +4097,11 @@
154 metadata = pkg.metadata
155 ebuild_path = None
156 repo_name = metadata["repository"]
157 - if pkg_type == "ebuild":
158 - ebuild_path = portdb.findname(pkg_key)
159 - if not ebuild_path: # shouldn't happen
160 - raise portage.exception.PackageNotFound(pkg_key)
161 + if pkg.type_name == "ebuild":
162 + ebuild_path = portdb.findname(pkg.cpv)
163 + if ebuild_path is None:
164 + raise AssertionError(
165 + "ebuild not found for '%s'" % pkg.cpv)
166 repo_path_real = os.path.dirname(os.path.dirname(
167 os.path.dirname(ebuild_path)))
168 else:
169 @@ -4163,9 +4164,14 @@
170 if "--changelog" in self._frozen_config.myopts:
171 inst_matches = vardb.match(pkg.slot_atom)
172 if inst_matches:
173 - changelogs.extend(calc_changelog(
174 - portdb.findname(pkg_key),
175 - inst_matches[0], pkg_key))
176 + ebuild_path_cl = ebuild_path
177 + if ebuild_path_cl is None:
178 + # binary package
179 + ebuild_path_cl = portdb.findname(pkg.cpv)
180 +
181 + if ebuild_path_cl is not None:
182 + changelogs.extend(calc_changelog(
183 + ebuild_path_cl, inst_matches[0], pkg.cpv))
184 else:
185 addl = " " + green("N") + " " + fetch + " "
186 if ordered:
187
188 Modified: main/trunk/pym/portage/dbapi/porttree.py
189 ===================================================================
190 --- main/trunk/pym/portage/dbapi/porttree.py 2009-09-26 20:48:32 UTC (rev 14441)
191 +++ main/trunk/pym/portage/dbapi/porttree.py 2009-09-26 23:37:34 UTC (rev 14442)
192 @@ -447,7 +447,7 @@
193 the file we wanted.
194 """
195 if not mycpv:
196 - return ("", 0)
197 + return (None, 0)
198 mysplit = mycpv.split("/")
199 psplit = pkgsplit(mysplit[1])
200 if psplit is None or len(mysplit) != 2:
201 @@ -614,9 +614,8 @@
202 myebuild, mylocation = self.findname2(mycpv, mytree)
203
204 if not myebuild:
205 - writemsg(_("!!! aux_get(): ebuild path for '%s' not specified:\n") % mycpv,
206 - noiselevel=1)
207 - writemsg("!!! %s\n" % myebuild, noiselevel=1)
208 + writemsg("!!! aux_get(): %s\n" % \
209 + _("ebuild not found for '%s'") % mycpv, noiselevel=1)
210 raise KeyError(mycpv)
211
212 mydata, st, emtime = self._pull_valid_cache(mycpv, myebuild, mylocation)
213 @@ -783,6 +782,8 @@
214 def getfetchsizes(self, mypkg, useflags=None, debug=0):
215 # returns a filename:size dictionnary of remaining downloads
216 myebuild = self.findname(mypkg)
217 + if myebuild is None:
218 + raise AssertionError("ebuild not found for '%s'" % mypkg)
219 pkgdir = os.path.dirname(myebuild)
220 mf = Manifest(pkgdir, self.mysettings["DISTDIR"])
221 checksums = mf.getDigests()
222 @@ -826,6 +827,8 @@
223 useflags = mysettings["USE"].split()
224 myfiles = self.getFetchMap(mypkg, useflags=useflags)
225 myebuild = self.findname(mypkg)
226 + if myebuild is None:
227 + raise AssertionError("ebuild not found for '%s'" % mypkg)
228 pkgdir = os.path.dirname(myebuild)
229 mf = Manifest(pkgdir, self.mysettings["DISTDIR"])
230 mysums = mf.getDigests()