Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 97306 Details for
Bug 147766
[PATCH] Build up a full depgraph
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
More modifications...
changes.patch (text/plain), 7.89 KB, created by
Jason Stubbs (RETIRED)
on 2006-09-17 23:32:18 UTC
(
hide
)
Description:
More modifications...
Filename:
MIME Type:
Creator:
Jason Stubbs (RETIRED)
Created:
2006-09-17 23:32:18 UTC
Size:
7.89 KB
patch
obsolete
>diff -uNr portage.firstpatch/bin/emerge portage/bin/emerge >--- portage.firstpatch/bin/emerge 2006-09-19 14:46:51.000000000 +0000 >+++ portage/bin/emerge 2006-09-19 15:27:07.000000000 +0000 >@@ -356,20 +356,14 @@ > add=[] > sub=[] > if "--update" in myopts or myaction in ("system", "world"): >- add.extend(["selective","empty"]) >+ add.extend(["empty"]) > if "--emptytree" in myopts: > add.extend(["empty"]) > sub.extend(["selective"]) > if "--nodeps" in myopts: > sub.extend(["recurse"]) >- if "--noreplace" in myopts: >- add.extend(["selective"]) > if "--deep" in myopts: > add.extend(["deep"]) >- if "--selective" in myopts: >- add.extend(["selective"]) >- if myaction in ["world","system"]: >- add.extend(["selective"]) > elif myaction in ["depclean"]: > add.extend(["empty"]) > sub.extend(["selective"]) >@@ -679,7 +673,7 @@ > "--getbinpkg" in self.myopts, > "--getbinpkgonly" in self.myopts) > >- def create(self,mybigkey,myparent=None,addme=1,myuse=None,hard_dep=True,arg=None): >+ def create(self,mybigkey,myparent=None,addme=1,myuse=None,soft_dep=False,arg=None): > """ > Fills the digraph with nodes comprised of packages to merge. > mybigkey is the package spec of the package to merge. >@@ -697,11 +691,11 @@ > if addme and jbigkey != myparent: > # Refuse to make a node depend on itself so that the we don't > # don't create a bogus circular dependency in self.altlist(). >- self.digraph.addnode(jbigkey, myparent, hard_dep=hard_dep) >+ self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) > return 1 > jbigkey = " ".join(mybigkey) + " nomerge" > if self.digraph.hasnode(jbigkey): >- self.digraph.addnode(jbigkey, myparent, hard_dep=hard_dep) >+ self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) > return 1 > > self.spinner.update() >@@ -724,7 +718,7 @@ > if self.mydbapi[parent_root].match(mykey) or \ > self.trees[parent_root]["vartree"].dbapi.match(mykey): > mybigkey.append(myparent.split()[2]) >- self.digraph.addnode(" ".join(mybigkey), myparent, hard_dep) >+ self.digraph.addnode(" ".join(mybigkey), myparent, soft_dep=soft_dep) > return 1 > else: > mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi >@@ -783,7 +777,7 @@ > """ At this point, we have either hit a blocker and returned, found the package in the > depgraph already and returned, or we are here. Whether we are merging or not; we must > add the package to the depgraph; so we do that here. """ >- self.digraph.addnode(string.join(mybigkey),myparent,hard_dep=hard_dep) >+ self.digraph.addnode(string.join(mybigkey),myparent,soft_dep=soft_dep) > > """ This section determines whether we go deeper into dependencies or not. > We want to go deeper on a few occasions: >@@ -816,24 +810,13 @@ > """ We have retrieve the dependency information, now we need to recursively > process them. DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """ > >- mydep={} > mp=string.join(mybigkey) > > try: >- if myroot=="/": >- mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] >- if not self.select_dep("/",edepend["DEPEND"],myparent=mp,myuse=myuse): >- return 0 >- if not self.select_dep("/",edepend["RDEPEND"],myparent=mp,myuse=myuse,soft_deps=True): >- return 0 >- else: >- mydep["/"]=edepend["DEPEND"] >- mydep[myroot]=edepend["RDEPEND"] >- if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): >- return 0 >- if not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse,soft_deps=True): >- return 0 >- >+ if not self.select_dep("/",edepend["DEPEND"],myparent=mp,myuse=myuse): >+ return 0 >+ if not self.select_dep(myroot,edepend["RDEPEND"],myparent=mp,myuse=myuse,soft_deps=True): >+ return 0 > if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: > # Post Depend -- Add to the list without a parent, as it depends > # on a package being present AND must be built after that package. >@@ -1189,9 +1172,9 @@ > > if myparent: > #we are a dependency, so we want to be unconditionally added >- hard_dep = not soft_deps and len(vardb.match(x)) == 0 >+ soft_dep = soft_deps or vardb.match(x) > if not self.create(selected_pkg[0:3], myparent, >- myuse=selected_pkg[-1], hard_dep=hard_dep, arg=arg): >+ myuse=selected_pkg[-1], soft_dep=soft_dep, arg=arg): > return 0 > else: > #if mysource is not set, then we are a command-line dependency and should not be added >@@ -1217,7 +1200,7 @@ > while (not mygraph.empty()): > mycurkey=mygraph.firstzero() > if not mycurkey: >- installables = mygraph.leaf_nodes(include_soft_deps=False) >+ installables = mygraph.leaf_nodes(ignore_soft_deps=True) > if not installables: > print "!!! Error: circular dependencies:" > print >diff -uNr portage.firstpatch/pym/portage.py portage/pym/portage.py >--- portage.firstpatch/pym/portage.py 2006-09-19 14:46:51.000000000 +0000 >+++ portage/pym/portage.py 2006-09-19 15:14:01.000000000 +0000 >@@ -315,14 +315,15 @@ > def __init__(self): > """Create an empty digraph""" > >- # { node : ( { child : hard_dep } , { parent : hard_dep } ) } >+ # { node : ( { child : soft_dep } , { parent : soft_dep } ) } > self.nodes = {} > self.order = [] > >- def add(self, node, parent, hard_dep=True): >- """Adds the specified node with the specified parent. If the dep >- is a hard-dep and the node already has a relationship to the parent >- the relationship is ensured to be hard.""" >+ def add(self, node, parent, soft_dep=False): >+ """Adds the specified node with the specified parent. >+ >+ If the dep is a soft-dep and the node already has a hard >+ relationship to the parent, the relationship is left as hard.""" > > if node not in self.nodes: > self.nodes[node] = ({}, {}) >@@ -336,16 +337,16 @@ > self.order.append(parent) > > if parent in self.nodes[node][1]: >- if hard_dep: >- self.nodes[node][1][parent] = True >+ if not soft_dep: >+ self.nodes[node][1][parent] = False > else: >- self.nodes[node][1][parent] = hard_dep >+ self.nodes[node][1][parent] = soft_dep > > if node in self.nodes[parent][0]: >- if hard_dep: >- self.nodes[parent][0][node] = True >+ if not soft_dep: >+ self.nodes[parent][0][node] = False > else: >- self.nodes[parent][0][node] = hard_dep >+ self.nodes[parent][0][node] = soft_dep > > def remove(self, node): > """Removes the specified node from the digraph, also removing >@@ -368,20 +369,28 @@ > return node in self.nodes > > def all_nodes(self): >+ """Return a list of all nodes in the graph""" > return self.order[:] > > def child_nodes(self, node): >+ """Return all children of the specified node""" > return self.nodes[node][0].keys() >- >+ > def parent_nodes(self, node): >+ """Return all parents of the specified node""" > return self.nodes[node][1].keys() > >- def leaf_nodes(self, include_soft_deps=False): >+ def leaf_nodes(self, ignore_soft_deps=False): >+ """Return all nodes that have no children >+ >+ If ignore_soft_deps is True, soft deps are not counted as >+ children in calculations.""" >+ > leaf_nodes = [] > for node in self.order: > is_leaf_node = True > for child in self.nodes[node][0]: >- if include_soft_deps or self.nodes[node][0][child]: >+ if not (ignore_soft_deps and self.nodes[node][0][child]): > is_leaf_node = False > break > if is_leaf_node: >@@ -400,15 +409,20 @@ > > # Backward compatibility > addnode = add >- delnode = remove > allnodes = all_nodes > allzeros = leaf_nodes > hasnode = contains > empty = is_empty > copy = clone > >+ def delnode(self, node): >+ try: >+ self.remove(node) >+ except KeyError: >+ pass >+ > def firstzero(self): >- leaf_nodes = self.leaf_nodes(include_soft_deps=True) >+ leaf_nodes = self.leaf_nodes() > if leaf_nodes: > return leaf_nodes[0] > return None >@@ -441,7 +455,11 @@ > > def debug_print(self): > for node in self.nodes: >- print node,"depends on" >+ print node, >+ if self.nodes[node][0]: >+ print "depends on" >+ else: >+ print "(no children)" > for child in self.nodes[node][0]: > print " ",child, > if self.nodes[node][0][child]:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 147766
:
97111
|
97113
|
97122
|
97180
|
97190
|
97292
|
97305
| 97306 |
97307
|
97312
|
97324
|
97329
|
97336
|
98131
|
98153
|
98186