Lines 2328-2369
Link Here
|
2328 |
for t in self.settings["PORTDIR_OVERLAY"].split()] |
2328 |
for t in self.settings["PORTDIR_OVERLAY"].split()] |
2329 |
|
2329 |
|
2330 |
tree_nodes = [] |
2330 |
tree_nodes = [] |
2331 |
node_depth = {} |
2331 |
display_list = [] |
|
|
2332 |
mygraph = self._parent_child_digraph |
2332 |
i = 0 |
2333 |
i = 0 |
2333 |
depth = 0 |
2334 |
depth = 0 |
2334 |
for x in mylist: |
2335 |
for x in mylist: |
2335 |
if "blocks" == x[0]: |
2336 |
if "blocks" == x[0]: |
|
|
2337 |
display_list.append((x, 0, True)) |
2336 |
continue |
2338 |
continue |
2337 |
graph_key = tuple(x) |
2339 |
graph_key = tuple(x) |
2338 |
if "--tree" in self.myopts: |
2340 |
if "--tree" in self.myopts: |
2339 |
depth = len(tree_nodes) |
2341 |
depth = len(tree_nodes) |
2340 |
while depth and graph_key not in \ |
2342 |
while depth and graph_key not in \ |
2341 |
self.digraph.child_nodes(tree_nodes[depth-1]): |
2343 |
mygraph.child_nodes(tree_nodes[depth-1]): |
2342 |
depth -= 1 |
2344 |
depth -= 1 |
2343 |
tree_nodes = tree_nodes[:depth] |
2345 |
if depth: |
2344 |
tree_nodes.append(graph_key) |
2346 |
tree_nodes = tree_nodes[:depth] |
2345 |
node_depth[graph_key] = depth |
2347 |
tree_nodes.append(graph_key) |
|
|
2348 |
display_list.append((x, depth, True)) |
2349 |
else: |
2350 |
traversed_nodes = set() # prevent endless circles |
2351 |
traversed_nodes.add(graph_key) |
2352 |
def add_parents(current_node, ordered): |
2353 |
parent_nodes = mygraph.parent_nodes(current_node) |
2354 |
if parent_nodes: |
2355 |
child_nodes = set(mygraph.child_nodes(current_node)) |
2356 |
selected_parent = None |
2357 |
# First, try to avoid a direct cycle. |
2358 |
for node in parent_nodes: |
2359 |
if node not in traversed_nodes and \ |
2360 |
node not in child_nodes: |
2361 |
selected_parent = node |
2362 |
break |
2363 |
if not selected_parent: |
2364 |
# A direct cycle is unavoidable. |
2365 |
for node in parent_nodes: |
2366 |
if node not in traversed_nodes: |
2367 |
selected_parent = node |
2368 |
break |
2369 |
if selected_parent: |
2370 |
traversed_nodes.add(node) |
2371 |
add_parents(node, False) |
2372 |
display_list.append((list(current_node), |
2373 |
len(tree_nodes), ordered)) |
2374 |
tree_nodes.append(current_node) |
2375 |
tree_nodes = [] |
2376 |
add_parents(graph_key, True) |
2377 |
else: |
2378 |
display_list.append((x, depth, True)) |
2379 |
mylist = display_list |
2346 |
|
2380 |
|
2347 |
last_merge_depth = 0 |
2381 |
last_merge_depth = 0 |
2348 |
for i in xrange(len(mylist)-1,-1,-1): |
2382 |
for i in xrange(len(mylist)-1,-1,-1): |
2349 |
if "blocks" == mylist[i][0]: |
2383 |
graph_key, depth, ordered = mylist[i] |
|
|
2384 |
if not ordered and depth == 0 and i > 1 \ |
2385 |
and graph_key == mylist[i-1][0]: |
2386 |
# An ordered node got a consecutive duplicate when the tree was |
2387 |
# being filled in. |
2388 |
del mylist[i] |
2350 |
continue |
2389 |
continue |
2351 |
graph_key = tuple(mylist[i]) |
2390 |
if "blocks" == graph_key[0]: |
2352 |
if mylist[i][-1] != "nomerge": |
|
|
2353 |
last_merge_depth = node_depth[graph_key] |
2354 |
continue |
2391 |
continue |
2355 |
if node_depth[graph_key] >= last_merge_depth or \ |
2392 |
if graph_key[-1] != "nomerge": |
|
|
2393 |
last_merge_depth = depth |
2394 |
continue |
2395 |
if depth >= last_merge_depth or \ |
2356 |
i < len(mylist) - 1 and \ |
2396 |
i < len(mylist) - 1 and \ |
2357 |
node_depth[graph_key] >= node_depth[tuple(mylist[i+1])]: |
2397 |
depth >= mylist[i+1][1]: |
2358 |
del mylist[i] |
2398 |
del mylist[i] |
2359 |
del node_depth[graph_key] |
|
|
2360 |
del tree_nodes |
2361 |
|
2399 |
|
2362 |
display_overlays=False |
2400 |
display_overlays=False |
2363 |
# files to fetch list - avoids counting a same file twice |
2401 |
# files to fetch list - avoids counting a same file twice |
2364 |
# in size display (verbose mode) |
2402 |
# in size display (verbose mode) |
2365 |
myfetchlist=[] |
2403 |
myfetchlist=[] |
2366 |
for x in mylist: |
2404 |
for mylist_index in xrange(len(mylist)): |
|
|
2405 |
x, depth, ordered = mylist[mylist_index] |
2367 |
pkg_type = x[0] |
2406 |
pkg_type = x[0] |
2368 |
myroot = x[1] |
2407 |
myroot = x[1] |
2369 |
pkg_key = x[2] |
2408 |
pkg_key = x[2] |
Lines 2377-2383
Link Here
|
2377 |
|
2416 |
|
2378 |
if x[0]=="blocks": |
2417 |
if x[0]=="blocks": |
2379 |
addl=""+red("B")+" "+fetch+" " |
2418 |
addl=""+red("B")+" "+fetch+" " |
2380 |
counters.blocks += 1 |
2419 |
if ordered: |
|
|
2420 |
counters.blocks += 1 |
2381 |
resolved = portage.key_expand( |
2421 |
resolved = portage.key_expand( |
2382 |
pkg_key, mydb=vardb, settings=pkgsettings) |
2422 |
pkg_key, mydb=vardb, settings=pkgsettings) |
2383 |
if "--columns" in self.myopts and "--quiet" in self.myopts: |
2423 |
if "--columns" in self.myopts and "--quiet" in self.myopts: |
Lines 2418-2428
Link Here
|
2418 |
"fetch" in portdb.aux_get( |
2458 |
"fetch" in portdb.aux_get( |
2419 |
x[2], ["RESTRICT"])[0].split(): |
2459 |
x[2], ["RESTRICT"])[0].split(): |
2420 |
fetch = red("F") |
2460 |
fetch = red("F") |
2421 |
counters.restrict_fetch += 1 |
2461 |
if ordered: |
|
|
2462 |
counters.restrict_fetch += 1 |
2422 |
if portdb.fetch_check( |
2463 |
if portdb.fetch_check( |
2423 |
pkg_key, self.useFlags[myroot][pkg_key]): |
2464 |
pkg_key, self.useFlags[myroot][pkg_key]): |
2424 |
fetch = green("f") |
2465 |
fetch = green("f") |
2425 |
counters.restrict_fetch_satisfied += 1 |
2466 |
if ordered: |
|
|
2467 |
counters.restrict_fetch_satisfied += 1 |
2426 |
|
2468 |
|
2427 |
#we need to use "--emptrytree" testing here rather than "empty" param testing because "empty" |
2469 |
#we need to use "--emptrytree" testing here rather than "empty" param testing because "empty" |
2428 |
#param is used for -u, where you still *do* want to see when something is being upgraded. |
2470 |
#param is used for -u, where you still *do* want to see when something is being upgraded. |
Lines 2430-2436
Link Here
|
2430 |
if vardb.cpv_exists(pkg_key): |
2472 |
if vardb.cpv_exists(pkg_key): |
2431 |
addl=" "+yellow("R")+fetch+" " |
2473 |
addl=" "+yellow("R")+fetch+" " |
2432 |
if x[3] != "nomerge": |
2474 |
if x[3] != "nomerge": |
2433 |
counters.reinst += 1 |
2475 |
if ordered: |
|
|
2476 |
counters.reinst += 1 |
2434 |
elif vardb.match(portage.dep_getkey(pkg_key)): |
2477 |
elif vardb.match(portage.dep_getkey(pkg_key)): |
2435 |
mynewslot = mydbapi.aux_get(pkg_key, ["SLOT"])[0] |
2478 |
mynewslot = mydbapi.aux_get(pkg_key, ["SLOT"])[0] |
2436 |
myoldlist = self.trees[x[1]]["vartree"].dbapi.match( |
2479 |
myoldlist = self.trees[x[1]]["vartree"].dbapi.match( |
Lines 2443-2457
Link Here
|
2443 |
if portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0: |
2486 |
if portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0: |
2444 |
# Downgrade in slot |
2487 |
# Downgrade in slot |
2445 |
addl+=turquoise("U")+blue("D") |
2488 |
addl+=turquoise("U")+blue("D") |
2446 |
counters.downgrades += 1 |
2489 |
if ordered: |
|
|
2490 |
counters.downgrades += 1 |
2447 |
else: |
2491 |
else: |
2448 |
# Update in slot |
2492 |
# Update in slot |
2449 |
addl+=turquoise("U")+" " |
2493 |
addl+=turquoise("U")+" " |
2450 |
counters.upgrades += 1 |
2494 |
if ordered: |
|
|
2495 |
counters.upgrades += 1 |
2451 |
else: |
2496 |
else: |
2452 |
# New slot, mark it new. |
2497 |
# New slot, mark it new. |
2453 |
addl=" "+green("NS")+fetch+" " |
2498 |
addl=" "+green("NS")+fetch+" " |
2454 |
counters.newslot += 1 |
2499 |
if ordered: |
|
|
2500 |
counters.newslot += 1 |
2455 |
|
2501 |
|
2456 |
if "--changelog" in self.myopts: |
2502 |
if "--changelog" in self.myopts: |
2457 |
slot_atom = "%s:%s" % (portage.dep_getkey(pkg_key), |
2503 |
slot_atom = "%s:%s" % (portage.dep_getkey(pkg_key), |
Lines 2463-2469
Link Here
|
2463 |
inst_matches[0], pkg_key)) |
2509 |
inst_matches[0], pkg_key)) |
2464 |
else: |
2510 |
else: |
2465 |
addl=" "+green("N")+" "+fetch+" " |
2511 |
addl=" "+green("N")+" "+fetch+" " |
2466 |
counters.new += 1 |
2512 |
if ordered: |
|
|
2513 |
counters.new += 1 |
2467 |
|
2514 |
|
2468 |
verboseadd="" |
2515 |
verboseadd="" |
2469 |
|
2516 |
|
Lines 2567-2573
Link Here
|
2567 |
if myfetchfile not in myfetchlist: |
2614 |
if myfetchfile not in myfetchlist: |
2568 |
mysize+=myfilesdict[myfetchfile] |
2615 |
mysize+=myfilesdict[myfetchfile] |
2569 |
myfetchlist.append(myfetchfile) |
2616 |
myfetchlist.append(myfetchfile) |
2570 |
counters.totalsize += mysize |
2617 |
if ordered: |
|
|
2618 |
counters.totalsize += mysize |
2571 |
verboseadd+=format_size(mysize)+" " |
2619 |
verboseadd+=format_size(mysize)+" " |
2572 |
|
2620 |
|
2573 |
# overlay verbose |
2621 |
# overlay verbose |
Lines 2602-2608
Link Here
|
2602 |
oldlp=mywidth-30 |
2650 |
oldlp=mywidth-30 |
2603 |
newlp=oldlp-30 |
2651 |
newlp=oldlp-30 |
2604 |
|
2652 |
|
2605 |
indent = " " * node_depth[tuple(x)] |
2653 |
indent = " " * depth |
2606 |
|
2654 |
|
2607 |
if myoldbest: |
2655 |
if myoldbest: |
2608 |
myoldbest=portage.pkgsplit(myoldbest)[1]+"-"+portage.pkgsplit(myoldbest)[2] |
2656 |
myoldbest=portage.pkgsplit(myoldbest)[1]+"-"+portage.pkgsplit(myoldbest)[2] |
Lines 2629-2635
Link Here
|
2629 |
myprint=myprint+myoldbest |
2677 |
myprint=myprint+myoldbest |
2630 |
myprint=myprint+darkgreen("to "+x[1])+" "+verboseadd |
2678 |
myprint=myprint+darkgreen("to "+x[1])+" "+verboseadd |
2631 |
else: |
2679 |
else: |
2632 |
if x[3] == "nomerge": |
2680 |
if x[-1] == "nomerge" or not ordered: |
2633 |
myprint = darkblue("[nomerge ] ") |
2681 |
myprint = darkblue("[nomerge ] ") |
2634 |
else: |
2682 |
else: |
2635 |
myprint = "[" + pkg_type + " " + addl + "] " |
2683 |
myprint = "[" + pkg_type + " " + addl + "] " |
Lines 2651-2657
Link Here
|
2651 |
myprint=myprint+(" "*(oldlp-nc_len(myprint))) |
2699 |
myprint=myprint+(" "*(oldlp-nc_len(myprint))) |
2652 |
myprint=myprint+myoldbest+" "+verboseadd |
2700 |
myprint=myprint+myoldbest+" "+verboseadd |
2653 |
else: |
2701 |
else: |
2654 |
if x[3]=="nomerge": |
2702 |
if x[-1] == "nomerge" or not ordered: |
2655 |
myprint=darkblue("[nomerge ] "+indent+x[2]+" "+myoldbest+" ")+verboseadd |
2703 |
myprint=darkblue("[nomerge ] "+indent+x[2]+" "+myoldbest+" ")+verboseadd |
2656 |
else: |
2704 |
else: |
2657 |
myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(x[2])+" "+myoldbest+" "+verboseadd |
2705 |
myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(x[2])+" "+myoldbest+" "+verboseadd |
Lines 2668-2674
Link Here
|
2668 |
myversion = "%s-%s" % (mysplit[1], mysplit[2]) |
2716 |
myversion = "%s-%s" % (mysplit[1], mysplit[2]) |
2669 |
|
2717 |
|
2670 |
if myversion != portage.VERSION and "--quiet" not in self.myopts: |
2718 |
if myversion != portage.VERSION and "--quiet" not in self.myopts: |
2671 |
if mylist.index(x) < len(mylist) - 1 and \ |
2719 |
if mylist_index < len(mylist) - 1 and \ |
2672 |
"livecvsportage" not in self.settings.features: |
2720 |
"livecvsportage" not in self.settings.features: |
2673 |
p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,")) |
2721 |
p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,")) |
2674 |
p.append(colorize("WARN", " then resume the merge.")) |
2722 |
p.append(colorize("WARN", " then resume the merge.")) |