Lines 1197-1235
Link Here
|
1197 |
return 1 |
1197 |
return 1 |
1198 |
|
1198 |
|
1199 |
|
1199 |
|
1200 |
def altlist(self): |
1200 |
def altlist(self, reversed=False): |
1201 |
mygraph=self.digraph.copy() |
1201 |
mygraph=self.digraph.copy() |
1202 |
dolist=["/"] |
|
|
1203 |
retlist=[] |
1202 |
retlist=[] |
1204 |
for x in self.trees.keys(): |
1203 |
while not mygraph.empty(): |
1205 |
self.trees[x]["merge"] = [] |
1204 |
if reversed: |
1206 |
if x not in dolist: |
1205 |
nodes = mygraph.root_nodes() |
1207 |
dolist.append(x) |
1206 |
if not nodes: |
1208 |
while (not mygraph.empty()): |
1207 |
nodes = mygraph.root_nodes(ignore_soft_deps=True) |
1209 |
mycurkey=mygraph.firstzero() |
1208 |
if nodes: |
1210 |
if not mycurkey: |
1209 |
next_node = nodes[-1] |
1211 |
installables = mygraph.leaf_nodes(ignore_soft_deps=True) |
1210 |
else: |
1212 |
if not installables: |
1211 |
next_node = None |
1213 |
print "!!! Error: circular dependencies:" |
1212 |
else: |
1214 |
print |
1213 |
nodes = mygraph.leaf_nodes() |
1215 |
for x in mygraph.allnodes(): |
1214 |
if not nodes: |
1216 |
for y in mygraph.parent_nodes(x): |
1215 |
nodes = mygraph.leaf_nodes(ignore_soft_deps=True) |
1217 |
print y,"depends on",x |
1216 |
if nodes: |
1218 |
print |
1217 |
next_node = nodes[0] |
1219 |
sys.exit(1) |
1218 |
else: |
1220 |
mycurkey = installables[0] |
1219 |
next_node = None |
1221 |
splitski=string.split(mycurkey) |
1220 |
if not next_node: |
1222 |
#I'm not sure of the significance of the following lines (vestigal?) so I'm commenting 'em out. |
1221 |
print "!!! Error: circular dependencies:" |
1223 |
#These lines remove already-merged things from our alt-list |
1222 |
print |
1224 |
#if "--update" in myopts: |
1223 |
mygraph.debug_print() |
1225 |
# if not portage.db["/"]["vartree"].exists_specific(splitski[2]): |
1224 |
sys.exit(1) |
1226 |
# portage.db["/"]["merge"].append(splitski) |
1225 |
retlist.append(next_node.split()) |
1227 |
#else: |
1226 |
mygraph.remove(next_node) |
1228 |
self.trees[splitski[1]]["merge"].append(splitski) |
|
|
1229 |
mygraph.delnode(mycurkey) |
1230 |
for x in dolist: |
1231 |
for y in self.trees[x]["merge"]: |
1232 |
retlist.append(y) |
1233 |
return retlist |
1227 |
return retlist |
1234 |
|
1228 |
|
1235 |
def xcreate(self,mode="system"): |
1229 |
def xcreate(self,mode="system"): |
Lines 1394-1422
Link Here
|
1394 |
overlays_real = [os.path.realpath(t) \ |
1388 |
overlays_real = [os.path.realpath(t) \ |
1395 |
for t in self.settings["PORTDIR_OVERLAY"].split()] |
1389 |
for t in self.settings["PORTDIR_OVERLAY"].split()] |
1396 |
|
1390 |
|
1397 |
if "--tree" in self.myopts: |
1391 |
tree_nodes = [] |
1398 |
mylist.reverse() |
1392 |
node_depth = {} |
1399 |
mygraph=self.digraph.copy() |
|
|
1400 |
|
1401 |
i = 0 |
1393 |
i = 0 |
1402 |
while i < len(mylist): |
1394 |
depth = 0 |
1403 |
if mylist[i][-1]=="nomerge": |
1395 |
for x in mylist: |
1404 |
if "--tree" not in self.myopts: |
1396 |
graph_key = " ".join(x) |
1405 |
# we don't care about this elements |
1397 |
if "--tree" in self.myopts: |
1406 |
mylist.pop(i) |
1398 |
depth = len(tree_nodes) |
1407 |
continue |
1399 |
while depth: |
1408 |
if (i == (len(mylist) - 1)) \ |
1400 |
if graph_key in self.digraph.child_nodes(tree_nodes[depth-1]): |
1409 |
or (mygraph.depth(string.join(mylist[i])) \ |
1401 |
break |
1410 |
>= mygraph.depth(string.join(mylist[i+1]))): |
1402 |
depth -= 1 |
1411 |
# end of a useless branch (may be the last one) |
1403 |
tree_nodes = tree_nodes[:depth] |
1412 |
# -> delete the element and test the previous one |
1404 |
tree_nodes.append(graph_key) |
1413 |
mylist.pop(i) |
1405 |
node_depth[graph_key] = depth |
1414 |
if i > 0: |
1406 |
|
1415 |
i -= 1 |
1407 |
last_merge_depth = 0 |
1416 |
continue |
1408 |
for i in xrange(len(mylist)-1,-1,-1): |
1417 |
# the branch continues, or we've found a good element. |
1409 |
graph_key = " ".join(mylist[i]) |
1418 |
# -> let's see what's next, if anything |
1410 |
if mylist[i][3] != "nomerge": |
1419 |
i += 1 |
1411 |
last_merge_depth = node_depth[graph_key] |
|
|
1412 |
continue |
1413 |
if node_depth[graph_key] >= last_merge_depth or \ |
1414 |
i != len(mylist)-1 and node_depth[graph_key] >= node_depth[" ".join(mylist[i+1])]: |
1415 |
del mylist[i] |
1416 |
del node_depth[graph_key] |
1417 |
del tree_nodes |
1420 |
|
1418 |
|
1421 |
display_overlays=False |
1419 |
display_overlays=False |
1422 |
# files to fetch list - avoids counting a same file twice |
1420 |
# files to fetch list - avoids counting a same file twice |
Lines 1637-1645
Link Here
|
1637 |
oldlp=mywidth-30 |
1635 |
oldlp=mywidth-30 |
1638 |
newlp=oldlp-30 |
1636 |
newlp=oldlp-30 |
1639 |
|
1637 |
|
1640 |
indent="" |
1638 |
indent=" "*node_depth[" ".join(x)] |
1641 |
if "--tree" in self.myopts: |
|
|
1642 |
indent=" "*mygraph.depth(string.join(x)) |
1643 |
|
1639 |
|
1644 |
if myoldbest: |
1640 |
if myoldbest: |
1645 |
myoldbest=portage.pkgsplit(myoldbest)[1]+"-"+portage.pkgsplit(myoldbest)[2] |
1641 |
myoldbest=portage.pkgsplit(myoldbest)[1]+"-"+portage.pkgsplit(myoldbest)[2] |
Lines 3514-3520
Link Here
|
3514 |
mydepgraph.display(mymergelist) |
3510 |
mydepgraph.display(mymergelist) |
3515 |
prompt="Would you like to resume merging these packages?" |
3511 |
prompt="Would you like to resume merging these packages?" |
3516 |
else: |
3512 |
else: |
3517 |
mydepgraph.display(mydepgraph.altlist()) |
3513 |
mydepgraph.display(mydepgraph.altlist(reversed=("--tree" in myopts))) |
3518 |
mergecount=0 |
3514 |
mergecount=0 |
3519 |
for x in mydepgraph.altlist(): |
3515 |
for x in mydepgraph.altlist(): |
3520 |
if x[3]!="nomerge": |
3516 |
if x[3]!="nomerge": |
Lines 3558-3564
Link Here
|
3558 |
sys.exit(0) |
3554 |
sys.exit(0) |
3559 |
mydepgraph.display(mymergelist) |
3555 |
mydepgraph.display(mymergelist) |
3560 |
else: |
3556 |
else: |
3561 |
mydepgraph.display(mydepgraph.altlist()) |
3557 |
mydepgraph.display(mydepgraph.altlist(reversed=("--tree" in myopts))) |
3562 |
else: |
3558 |
else: |
3563 |
if ("--buildpkgonly" in myopts): |
3559 |
if ("--buildpkgonly" in myopts): |
3564 |
if not mydepgraph.digraph.hasallzeros(): |
3560 |
if not mydepgraph.digraph.hasallzeros(): |