|
|
add=[] | add=[] |
sub=[] | sub=[] |
if "--update" in myopts or myaction in ("system", "world"): | if "--update" in myopts or myaction in ("system", "world"): |
add.extend(["selective","empty"]) |
add.extend(["empty"]) |
if "--emptytree" in myopts: | if "--emptytree" in myopts: |
add.extend(["empty"]) | add.extend(["empty"]) |
sub.extend(["selective"]) | sub.extend(["selective"]) |
if "--nodeps" in myopts: | if "--nodeps" in myopts: |
sub.extend(["recurse"]) | sub.extend(["recurse"]) |
if "--noreplace" in myopts: |
|
add.extend(["selective"]) |
|
if "--deep" in myopts: | if "--deep" in myopts: |
add.extend(["deep"]) | add.extend(["deep"]) |
if "--selective" in myopts: |
|
add.extend(["selective"]) |
|
if myaction in ["world","system"]: |
|
add.extend(["selective"]) |
|
elif myaction in ["depclean"]: | elif myaction in ["depclean"]: |
add.extend(["empty"]) | add.extend(["empty"]) |
sub.extend(["selective"]) | sub.extend(["selective"]) |
|
|
"--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,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. | 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. |
|
|
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, hard_dep=hard_dep) |
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, hard_dep=hard_dep) |
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
return 1 | return 1 |
| |
self.spinner.update() | self.spinner.update() |
|
|
if self.mydbapi[parent_root].match(mykey) or \ | if self.mydbapi[parent_root].match(mykey) or \ |
self.trees[parent_root]["vartree"].dbapi.match(mykey): | self.trees[parent_root]["vartree"].dbapi.match(mykey): |
mybigkey.append(myparent.split()[2]) | 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 | return 1 |
else: | else: |
mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi | mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi |
|
|
""" 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,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. | """ 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: |
|
|
""" We have retrieve the dependency information, now we need to recursively | """ We have retrieve the dependency information, now we need to recursively |
process them. DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """ | process them. DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """ |
| |
mydep={} |
|
mp=string.join(mybigkey) | mp=string.join(mybigkey) |
| |
try: | try: |
if myroot=="/": |
if not self.select_dep("/",edepend["DEPEND"],myparent=mp,myuse=myuse): |
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] |
return 0 |
if not self.select_dep("/",edepend["DEPEND"],myparent=mp,myuse=myuse): |
if not self.select_dep(myroot,edepend["RDEPEND"],myparent=mp,myuse=myuse,soft_deps=True): |
return 0 |
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 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 myparent: | if myparent: |
#we are a dependency, so we want to be unconditionally added | #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, | 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 | 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 |
|
|
while (not mygraph.empty()): | while (not mygraph.empty()): |
mycurkey=mygraph.firstzero() | mycurkey=mygraph.firstzero() |
if not mycurkey: | if not mycurkey: |
installables = mygraph.leaf_nodes(include_soft_deps=False) |
installables = mygraph.leaf_nodes(ignore_soft_deps=True) |
if not installables: | if not installables: |
print "!!! Error: circular dependencies:" | print "!!! Error: circular dependencies:" |
print | print |