Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11615 - in main/branches/prefix: bin doc/config pym/_emerge pym/portage/elog pym/portage/sets
Date: Fri, 03 Oct 2008 17:09:04
Message-Id: E1KlnuB-0007W7-4i@stork.gentoo.org
1 Author: grobian
2 Date: 2008-10-03 16:53:25 +0000 (Fri, 03 Oct 2008)
3 New Revision: 11615
4
5 Modified:
6 main/branches/prefix/bin/isolated-functions.sh
7 main/branches/prefix/doc/config/sets.docbook
8 main/branches/prefix/pym/_emerge/__init__.py
9 main/branches/prefix/pym/portage/elog/messages.py
10 main/branches/prefix/pym/portage/sets/__init__.py
11 main/branches/prefix/pym/portage/sets/base.py
12 main/branches/prefix/pym/portage/sets/dbapi.py
13 Log:
14 Merged from trunk -r11593:11602
15
16 | 11594 | For compatibility with long-standing --columns behavior, do |
17 | zmedico | not display "uninstall" or satsified "blocks" nodes in the |
18 | | merge list when --columns is enabled. Thanks to solar for |
19 | | the suggestion. |
20
21 | 11595 | make sure that cli-defined sets aren't added to @world |
22 | genone | |
23
24 | 11596 | allow selection of metadata source for VariableSet |
25 | genone | |
26
27 | 11597 | remove the 'repository' option from CategorySet in favor of |
28 | genone | the generic 'intersect' option |
29
30 | 11598 | Add a new DummyPackageSet handler to make set operators |
31 | genone | easier to use |
32
33 | 11599 | allow the portage.sets. prefix to be omitted in 'class' |
34 | genone | options of set definitions |
35
36 | 11600 | Bug #239006 - In FakeVartree._aux_get_wrapper(), fall back |
37 | zmedico | to vdb metadata if the live ebuild's EAPI is unsupported. |
38
39 | 11601 | Now that elog_base() uses 'echo -e' to expand escape codes |
40 | zmedico | prior to using 'read' to split on newlines, it's safe to use |
41 | | newlines as delimiters in the log file since 'read' is |
42 | | guaranteed to split any newlines contained in the arguments. |
43
44 | 11602 | Handle InvalidDependString from portdbapi.getFetchMap() |
45 | zmedico | inside search.output(). Thanks to agaffney for reporting. |
46
47
48 Modified: main/branches/prefix/bin/isolated-functions.sh
49 ===================================================================
50 --- main/branches/prefix/bin/isolated-functions.sh 2008-10-03 16:50:31 UTC (rev 11614)
51 +++ main/branches/prefix/bin/isolated-functions.sh 2008-10-03 16:53:25 UTC (rev 11615)
52 @@ -177,12 +177,8 @@
53 return 1
54 ;;
55 esac
56 - # Note: Even though the message is split on $'\n' here, it's still
57 - # not entirely safe to use it as a delimiter in the log file since
58 - # there can still be escaped newlines that will be expanded due to
59 - # the echo -e parameter.
60 echo -e "$@" | while read line ; do
61 - echo -ne "${messagetype} ${line}\n\0" >> \
62 + echo "${messagetype} ${line}" >> \
63 "${T}/logging/${EBUILD_PHASE:-other}"
64 done
65 return 0
66
67 Modified: main/branches/prefix/doc/config/sets.docbook
68 ===================================================================
69 --- main/branches/prefix/doc/config/sets.docbook 2008-10-03 16:50:31 UTC (rev 11614)
70 +++ main/branches/prefix/doc/config/sets.docbook 2008-10-03 16:53:25 UTC (rev 11615)
71 @@ -123,8 +123,8 @@
72 [installed category packages]
73 class = portage.sets.dbapi.CategorySet
74 multiset = true
75 - repository = vartree
76 name_pattern = $category/*
77 + intersect = installed
78 </programlisting>
79 </para>
80 <!-- TODO: reference list of available set handler classes here -->
81 @@ -437,13 +437,6 @@
82 <listitem><varname>category</varname>: Required. The name of an existing ebuild
83 category which should be used to create the package set.
84 </listitem>
85 - <listitem><varname>repository</varname>: Optional, defaults to
86 - <parameter>porttree</parameter>. It determines which repository class should
87 - be used to create the package set. Valid values for this option are:
88 - <parameter>porttree</parameter> (normal ebuild repository),
89 - <parameter>vartree</parameter> (installed package repository)
90 - and <parameter>bintree</parameter> (local binary package repository).
91 - </listitem>
92 <listitem><varname>only_visible</varname>: Optional, defaults to <parameter>true</parameter>.
93 When set to <parameter>true</parameter> the set will only include visible packages,
94 when set to <parameter>false</parameter> it will also include masked packages.
95 @@ -523,6 +516,9 @@
96 values that must not be contained within the specified
97 variable.
98 </listitem>
99 + <listitem><varname>metadata-source</varname>: Optional, defaults to
100 + "vartree". Specifies the repository to use for getting the metadata
101 + to check.</listitem>
102 </itemizedlist>
103 </para>
104 </sect2>
105
106 Modified: main/branches/prefix/pym/_emerge/__init__.py
107 ===================================================================
108 --- main/branches/prefix/pym/_emerge/__init__.py 2008-10-03 16:50:31 UTC (rev 11614)
109 +++ main/branches/prefix/pym/_emerge/__init__.py 2008-10-03 16:53:25 UTC (rev 11615)
110 @@ -699,12 +699,18 @@
111 from portage import manifest
112 mf = manifest.Manifest(
113 pkgdir, self.settings["DISTDIR"])
114 - fetchlist = self.portdb.getFetchMap(mycpv)
115 try:
116 - mysum[0] = mf.getDistfilesSize(fetchlist)
117 - except KeyError, e:
118 - file_size_str = "Unknown (missing digest for %s)" % \
119 - str(e)
120 + uri_map = self.portdb.getFetchMap(mycpv)
121 + except portage.exception.InvalidDependString, e:
122 + file_size_str = "Unknown (%s)" % (e,)
123 + del e
124 + else:
125 + try:
126 + mysum[0] = mf.getDistfilesSize(uri_map)
127 + except KeyError, e:
128 + file_size_str = "Unknown (missing " + \
129 + "digest for %s)" % (e,)
130 + del e
131
132 available = False
133 for db in self._dbs:
134 @@ -1117,7 +1123,7 @@
135 self._match = self.dbapi.match
136 self.dbapi.match = self._match_wrapper
137 self._aux_get_history = set()
138 - self._portdb_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
139 + self._portdb_keys = ["EAPI", "DEPEND", "RDEPEND", "PDEPEND"]
140 self._portdb = portdb
141 self._global_updates = None
142
143 @@ -1143,6 +1149,8 @@
144 # Use the live ebuild metadata if possible.
145 live_metadata = dict(izip(self._portdb_keys,
146 self._portdb.aux_get(pkg, self._portdb_keys)))
147 + if not portage.eapi_is_supported(live_metadata["EAPI"]):
148 + raise KeyError(pkg)
149 self.dbapi.aux_update(pkg, live_metadata)
150 except (KeyError, portage.exception.PortageException):
151 if self._global_updates is None:
152 @@ -6729,6 +6737,7 @@
153 favorites_set = InternalPackageSet(favorites)
154 oneshot = "--oneshot" in self.myopts or \
155 "--onlydeps" in self.myopts
156 + columns = "--columns" in self.myopts
157 changelogs=[]
158 p=[]
159 blockers = []
160 @@ -7004,6 +7013,8 @@
161 addl += colorize(blocker_style,
162 " (is blocking %s)") % block_parents
163 if isinstance(x, Blocker) and x.satisfied:
164 + if columns:
165 + continue
166 p.append(addl)
167 else:
168 blockers.append(addl)
169 @@ -7396,6 +7407,8 @@
170 (pkgprint(pkg_type), addl, indent,
171 pkgprint(pkg.cpv), myoldbest)
172
173 + if columns and pkg.operation == "uninstall":
174 + continue
175 p.append((myprint, verboseadd, repoadd))
176
177 if "--tree" not in self.myopts and \
178
179 Modified: main/branches/prefix/pym/portage/elog/messages.py
180 ===================================================================
181 --- main/branches/prefix/pym/portage/elog/messages.py 2008-10-03 16:50:31 UTC (rev 11614)
182 +++ main/branches/prefix/pym/portage/elog/messages.py 2008-10-03 16:53:25 UTC (rev 11615)
183 @@ -35,7 +35,7 @@
184 logentries[msgfunction] = []
185 lastmsgtype = None
186 msgcontent = []
187 - for l in open(filename, "r").read().split("\0"):
188 + for l in open(filename, "rb"):
189 if not l:
190 continue
191 try:
192
193 Modified: main/branches/prefix/pym/portage/sets/__init__.py
194 ===================================================================
195 --- main/branches/prefix/pym/portage/sets/__init__.py 2008-10-03 16:50:31 UTC (rev 11614)
196 +++ main/branches/prefix/pym/portage/sets/__init__.py 2008-10-03 16:53:25 UTC (rev 11615)
197 @@ -37,6 +37,7 @@
198 self.errors = []
199 if not setname in self.psets:
200 options["name"] = setname
201 + options["world-candidate"] = "False"
202
203 # for the unlikely case that there is already a section with the requested setname
204 import random
205 @@ -69,8 +70,11 @@
206 try:
207 setclass = load_mod(classname)
208 except (ImportError, AttributeError):
209 - self.errors.append("Could not import '%s' for section '%s'" % (classname, sname))
210 - continue
211 + try:
212 + setclass = load_mod("portage.sets."+classname)
213 + except (ImportError, AttributeError):
214 + self.errors.append("Could not import '%s' for section '%s'" % (classname, sname))
215 + continue
216 # prepare option dict for the current section
217 optdict = {}
218 for oname in self.options(sname):
219
220 Modified: main/branches/prefix/pym/portage/sets/base.py
221 ===================================================================
222 --- main/branches/prefix/pym/portage/sets/base.py 2008-10-03 16:50:31 UTC (rev 11614)
223 +++ main/branches/prefix/pym/portage/sets/base.py 2008-10-03 16:53:25 UTC (rev 11615)
224 @@ -219,3 +219,16 @@
225 def write(self):
226 pass
227
228 +class DummyPackageSet(PackageSet):
229 + def __init__(self, atoms=None):
230 + super(DummyPackageSet, self).__init__()
231 + if atoms:
232 + self._setAtoms(atoms)
233 +
234 + def load(self):
235 + pass
236 +
237 + def singleBuilder(cls, options, settings, trees):
238 + atoms = options.get("packages", "").split()
239 + return DummyPackageSet(atoms=atoms)
240 + singleBuilder = classmethod(singleBuilder)
241
242 Modified: main/branches/prefix/pym/portage/sets/dbapi.py
243 ===================================================================
244 --- main/branches/prefix/pym/portage/sets/dbapi.py 2008-10-03 16:50:31 UTC (rev 11614)
245 +++ main/branches/prefix/pym/portage/sets/dbapi.py 2008-10-03 16:53:25 UTC (rev 11615)
246 @@ -2,7 +2,7 @@
247 # Distributed under the terms of the GNU General Public License v2
248 # $Id$
249
250 -from portage.versions import catpkgsplit, catsplit, pkgcmp
251 +from portage.versions import catpkgsplit, catsplit, pkgcmp, best
252 from portage.dep import Atom
253 from portage.sets.base import PackageSet
254 from portage.sets import SetConfigError, get_boolean
255 @@ -96,18 +96,18 @@
256 description = "Package set which contains all packages " + \
257 "that match specified values of a specified variable."
258
259 - def __init__(self, vardb, portdb=None, variable=None, includes=None, excludes=None):
260 + def __init__(self, vardb, metadatadb=None, variable=None, includes=None, excludes=None):
261 super(VariableSet, self).__init__(vardb)
262 - self._portdb = portdb
263 + self._metadatadb = metadatadb
264 self._variable = variable
265 self._includes = includes
266 self._excludes = excludes
267
268 def _filter(self, atom):
269 - ebuild = self._portdb.xmatch("bestmatch-visible", atom)
270 + ebuild = best(self._metadatadb.match(atom))
271 if not ebuild:
272 return False
273 - values, = self._portdb.aux_get(ebuild, [self._variable])
274 + values, = self._metadatadb.aux_get(ebuild, [self._variable])
275 values = values.split()
276 if self._includes and not self._includes.intersection(values):
277 return False
278 @@ -126,9 +126,13 @@
279
280 if not (includes or excludes):
281 raise SetConfigError("no includes or excludes given")
282 +
283 + metadatadb = options.get("metadata-source", "vartree")
284 + if not metadatadb in trees.keys():
285 + raise SetConfigError("invalid value '%s' for option metadata-source" % metadatadb)
286
287 return cls(trees["vartree"].dbapi,
288 - portdb=trees["porttree"].dbapi,
289 + metadatadb=trees[metadatadb].dbapi,
290 excludes=frozenset(excludes.split()),
291 includes=frozenset(includes.split()),
292 variable=variable)
293 @@ -197,13 +201,6 @@
294 myatoms.append(cp)
295 self._setAtoms(myatoms)
296
297 - def _builderGetRepository(cls, options, repositories):
298 - repository = options.get("repository", "porttree")
299 - if not repository in repositories:
300 - raise SetConfigError("invalid repository class '%s'" % repository)
301 - return repository
302 - _builderGetRepository = classmethod(_builderGetRepository)
303 -
304 def _builderGetVisible(cls, options):
305 return get_boolean(options, "only_visible", True)
306 _builderGetVisible = classmethod(_builderGetVisible)
307 @@ -216,10 +213,9 @@
308 if not category in settings.categories:
309 raise SetConfigError("invalid category name '%s'" % category)
310
311 - repository = cls._builderGetRepository(options, trees.keys())
312 visible = cls._builderGetVisible(options)
313
314 - return CategorySet(category, dbapi=trees[repository].dbapi, only_visible=visible)
315 + return CategorySet(category, dbapi=trees["porttree"].dbapi, only_visible=visible)
316 singleBuilder = classmethod(singleBuilder)
317
318 def multiBuilder(cls, options, settings, trees):
319 @@ -233,7 +229,6 @@
320 else:
321 categories = settings.categories
322
323 - repository = cls._builderGetRepository(options, trees.keys())
324 visible = cls._builderGetVisible(options)
325 name_pattern = options.get("name_pattern", "$category/*")
326
327 @@ -241,7 +236,7 @@
328 raise SetConfigError("name_pattern doesn't include $category placeholder")
329
330 for cat in categories:
331 - myset = CategorySet(cat, trees[repository].dbapi, only_visible=visible)
332 + myset = CategorySet(cat, trees["porttree"].dbapi, only_visible=visible)
333 myname = name_pattern.replace("$category", cat)
334 myname = myname.replace("${category}", cat)
335 rValue[myname] = myset