Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15386 - in main/branches/prefix: bin cnf man pym/_emerge pym/portage pym/portage/sets
Date: Fri, 19 Feb 2010 10:16:34
Message-Id: E1NiPuR-0001Ep-Hj@stork.gentoo.org
1 Author: grobian
2 Date: 2010-02-19 10:16:30 +0000 (Fri, 19 Feb 2010)
3 New Revision: 15386
4
5 Modified:
6 main/branches/prefix/bin/dispatch-conf
7 main/branches/prefix/cnf/sets.conf
8 main/branches/prefix/man/emerge.1
9 main/branches/prefix/man/make.conf.5
10 main/branches/prefix/pym/_emerge/depgraph.py
11 main/branches/prefix/pym/_emerge/help.py
12 main/branches/prefix/pym/_emerge/main.py
13 main/branches/prefix/pym/portage/const.py
14 main/branches/prefix/pym/portage/sets/dbapi.py
15 Log:
16 Merged from trunk -r15360:15370
17
18 | 15361 | Fix type in CLEAN_DELAY docs. |
19 | zmedico | |
20
21 | 15362 | Bug #303567 - Merge libc asap, in order to account for |
22 | zmedico | implicit dependencies. |
23
24 | 15363 | Add @rebuilt-binaries set which uses BUILD_TIME to pull in |
25 | zmedico | binary packages that have a different build time from a |
26 | | currently installed package of the exact same version. |
27
28 | 15364 | Add a --rebuilt-binaries[=n] option, causing automatic |
29 | zmedico | replacement of installed packages with binary packages that |
30 | | have been rebuilt. Rebuilds are detected by comparison of |
31 | | BUILD_TIME package metadata. This option is enabled |
32 | | automatically when using binary packages, so rebuilt |
33 | | binaries are installed with a user's typical update command. |
34 | | This isn't possible with the existing @rebuild-binaries |
35 | | package set since that only works with --selective=n and |
36 | | therefore can't be used with a typical world update. The |
37 | | package set framework should support this type of behavior |
38 | | sometime in the future. |
39
40 | 15365 | Bug #305393 - Handle new sdiff exit status for |
41 | zmedico | diffutils-2.9. |
42
43 | 15366 | Add a comment about slowness in _serialize_tasks when there |
44 | zmedico | are lots of blockers to solve. |
45
46 | 15367 | Fix colors for --rebuilt-binaries docs. |
47 | zmedico | |
48
49 | 15368 | Fix broken diffutils vercmp code. |
50 | zmedico | |
51
52 | 15369 | Update the spinner in depgraph._serialize_tasks when |
53 | zmedico | searching for suitable uninstall tasks. |
54
55 | 15370 | Remove diffutils version detection code since it's not |
56 | zmedico | really needed. |
57
58
59 Modified: main/branches/prefix/bin/dispatch-conf
60 ===================================================================
61 --- main/branches/prefix/bin/dispatch-conf 2010-02-19 10:14:15 UTC (rev 15385)
62 +++ main/branches/prefix/bin/dispatch-conf 2010-02-19 10:16:30 UTC (rev 15386)
63 @@ -119,6 +119,7 @@
64 "use-rcs=yes in config; fatal', file=sys.stderr)
65 return False
66
67 + merge_cmd = self.options.get("merge", "").split()
68
69 # config file freezing support
70 frozen_files = set(self.options.get("frozen-files", "").split())
71 @@ -269,6 +270,9 @@
72 merged = SCRATCH_DIR+"/"+os.path.basename(conf['current'])
73 print()
74 ret = os.system (self.options['merge'] % (merged, conf ['current'], newconf))
75 + ret = os.WEXITSTATUS(ret)
76 + if ret < 2:
77 + ret = 0
78 if ret:
79 print("Failure running 'merge' command")
80 continue
81
82 Modified: main/branches/prefix/cnf/sets.conf
83 ===================================================================
84 --- main/branches/prefix/cnf/sets.conf 2010-02-19 10:14:15 UTC (rev 15385)
85 +++ main/branches/prefix/cnf/sets.conf 2010-02-19 10:16:30 UTC (rev 15386)
86 @@ -65,6 +65,12 @@
87 world-candidate = False
88 files = %(ROOT)slib/modules
89
90 +# Binary packages that have a different build time from a currently
91 +# installed package of the exact same version.
92 +[rebuilt-binaries]
93 +class = portage.sets.dbapi.RebuiltBinaries
94 +world-candidate = False
95 +
96 # Installed packages for which the highest visible ebuild
97 # version is lower than the currently installed version.
98 [downgrade]
99
100 Modified: main/branches/prefix/man/emerge.1
101 ===================================================================
102 --- main/branches/prefix/man/emerge.1 2010-02-19 10:14:15 UTC (rev 15385)
103 +++ main/branches/prefix/man/emerge.1 2010-02-19 10:16:30 UTC (rev 15386)
104 @@ -477,6 +477,13 @@
105 Redirect all build output to logs alone, and do not
106 display it on stdout.
107 .TP
108 +.BR "\-\-rebuilt\-binaries[=n]"
109 +Replace installed packages with binary packages that have
110 +been rebuilt. Rebuilds are detected by comparison of
111 +BUILD_TIME package metadata. This option is enabled
112 +automatically when using binary packages (see
113 +\fB\-\-usepkg\fR and \fB\-\-getbinpkg\fR).
114 +.TP
115 .BR "\-\-reinstall changed\-use"
116 Tells emerge to include installed packages where USE flags have
117 changed since installation. Unlike \fB\-\-newuse\fR, this option does
118
119 Modified: main/branches/prefix/man/make.conf.5
120 ===================================================================
121 --- main/branches/prefix/man/make.conf.5 2010-02-19 10:14:15 UTC (rev 15385)
122 +++ main/branches/prefix/man/make.conf.5 2010-02-19 10:16:30 UTC (rev 15386)
123 @@ -115,7 +115,8 @@
124 http://gcc.gnu.org/onlinedocs/gcc\-2.95.3/gcc_2.html
125 .TP
126 \fBCLEAN_DELAY\fR = \fIinteger\fR
127 -Determines how long the countdown delay will be after running `emerge clean`.
128 +Determines how long the countdown delay will be after running
129 +`emerge --unmerge`.
130 .br
131 Defaults to 5 seconds.
132 .TP
133
134 Modified: main/branches/prefix/pym/_emerge/depgraph.py
135 ===================================================================
136 --- main/branches/prefix/pym/_emerge/depgraph.py 2010-02-19 10:14:15 UTC (rev 15385)
137 +++ main/branches/prefix/pym/_emerge/depgraph.py 2010-02-19 10:16:30 UTC (rev 15386)
138 @@ -229,11 +229,6 @@
139 ]["vartree"].dbapi._aux_cache_keys)
140 dbs.append((vardb, "installed", True, True, db_keys))
141 self._filtered_trees[myroot]["dbs"] = dbs
142 - if "--usepkg" in depgraph._frozen_config.myopts:
143 - depgraph._frozen_config._trees_orig[myroot
144 - ]["bintree"].populate(
145 - "--getbinpkg" in depgraph._frozen_config.myopts,
146 - "--getbinpkgonly" in depgraph._frozen_config.myopts)
147
148 class depgraph(object):
149
150 @@ -2401,6 +2396,9 @@
151 atom_set = InternalPackageSet(initial_atoms=(atom,))
152 existing_node = None
153 myeb = None
154 + usepkg = "--usepkg" in self._frozen_config.myopts
155 + rebuilt_binaries = usepkg and \
156 + self._frozen_config.myopts.get('--rebuilt-binaries') != 'n'
157 usepkgonly = "--usepkgonly" in self._frozen_config.myopts
158 empty = "empty" in self._dynamic_config.myparams
159 selective = "selective" in self._dynamic_config.myparams
160 @@ -2620,10 +2618,26 @@
161 if pkg.cp == cp]
162 break
163
164 + if existing_node is not None and \
165 + existing_node in matched_packages:
166 + return existing_node, existing_node
167 +
168 if len(matched_packages) > 1:
169 + if rebuilt_binaries:
170 + inst_pkg = None
171 + built_pkg = None
172 + for pkg in matched_packages:
173 + if pkg.installed:
174 + inst_pkg = pkg
175 + elif pkg.built:
176 + built_pkg = pkg
177 + if built_pkg is not None and inst_pkg is not None:
178 + if built_pkg >= inst_pkg and \
179 + built_pkg.metadata['BUILD_TIME'] != \
180 + inst_pkg.metadata['BUILD_TIME']:
181 + return built_pkg, built_pkg
182 +
183 if avoid_update:
184 - if existing_node is not None:
185 - return existing_node, existing_node
186 for pkg in matched_packages:
187 if pkg.installed:
188 return pkg, existing_node
189 @@ -3335,6 +3349,15 @@
190 runtime_deps.update(atom for atom in atoms \
191 if not atom.blocker)
192
193 + # Merge libc asap, in order to account for implicit
194 + # dependencies. See bug #303567.
195 + libc_pkg = self._dynamic_config.mydbapi[running_root].match_pkgs(
196 + portage.const.LIBC_PACKAGE_ATOM)
197 + if libc_pkg:
198 + libc_pkg = libc_pkg[0]
199 + if libc_pkg.operation == 'merge':
200 + asap_nodes.append(libc_pkg)
201 +
202 def gather_deps(ignore_priority, mergeable_nodes,
203 selected_nodes, node):
204 """
205 @@ -3523,6 +3546,10 @@
206
207 min_parent_deps = None
208 uninst_task = None
209 +
210 + # FIXME: This loop can be extremely slow when
211 + # there of lots of blockers to solve
212 + # (especially the gather_deps part).
213 for task in myblocker_uninstalls.leaf_nodes():
214 # Do some sanity checks so that system or world packages
215 # don't get uninstalled inappropriately here (only really
216 @@ -3646,6 +3673,7 @@
217 # best possible choice, but the current algorithm
218 # is simple and should be near optimal for most
219 # common cases.
220 + self._spinner_update()
221 mergeable_parent = False
222 parent_deps = set()
223 for parent in mygraph.parent_nodes(task):
224
225 Modified: main/branches/prefix/pym/_emerge/help.py
226 ===================================================================
227 --- main/branches/prefix/pym/_emerge/help.py 2010-02-19 10:14:15 UTC (rev 15385)
228 +++ main/branches/prefix/pym/_emerge/help.py 2010-02-19 10:16:30 UTC (rev 15386)
229 @@ -506,6 +506,15 @@
230 for line in wrap(desc, desc_width):
231 print(desc_indent + line)
232 print()
233 + print(" "+green("--rebuilt-binaries") + "[=%s]" % turquoise("n"))
234 + desc = "Replace installed packages with binary packages that have " + \
235 + "been rebuilt. Rebuilds are detected by comparison of " + \
236 + "BUILD_TIME package metadata. This option is enabled " + \
237 + "automatically when using binary packages (see " + \
238 + "--usepkg and --getbinpkg)."
239 + for line in wrap(desc, desc_width):
240 + print(desc_indent + line)
241 + print()
242 print(" "+green("--reinstall ") + turquoise("changed-use"))
243 print(" Tells emerge to include installed packages where USE flags have")
244 print(" changed since installation. Unlike --newuse, this option does")
245
246 Modified: main/branches/prefix/pym/_emerge/main.py
247 ===================================================================
248 --- main/branches/prefix/pym/_emerge/main.py 2010-02-19 10:14:15 UTC (rev 15385)
249 +++ main/branches/prefix/pym/_emerge/main.py 2010-02-19 10:16:30 UTC (rev 15386)
250 @@ -396,6 +396,7 @@
251 '--getbinpkgonly' : ('n',),
252 '--jobs' : valid_integers,
253 '--keep-going' : ('n',),
254 + '--rebuilt-binaries' : ('n',),
255 '--root-deps' : ('rdeps',),
256 '--select' : ('n',),
257 '--selective' : ('n',),
258 @@ -621,6 +622,13 @@
259 "choices" : ("True", "n")
260 },
261
262 + "--rebuilt-binaries": {
263 + "help" : "replace installed packages with binary " + \
264 + "packages that have been rebuilt",
265 + "type" : "choice",
266 + "choices" : ("True", "n")
267 + },
268 +
269 "--root": {
270 "help" : "specify the target root filesystem for merging packages",
271 "action" : "store"
272 @@ -733,6 +741,10 @@
273 else:
274 myoptions.keep_going = None
275
276 + if myoptions.rebuilt_binaries in ("True",):
277 + # The depgraph will enable this by default unless 'n' is specified.
278 + myoptions.rebuilt_binaries = None
279 +
280 if myoptions.root_deps == "True":
281 myoptions.root_deps = True
282
283 @@ -1209,10 +1221,43 @@
284 config_protect_check(trees)
285 check_procfs()
286
287 + if "getbinpkg" in settings.features:
288 + myopts["--getbinpkg"] = True
289 +
290 + if "--getbinpkgonly" in myopts:
291 + myopts["--getbinpkg"] = True
292 +
293 + if "--getbinpkgonly" in myopts:
294 + myopts["--usepkgonly"] = True
295 +
296 + if "--getbinpkg" in myopts:
297 + myopts["--usepkg"] = True
298 +
299 + if "--usepkgonly" in myopts:
300 + myopts["--usepkg"] = True
301 +
302 + if "buildpkg" in settings.features or "--buildpkgonly" in myopts:
303 + myopts["--buildpkg"] = True
304 +
305 + if "--buildpkgonly" in myopts:
306 + # --buildpkgonly will not merge anything, so
307 + # it cancels all binary package options.
308 + for opt in ("--getbinpkg", "--getbinpkgonly",
309 + "--usepkg", "--usepkgonly"):
310 + myopts.pop(opt, None)
311 +
312 for mytrees in trees.values():
313 mydb = mytrees["porttree"].dbapi
314 # Freeze the portdbapi for performance (memoize all xmatch results).
315 mydb.freeze()
316 +
317 + if "--usepkg" in myopts:
318 + # Populate the bintree with current --getbinpkg setting.
319 + # This needs to happen before expand_set_arguments(), in case
320 + # any sets use the bintree.
321 + mytrees["bintree"].populate(
322 + getbinpkgs="--getbinpkg" in myopts)
323 +
324 del mytrees, mydb
325
326 if "moo" in myfiles:
327 @@ -1271,42 +1316,12 @@
328 spinner.update = spinner.update_quiet
329 portage.util.noiselimit = -1
330
331 - # Always create packages if FEATURES=buildpkg
332 - # Imply --buildpkg if --buildpkgonly
333 - if ("buildpkg" in settings.features) or ("--buildpkgonly" in myopts):
334 - if "--buildpkg" not in myopts:
335 - myopts["--buildpkg"] = True
336 -
337 - # Always try and fetch binary packages if FEATURES=getbinpkg
338 - if ("getbinpkg" in settings.features):
339 - myopts["--getbinpkg"] = True
340 -
341 - if "--buildpkgonly" in myopts:
342 - # --buildpkgonly will not merge anything, so
343 - # it cancels all binary package options.
344 - for opt in ("--getbinpkg", "--getbinpkgonly",
345 - "--usepkg", "--usepkgonly"):
346 - myopts.pop(opt, None)
347 -
348 if "--fetch-all-uri" in myopts:
349 myopts["--fetchonly"] = True
350
351 if "--skipfirst" in myopts and "--resume" not in myopts:
352 myopts["--resume"] = True
353
354 - if ("--getbinpkgonly" in myopts) and not ("--usepkgonly" in myopts):
355 - myopts["--usepkgonly"] = True
356 -
357 - if ("--getbinpkgonly" in myopts) and not ("--getbinpkg" in myopts):
358 - myopts["--getbinpkg"] = True
359 -
360 - if ("--getbinpkg" in myopts) and not ("--usepkg" in myopts):
361 - myopts["--usepkg"] = True
362 -
363 - # Also allow -K to apply --usepkg/-k
364 - if ("--usepkgonly" in myopts) and not ("--usepkg" in myopts):
365 - myopts["--usepkg"] = True
366 -
367 # Allow -p to remove --ask
368 if "--pretend" in myopts:
369 myopts.pop("--ask", None)
370
371 Modified: main/branches/prefix/pym/portage/const.py
372 ===================================================================
373 --- main/branches/prefix/pym/portage/const.py 2010-02-19 10:14:15 UTC (rev 15385)
374 +++ main/branches/prefix/pym/portage/const.py 2010-02-19 10:16:30 UTC (rev 15386)
375 @@ -84,6 +84,7 @@
376 REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
377
378 PORTAGE_PACKAGE_ATOM = "sys-apps/portage"
379 +LIBC_PACKAGE_ATOM = "virtual/libc"
380
381 INCREMENTALS = ("USE", "USE_EXPAND", "USE_EXPAND_HIDDEN",
382 "FEATURES", "ACCEPT_KEYWORDS",
383
384 Modified: main/branches/prefix/pym/portage/sets/dbapi.py
385 ===================================================================
386 --- main/branches/prefix/pym/portage/sets/dbapi.py 2010-02-19 10:14:15 UTC (rev 15385)
387 +++ main/branches/prefix/pym/portage/sets/dbapi.py 2010-02-19 10:16:30 UTC (rev 15386)
388 @@ -21,7 +21,7 @@
389 "atoms to match all installed packages"
390 _filter = None
391
392 - def __init__(self, vdbapi):
393 + def __init__(self, vdbapi, **kwargs):
394 super(EverythingSet, self).__init__()
395 self._db = vdbapi
396
397 @@ -313,3 +313,26 @@
398 return AgeSet(vardb=trees["vartree"].dbapi, mode=mode, age=age)
399
400 singleBuilder = classmethod(singleBuilder)
401 +
402 +class RebuiltBinaries(EverythingSet):
403 + _operations = ('merge',)
404 + _aux_keys = ('BUILD_TIME',)
405 +
406 + def __init__(self, vardb, bindb=None):
407 + super(RebuiltBinaries, self).__init__(vardb, bindb=bindb)
408 + self._bindb = bindb
409 +
410 + def _filter(self, atom):
411 + cpv = self._db.match(atom)[0]
412 + inst_build_time, = self._db.aux_get(cpv, self._aux_keys)
413 + try:
414 + bin_build_time, = self._bindb.aux_get(cpv, self._aux_keys)
415 + except KeyError:
416 + return False
417 + return inst_build_time != bin_build_time
418 +
419 + def singleBuilder(cls, options, settings, trees):
420 + return RebuiltBinaries(trees["vartree"].dbapi,
421 + bindb=trees["bintree"].dbapi)
422 +
423 + singleBuilder = classmethod(singleBuilder)