|
|
"--getbinpkg" in self.myopts, | "--getbinpkg" in self.myopts, |
"--getbinpkgonly" in self.myopts) | "--getbinpkgonly" in self.myopts) |
| |
def create(self,mybigkey,myparent=None,addme=1,myuse=None,soft_dep=False,arg=None): |
def create(self,mybigkey,myparent=None,addme=1,myuse=None,soft_dep=False,rev_dep=False,arg=None): |
""" | """ |
Fills the digraph with nodes comprised of packages to merge. | Fills the digraph with nodes comprised of packages to merge. |
mybigkey is the package spec of the package to merge. | mybigkey is the package spec of the package to merge. |
|
|
#IUSE-aware emerge -> USE DEP aware depgraph | #IUSE-aware emerge -> USE DEP aware depgraph |
#"no downgrade" emerge | #"no downgrade" emerge |
""" | """ |
|
|
jbigkey = " ".join(mybigkey) + " merge" | jbigkey = " ".join(mybigkey) + " merge" |
if self.digraph.hasnode(jbigkey): | if self.digraph.hasnode(jbigkey): |
if addme and jbigkey != myparent: | if addme and jbigkey != myparent: |
# Refuse to make a node depend on itself so that the we don't | # Refuse to make a node depend on itself so that the we don't |
# don't create a bogus circular dependency in self.altlist(). | # don't create a bogus circular dependency in self.altlist(). |
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
if rev_dep and myparent: |
|
self.digraph.addnode(myparent, jbigkey, soft_dep=soft_dep) |
|
else: |
|
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
return 1 | return 1 |
jbigkey = " ".join(mybigkey) + " nomerge" | jbigkey = " ".join(mybigkey) + " nomerge" |
if self.digraph.hasnode(jbigkey): | if self.digraph.hasnode(jbigkey): |
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
if rev_dep and myparent: |
|
self.digraph.addnode(myparent, jbigkey, soft_dep=soft_dep) |
|
else: |
|
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
return 1 | return 1 |
| |
self.spinner.update() | self.spinner.update() |
|
|
""" At this point, we have either hit a blocker and returned, found the package in the | """ 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 | 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. """ | add the package to the depgraph; so we do that here. """ |
self.digraph.addnode(string.join(mybigkey),myparent,soft_dep=soft_dep) |
if rev_dep and myparent: |
|
self.digraph.addnode(myparent,string.join(mybigkey),soft_dep=soft_dep) |
|
else: |
|
self.digraph.addnode(string.join(mybigkey),myparent,soft_dep=soft_dep) |
| |
""" This section determines whether we go deeper into dependencies or not. | """ This section determines whether we go deeper into dependencies or not. |
We want to go deeper on a few occasions: | We want to go deeper on a few occasions: |
|
|
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: | if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
# Post Depend -- Add to the list without a parent, as it depends | # Post Depend -- Add to the list without a parent, as it depends |
# on a package being present AND must be built after that package. | # on a package being present AND must be built after that package. |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,soft_deps=True): |
if not self.select_dep(myroot,edepend["PDEPEND"],myparent=mp,myuse=myuse,soft_deps=True,rev_deps=True): |
return 0 | return 0 |
except ValueError, e: | except ValueError, e: |
pkgs = e.args[0] | pkgs = e.args[0] |
|
|
if curslot == myslot: | if curslot == myslot: |
return match | return match |
| |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False,soft_deps=False): |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False,soft_deps=False,rev_deps=False): |
""" Given a depstring, create the depgraph such that all dependencies are satisfied. | """ Given a depstring, create the depgraph such that all dependencies are satisfied. |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. | myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
myparent = the node whose depstring is being passed in | myparent = the node whose depstring is being passed in |
|
|
#we are a dependency, so we want to be unconditionally added | #we are a dependency, so we want to be unconditionally added |
soft_dep = soft_deps or vardb.match(x) | soft_dep = soft_deps or vardb.match(x) |
if not self.create(selected_pkg[0:3], myparent, | if not self.create(selected_pkg[0:3], myparent, |
myuse=selected_pkg[-1], soft_dep=soft_dep, arg=arg): |
myuse=selected_pkg[-1], soft_dep=soft_dep, rev_dep=rev_deps, arg=arg): |
return 0 | return 0 |
else: | else: |
#if mysource is not set, then we are a command-line dependency and should not be added | #if mysource is not set, then we are a command-line dependency and should not be added |
#if --onlydeps is specified. | #if --onlydeps is specified. |
if not self.create(selected_pkg[0:3], myparent, | if not self.create(selected_pkg[0:3], myparent, |
addme=("--onlydeps" not in self.myopts), | addme=("--onlydeps" not in self.myopts), |
myuse=selected_pkg[-1], arg=arg): |
myuse=selected_pkg[-1], rev_dep=rev_deps, arg=arg): |
return 0 | return 0 |
| |
if "--debug" in self.myopts: | if "--debug" in self.myopts: |