Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15387 - in main/branches/prefix: bin man pym/_emerge pym/portage pym/portage/dbapi
Date: Fri, 19 Feb 2010 10:18:23
Message-Id: E1NiPwD-0001KS-30@stork.gentoo.org
1 Author: grobian
2 Date: 2010-02-19 10:18:20 +0000 (Fri, 19 Feb 2010)
3 New Revision: 15387
4
5 Modified:
6 main/branches/prefix/bin/dispatch-conf
7 main/branches/prefix/man/emerge.1
8 main/branches/prefix/pym/_emerge/create_depgraph_params.py
9 main/branches/prefix/pym/_emerge/depgraph.py
10 main/branches/prefix/pym/_emerge/help.py
11 main/branches/prefix/pym/_emerge/main.py
12 main/branches/prefix/pym/portage/dbapi/bintree.py
13 main/branches/prefix/pym/portage/dbapi/porttree.py
14 main/branches/prefix/pym/portage/dep.py
15 Log:
16 Merged from trunk -r15370:15380
17
18 | 15371 | Remove unused merge_cmd variable. |
19 | zmedico | |
20
21 | 15372 | Only enable --rebuilt-binaries automatically if --update and |
22 | zmedico | --deep are also enabled. |
23
24 | 15373 | Allow --rebuilt-binaries to trigger downgrades. |
25 | zmedico | |
26
27 | 15374 | Deprecate the unused getbinpkgsonly parameter to |
28 | zmedico | binarytree.populate(). |
29
30 | 15375 | Remove the deprecated 'clone' parameter to the binarytree |
31 | zmedico | constructor. |
32
33 | 15376 | Remove deprecated binarytree.get_use() method. |
34 | zmedico | |
35
36 | 15377 | Remove deprecated portdbapi.getfetchlist() method. |
37 | zmedico | |
38
39 | 15378 | Remove the deprecated 'clone' parameter from the portagetree |
40 | zmedico | constructor. |
41
42 | 15379 | Use a property to trigger deprecation warnings if |
43 | zmedico | binarytree.remotepkgs is accessed. |
44
45 | 15380 | Make dep_getkey() recommend cpv_getkey() if given a cpv. |
46 | zmedico | |
47
48
49 Modified: main/branches/prefix/bin/dispatch-conf
50 ===================================================================
51 --- main/branches/prefix/bin/dispatch-conf 2010-02-19 10:16:30 UTC (rev 15386)
52 +++ main/branches/prefix/bin/dispatch-conf 2010-02-19 10:18:20 UTC (rev 15387)
53 @@ -119,7 +119,6 @@
54 "use-rcs=yes in config; fatal', file=sys.stderr)
55 return False
56
57 - merge_cmd = self.options.get("merge", "").split()
58
59 # config file freezing support
60 frozen_files = set(self.options.get("frozen-files", "").split())
61
62 Modified: main/branches/prefix/man/emerge.1
63 ===================================================================
64 --- main/branches/prefix/man/emerge.1 2010-02-19 10:16:30 UTC (rev 15386)
65 +++ main/branches/prefix/man/emerge.1 2010-02-19 10:18:20 UTC (rev 15387)
66 @@ -481,8 +481,9 @@
67 Replace installed packages with binary packages that have
68 been rebuilt. Rebuilds are detected by comparison of
69 BUILD_TIME package metadata. This option is enabled
70 -automatically when using binary packages (see
71 -\fB\-\-usepkg\fR and \fB\-\-getbinpkg\fR).
72 +automatically when using binary packages
73 +(\fB\-\-usepkg\fR or \fB\-\-getbinpkg\fR) together with
74 +\fB\-\-update\fR and \fB\-\-deep\fR.
75 .TP
76 .BR "\-\-reinstall changed\-use"
77 Tells emerge to include installed packages where USE flags have
78
79 Modified: main/branches/prefix/pym/_emerge/create_depgraph_params.py
80 ===================================================================
81 --- main/branches/prefix/pym/_emerge/create_depgraph_params.py 2010-02-19 10:16:30 UTC (rev 15386)
82 +++ main/branches/prefix/pym/_emerge/create_depgraph_params.py 2010-02-19 10:18:20 UTC (rev 15387)
83 @@ -15,6 +15,7 @@
84 # empty: pretend nothing is merged
85 # complete: completely account for all known dependencies
86 # remove: build graph for use in removing packages
87 + # rebuilt_binaries: replace installed packages with rebuilt binaries
88 myparams = {"recurse" : True}
89
90 if myaction == "remove":
91 @@ -37,6 +38,15 @@
92 myparams["deep"] = myopts["--deep"]
93 if "--complete-graph" in myopts:
94 myparams["complete"] = True
95 +
96 + rebuilt_binaries = myopts.get('--rebuilt-binaries')
97 + if rebuilt_binaries is True or \
98 + rebuilt_binaries != 'n' and \
99 + '--usepkg' in myopts and \
100 + myopts.get('--deep') is True and \
101 + '--update' in myopts:
102 + myparams['rebuilt_binaries'] = True
103 +
104 if myopts.get("--selective") == "n":
105 # --selective=n can be used to remove selective
106 # behavior that may have been implied by some
107
108 Modified: main/branches/prefix/pym/_emerge/depgraph.py
109 ===================================================================
110 --- main/branches/prefix/pym/_emerge/depgraph.py 2010-02-19 10:16:30 UTC (rev 15386)
111 +++ main/branches/prefix/pym/_emerge/depgraph.py 2010-02-19 10:18:20 UTC (rev 15387)
112 @@ -2396,9 +2396,7 @@
113 atom_set = InternalPackageSet(initial_atoms=(atom,))
114 existing_node = None
115 myeb = None
116 - usepkg = "--usepkg" in self._frozen_config.myopts
117 - rebuilt_binaries = usepkg and \
118 - self._frozen_config.myopts.get('--rebuilt-binaries') != 'n'
119 + rebuilt_binaries = 'rebuilt_binaries' in self._dynamic_config.myparams
120 usepkgonly = "--usepkgonly" in self._frozen_config.myopts
121 empty = "empty" in self._dynamic_config.myparams
122 selective = "selective" in self._dynamic_config.myparams
123 @@ -2632,8 +2630,7 @@
124 elif pkg.built:
125 built_pkg = pkg
126 if built_pkg is not None and inst_pkg is not None:
127 - if built_pkg >= inst_pkg and \
128 - built_pkg.metadata['BUILD_TIME'] != \
129 + if built_pkg.metadata['BUILD_TIME'] != \
130 inst_pkg.metadata['BUILD_TIME']:
131 return built_pkg, built_pkg
132
133
134 Modified: main/branches/prefix/pym/_emerge/help.py
135 ===================================================================
136 --- main/branches/prefix/pym/_emerge/help.py 2010-02-19 10:16:30 UTC (rev 15386)
137 +++ main/branches/prefix/pym/_emerge/help.py 2010-02-19 10:18:20 UTC (rev 15387)
138 @@ -510,8 +510,9 @@
139 desc = "Replace installed packages with binary packages that have " + \
140 "been rebuilt. Rebuilds are detected by comparison of " + \
141 "BUILD_TIME package metadata. This option is enabled " + \
142 - "automatically when using binary packages (see " + \
143 - "--usepkg and --getbinpkg)."
144 + "automatically when using binary packages " + \
145 + "(--usepkg or --getbinpkg) together with " + \
146 + "--update and --deep."
147 for line in wrap(desc, desc_width):
148 print(desc_indent + line)
149 print()
150
151 Modified: main/branches/prefix/pym/_emerge/main.py
152 ===================================================================
153 --- main/branches/prefix/pym/_emerge/main.py 2010-02-19 10:16:30 UTC (rev 15386)
154 +++ main/branches/prefix/pym/_emerge/main.py 2010-02-19 10:18:20 UTC (rev 15387)
155 @@ -742,8 +742,7 @@
156 myoptions.keep_going = None
157
158 if myoptions.rebuilt_binaries in ("True",):
159 - # The depgraph will enable this by default unless 'n' is specified.
160 - myoptions.rebuilt_binaries = None
161 + myoptions.rebuilt_binaries = True
162
163 if myoptions.root_deps == "True":
164 myoptions.root_deps = True
165
166 Modified: main/branches/prefix/pym/portage/dbapi/bintree.py
167 ===================================================================
168 --- main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-19 10:16:30 UTC (rev 15386)
169 +++ main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-19 10:18:20 UTC (rev 15387)
170 @@ -33,6 +33,7 @@
171 import re
172 import stat
173 import sys
174 +import warnings
175 from itertools import chain
176
177 if sys.hexversion >= 0x3000000:
178 @@ -151,20 +152,8 @@
179
180 class binarytree(object):
181 "this tree scans for a list of all packages available in PKGDIR"
182 - def __init__(self, root, pkgdir, virtual=None, settings=None, clone=None):
183 - if clone:
184 - writemsg("binartree.__init__(): deprecated " + \
185 - "use of clone parameter\n", noiselevel=-1)
186 - # XXX This isn't cloning. It's an instance of the same thing.
187 - self.root = clone.root
188 - self.pkgdir = clone.pkgdir
189 - self.dbapi = clone.dbapi
190 - self.populated = clone.populated
191 - self.tree = clone.tree
192 - self.remotepkgs = clone.remotepkgs
193 - self.invalids = clone.invalids
194 - self.settings = clone.settings
195 - else:
196 + def __init__(self, root, pkgdir, virtual=None, settings=None):
197 + if True:
198 self.root = root
199 #self.pkgdir=settings["PKGDIR"]
200 self.pkgdir = normalize_path(pkgdir)
201 @@ -176,7 +165,7 @@
202 self._remote_has_index = False
203 self._remote_base_uri = None
204 self._remotepkgs = None # remote metadata indexed by cpv
205 - self.remotepkgs = {} # indexed by tbz2 name (deprecated)
206 + self.__remotepkgs = {} # indexed by tbz2 name (deprecated)
207 self.invalids = []
208 self.settings = settings
209 self._pkg_paths = {}
210 @@ -237,6 +226,24 @@
211 chain(*self._pkgindex_translated_keys)
212 ))
213
214 + def _get_remotepkgs(self):
215 + warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs",
216 + DeprecationWarning)
217 + return self.__remotepkgs
218 +
219 + def _set_remotepkgs(self, remotepkgs):
220 + warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs",
221 + DeprecationWarning)
222 + self.__remotepkgs = remotepkgs
223 +
224 + def _del_remotepkgs(self):
225 + warnings.warn("Use binarytree._remotepkgs insead of binarytree.remotepkgs",
226 + DeprecationWarning)
227 + del self.__remotepkgs
228 +
229 + remotepkgs = property(_get_remotepkgs, _set_remotepkgs, _del_remotepkgs,
230 + "Deprecated self.remotepkgs, only for backward compatibility")
231 +
232 def move_ent(self, mylist):
233 if not self.populated:
234 self.populate()
235 @@ -446,8 +453,15 @@
236 _movefile(src_path, dest_path, mysettings=self.settings)
237 self._pkg_paths[cpv] = mypath
238
239 - def populate(self, getbinpkgs=0, getbinpkgsonly=0):
240 + def populate(self, getbinpkgs=0, getbinpkgsonly=None):
241 "populates the binarytree"
242 +
243 + if getbinpkgsonly is not None:
244 + warnings.warn(
245 + "portage.dbapi.bintree.binarytree.populate(): " + \
246 + "getbinpkgsonly parameter is deprecated",
247 + DeprecationWarning)
248 +
249 if self._populating:
250 return
251 from portage.locks import lockfile, unlockfile
252 @@ -457,13 +471,13 @@
253 pkgindex_lock = lockfile(self._pkgindex_file,
254 wantnewlockfile=1)
255 self._populating = True
256 - self._populate(getbinpkgs, getbinpkgsonly)
257 + self._populate(getbinpkgs)
258 finally:
259 if pkgindex_lock:
260 unlockfile(pkgindex_lock)
261 self._populating = False
262
263 - def _populate(self, getbinpkgs=0, getbinpkgsonly=0):
264 + def _populate(self, getbinpkgs=0):
265 if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
266 return 0
267
268 @@ -760,7 +774,7 @@
269 self._remotepkgs[d["CPV"]] = d
270 self._remote_has_index = True
271 self._remote_base_uri = pkgindex.header.get("URI", base_url)
272 - self.remotepkgs = {}
273 + self.__remotepkgs = {}
274 for cpv in self._remotepkgs:
275 self.dbapi.cpv_inject(cpv)
276 self.populated = 1
277 @@ -805,18 +819,18 @@
278 writemsg_stdout(
279 colorize("GOOD", _("Fetching bininfo from ")) + \
280 re.sub(r'//(.+):.+@(.+)/', r'//\1:*password*@\2/', base_url) + "\n")
281 - self.remotepkgs = portage.getbinpkg.dir_get_metadata(
282 + self.__remotepkgs = portage.getbinpkg.dir_get_metadata(
283 self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size)
284 #writemsg(green(" -- DONE!\n\n"))
285
286 - for mypkg in list(self.remotepkgs):
287 - if "CATEGORY" not in self.remotepkgs[mypkg]:
288 + for mypkg in list(self.__remotepkgs):
289 + if "CATEGORY" not in self.__remotepkgs[mypkg]:
290 #old-style or corrupt package
291 writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg,
292 noiselevel=-1)
293 - del self.remotepkgs[mypkg]
294 + del self.__remotepkgs[mypkg]
295 continue
296 - mycat = self.remotepkgs[mypkg]["CATEGORY"].strip()
297 + mycat = self.__remotepkgs[mypkg]["CATEGORY"].strip()
298 fullpkg = mycat+"/"+mypkg[:-5]
299
300 if fullpkg in metadata:
301 @@ -839,7 +853,7 @@
302 # invalid tbz2's can hurt things.
303 #print "cpv_inject("+str(fullpkg)+")"
304 self.dbapi.cpv_inject(fullpkg)
305 - remote_metadata = self.remotepkgs[mypkg]
306 + remote_metadata = self.__remotepkgs[mypkg]
307 for k, v in remote_metadata.items():
308 remote_metadata[k] = v.strip()
309
310 @@ -860,7 +874,7 @@
311 except:
312 writemsg(_("!!! Failed to inject remote binary package: %s\n") % fullpkg,
313 noiselevel=-1)
314 - del self.remotepkgs[mypkg]
315 + del self.__remotepkgs[mypkg]
316 continue
317 self.populated=1
318
319 @@ -1118,11 +1132,6 @@
320 # package is downloaded, state is updated by self.inject().
321 return True
322
323 - def get_use(self, pkgname):
324 - writemsg("deprecated use of binarytree.get_use()," + \
325 - " use dbapi.aux_get() instead", noiselevel=-1)
326 - return self.dbapi.aux_get(pkgname, ["USE"])[0].split()
327 -
328 def gettbz2(self, pkgname):
329 """Fetches the package from a remote site, if necessary. Attempts to
330 resume if the file appears to be partially downloaded."""
331
332 Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
333 ===================================================================
334 --- main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-19 10:16:30 UTC (rev 15386)
335 +++ main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-19 10:18:20 UTC (rev 15387)
336 @@ -793,30 +793,6 @@
337
338 return uri_map
339
340 - def getfetchlist(self, mypkg, useflags=None, mysettings=None,
341 - all=0, mytree=None):
342 -
343 - writemsg("!!! pordbapi.getfetchlist() is deprecated, " + \
344 - "use getFetchMap() instead.\n", noiselevel=-1)
345 -
346 - if all:
347 - useflags = None
348 - elif useflags is None:
349 - if mysettings is None:
350 - mysettings = self.doebuild_settings
351 - mysettings.setcpv(mypkg, mydb=self)
352 - useflags = mysettings["PORTAGE_USE"].split()
353 - uri_map = self.getFetchMap(mypkg, useflags=useflags, mytree=mytree)
354 -
355 - all_uris = []
356 - all_files = []
357 - for filename, uris in uri_map.items():
358 - for uri in uris:
359 - all_uris.append(uri)
360 - all_files.append(filename)
361 -
362 - return [all_uris, all_files]
363 -
364 def getfetchsizes(self, mypkg, useflags=None, debug=0):
365 # returns a filename:size dictionnary of remaining downloads
366 myebuild = self.findname(mypkg)
367 @@ -1200,7 +1176,7 @@
368 i.close_caches()
369
370 class portagetree(object):
371 - def __init__(self, root="/", virtual=None, clone=None, settings=None):
372 + def __init__(self, root="/", virtual=None, settings=None):
373 """
374 Constructor for a PortageTree
375
376 @@ -1208,19 +1184,11 @@
377 @type root: String/Path
378 @param virtual: UNUSED
379 @type virtual: No Idea
380 - @param clone: Set this if you want a copy of Clone
381 - @type clone: Existing portagetree Instance
382 @param settings: Portage Configuration object (portage.settings)
383 @type settings: Instance of portage.config
384 """
385
386 - if clone:
387 - writemsg("portagetree.__init__(): deprecated " + \
388 - "use of clone parameter\n", noiselevel=-1)
389 - self.root = clone.root
390 - self.portroot = clone.portroot
391 - self.pkglines = clone.pkglines
392 - else:
393 + if True:
394 self.root = root
395 if settings is None:
396 from portage import settings
397
398 Modified: main/branches/prefix/pym/portage/dep.py
399 ===================================================================
400 --- main/branches/prefix/pym/portage/dep.py 2010-02-19 10:16:30 UTC (rev 15386)
401 +++ main/branches/prefix/pym/portage/dep.py 2010-02-19 10:18:20 UTC (rev 15387)
402 @@ -937,9 +937,14 @@
403 return Atom(mydep).cp
404 except InvalidAtom:
405 try:
406 - return Atom('=' + mydep).cp
407 + atom = Atom('=' + mydep)
408 except InvalidAtom:
409 pass
410 + else:
411 + warnings.warn(_("invalid input to %s: '%s', use %s instead") % \
412 + ('portage.dep.dep_getkey()', mydep, 'portage.cpv_getkey()'),
413 + DeprecationWarning)
414 + return atom.cp
415
416 # Fall back to legacy code for backward compatibility.
417 warnings.warn(_("%s is deprecated, use %s instead") % \