Lines 352-375
Link Here
|
352 |
# recurse: go into the dependencies |
352 |
# recurse: go into the dependencies |
353 |
# deep: go into the dependencies of already merged packages |
353 |
# deep: go into the dependencies of already merged packages |
354 |
# empty: pretend nothing is merged |
354 |
# empty: pretend nothing is merged |
355 |
myparams=["self","recurse"] |
355 |
myparams=["self","recurse","selective"] |
356 |
add=[] |
356 |
add=[] |
357 |
sub=[] |
357 |
sub=[] |
358 |
if "--update" in myopts or myaction in ("system", "world"): |
358 |
if "--update" in myopts or myaction in ("system", "world"): |
359 |
add.extend(["selective","empty"]) |
359 |
add.extend(["empty"]) |
360 |
if "--emptytree" in myopts: |
360 |
if "--emptytree" in myopts: |
361 |
add.extend(["empty"]) |
361 |
add.extend(["empty"]) |
362 |
sub.extend(["selective"]) |
362 |
sub.extend(["selective"]) |
363 |
if "--nodeps" in myopts: |
363 |
if "--nodeps" in myopts: |
364 |
sub.extend(["recurse"]) |
364 |
sub.extend(["recurse"]) |
365 |
if "--noreplace" in myopts: |
|
|
366 |
add.extend(["selective"]) |
367 |
if "--deep" in myopts: |
365 |
if "--deep" in myopts: |
368 |
add.extend(["deep"]) |
366 |
add.extend(["deep"]) |
369 |
if "--selective" in myopts: |
|
|
370 |
add.extend(["selective"]) |
371 |
if myaction in ["world","system"]: |
372 |
add.extend(["selective"]) |
373 |
elif myaction in ["depclean"]: |
367 |
elif myaction in ["depclean"]: |
374 |
add.extend(["empty"]) |
368 |
add.extend(["empty"]) |
375 |
sub.extend(["selective"]) |
369 |
sub.extend(["selective"]) |
Lines 679-685
Link Here
|
679 |
"--getbinpkg" in self.myopts, |
673 |
"--getbinpkg" in self.myopts, |
680 |
"--getbinpkgonly" in self.myopts) |
674 |
"--getbinpkgonly" in self.myopts) |
681 |
|
675 |
|
682 |
def create(self,mybigkey,myparent=None,addme=1,myuse=None): |
676 |
def create(self,mybigkey,myparent=None,addme=1,myuse=None,soft_dep=False,arg=None): |
683 |
""" |
677 |
""" |
684 |
Fills the digraph with nodes comprised of packages to merge. |
678 |
Fills the digraph with nodes comprised of packages to merge. |
685 |
mybigkey is the package spec of the package to merge. |
679 |
mybigkey is the package spec of the package to merge. |
Lines 697-706
Link Here
|
697 |
if addme and jbigkey != myparent: |
691 |
if addme and jbigkey != myparent: |
698 |
# Refuse to make a node depend on itself so that the we don't |
692 |
# Refuse to make a node depend on itself so that the we don't |
699 |
# don't create a bogus circular dependency in self.altlist(). |
693 |
# don't create a bogus circular dependency in self.altlist(). |
700 |
self.digraph.addnode(jbigkey, myparent) |
694 |
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
701 |
return 1 |
695 |
return 1 |
702 |
jbigkey = " ".join(mybigkey) + " nomerge" |
696 |
jbigkey = " ".join(mybigkey) + " nomerge" |
703 |
if self.digraph.hasnode(jbigkey): |
697 |
if self.digraph.hasnode(jbigkey): |
|
|
698 |
self.digraph.addnode(jbigkey, myparent, soft_dep=soft_dep) |
704 |
return 1 |
699 |
return 1 |
705 |
|
700 |
|
706 |
self.spinner.update() |
701 |
self.spinner.update() |
Lines 723-729
Link Here
|
723 |
if self.mydbapi[parent_root].match(mykey) or \ |
718 |
if self.mydbapi[parent_root].match(mykey) or \ |
724 |
self.trees[parent_root]["vartree"].dbapi.match(mykey): |
719 |
self.trees[parent_root]["vartree"].dbapi.match(mykey): |
725 |
mybigkey.append(myparent.split()[2]) |
720 |
mybigkey.append(myparent.split()[2]) |
726 |
self.digraph.addnode(" ".join(mybigkey), myparent) |
721 |
self.digraph.addnode(" ".join(mybigkey), myparent, soft_dep=soft_dep) |
727 |
return 1 |
722 |
return 1 |
728 |
else: |
723 |
else: |
729 |
mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi |
724 |
mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi |
Lines 744-750
Link Here
|
744 |
installed we skip merging it.""" |
739 |
installed we skip merging it.""" |
745 |
if "self" not in self.myparams or \ |
740 |
if "self" not in self.myparams or \ |
746 |
("selective" in self.myparams and \ |
741 |
("selective" in self.myparams and \ |
747 |
vardbapi.cpv_exists(mykey)): |
742 |
not arg and vardbapi.cpv_exists(mykey)): |
748 |
merging=0 |
743 |
merging=0 |
749 |
elif "selective" in self.myparams and vardbapi.cpv_exists(mykey): |
744 |
elif "selective" in self.myparams and vardbapi.cpv_exists(mykey): |
750 |
merging=0 |
745 |
merging=0 |
Lines 782-788
Link Here
|
782 |
""" At this point, we have either hit a blocker and returned, found the package in the |
777 |
""" At this point, we have either hit a blocker and returned, found the package in the |
783 |
depgraph already and returned, or we are here. Whether we are merging or not; we must |
778 |
depgraph already and returned, or we are here. Whether we are merging or not; we must |
784 |
add the package to the depgraph; so we do that here. """ |
779 |
add the package to the depgraph; so we do that here. """ |
785 |
self.digraph.addnode(string.join(mybigkey),myparent) |
780 |
self.digraph.addnode(string.join(mybigkey),myparent,soft_dep=soft_dep) |
786 |
|
781 |
|
787 |
""" This section determines whether we go deeper into dependencies or not. |
782 |
""" This section determines whether we go deeper into dependencies or not. |
788 |
We want to go deeper on a few occasions: |
783 |
We want to go deeper on a few occasions: |
Lines 815-840
Link Here
|
815 |
""" We have retrieve the dependency information, now we need to recursively |
810 |
""" We have retrieve the dependency information, now we need to recursively |
816 |
process them. DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """ |
811 |
process them. DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """ |
817 |
|
812 |
|
818 |
mydep={} |
|
|
819 |
mp=string.join(mybigkey) |
813 |
mp=string.join(mybigkey) |
820 |
|
814 |
|
821 |
try: |
815 |
try: |
822 |
if myroot=="/": |
816 |
if not self.select_dep("/",edepend["DEPEND"],myparent=mp,myuse=myuse): |
823 |
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] |
817 |
return 0 |
824 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
818 |
if not self.select_dep(myroot,edepend["RDEPEND"],myparent=mp,myuse=myuse,soft_deps=True): |
825 |
return 0 |
819 |
return 0 |
826 |
else: |
|
|
827 |
mydep["/"]=edepend["DEPEND"] |
828 |
mydep[myroot]=edepend["RDEPEND"] |
829 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
830 |
return 0 |
831 |
if not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse): |
832 |
return 0 |
833 |
|
834 |
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
820 |
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
835 |
# Post Depend -- Add to the list without a parent, as it depends |
821 |
# Post Depend -- Add to the list without a parent, as it depends |
836 |
# on a package being present AND must be built after that package. |
822 |
# on a package being present AND must be built after that package. |
837 |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse): |
823 |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,soft_deps=True): |
838 |
return 0 |
824 |
return 0 |
839 |
except ValueError, e: |
825 |
except ValueError, e: |
840 |
pkgs = e.args[0] |
826 |
pkgs = e.args[0] |
Lines 940-946
Link Here
|
940 |
sys.stderr.flush() |
926 |
sys.stderr.flush() |
941 |
|
927 |
|
942 |
try: |
928 |
try: |
943 |
self.mysd = self.select_dep(myroot, mykey, arg=x) |
929 |
if "--noreplace" in self.myopts: |
|
|
930 |
arg = None |
931 |
else: |
932 |
arg = x |
933 |
self.mysd = self.select_dep(myroot, mykey, arg=arg) |
944 |
except portage_exception.MissingSignature, e: |
934 |
except portage_exception.MissingSignature, e: |
945 |
portage.writemsg("\n\n!!! A missing gpg signature is preventing portage from calculating the\n") |
935 |
portage.writemsg("\n\n!!! A missing gpg signature is preventing portage from calculating the\n") |
946 |
portage.writemsg("!!! required dependencies. This is a security feature enabled by the admin\n") |
936 |
portage.writemsg("!!! required dependencies. This is a security feature enabled by the admin\n") |
Lines 969-975
Link Here
|
969 |
|
959 |
|
970 |
missing=0 |
960 |
missing=0 |
971 |
if "--usepkgonly" in self.myopts: |
961 |
if "--usepkgonly" in self.myopts: |
972 |
for x in self.digraph.dict.keys(): |
962 |
for x in self.digraph.all_nodes(): |
973 |
xs=string.split(x," ") |
963 |
xs=string.split(x," ") |
974 |
if (xs[0] != "binary") and (xs[3]=="merge"): |
964 |
if (xs[0] != "binary") and (xs[3]=="merge"): |
975 |
if missing == 0: |
965 |
if missing == 0: |
Lines 993-999
Link Here
|
993 |
if curslot == myslot: |
983 |
if curslot == myslot: |
994 |
return match |
984 |
return match |
995 |
|
985 |
|
996 |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False): |
986 |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False,soft_deps=False): |
997 |
""" Given a depstring, create the depgraph such that all dependencies are satisfied. |
987 |
""" Given a depstring, create the depgraph such that all dependencies are satisfied. |
998 |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
988 |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
999 |
myparent = the node whose depstring is being passed in |
989 |
myparent = the node whose depstring is being passed in |
Lines 1006-1011
Link Here
|
1006 |
|
996 |
|
1007 |
portdb = self.trees[myroot]["porttree"].dbapi |
997 |
portdb = self.trees[myroot]["porttree"].dbapi |
1008 |
bindb = self.trees[myroot]["bintree"].dbapi |
998 |
bindb = self.trees[myroot]["bintree"].dbapi |
|
|
999 |
vardb = self.trees[myroot]["vartree"].dbapi |
1009 |
pkgsettings = self.pkgsettings[myroot] |
1000 |
pkgsettings = self.pkgsettings[myroot] |
1010 |
|
1001 |
|
1011 |
if "--debug" in self.myopts: |
1002 |
if "--debug" in self.myopts: |
Lines 1020-1026
Link Here
|
1020 |
mycheck = portage.dep_check(depstring, self.mydbapi[myroot], |
1011 |
mycheck = portage.dep_check(depstring, self.mydbapi[myroot], |
1021 |
pkgsettings, myuse=myuse, |
1012 |
pkgsettings, myuse=myuse, |
1022 |
use_binaries=("--usepkgonly" in self.myopts), |
1013 |
use_binaries=("--usepkgonly" in self.myopts), |
1023 |
myroot=myroot, trees=self.trees) |
1014 |
myroot=myroot, trees=self.trees, return_all_deps=True) |
1024 |
|
1015 |
|
1025 |
if not mycheck[0]: |
1016 |
if not mycheck[0]: |
1026 |
mymerge=[] |
1017 |
mymerge=[] |
Lines 1056-1064
Link Here
|
1056 |
self.pkgsettings[p_root].setinst(p_key, |
1047 |
self.pkgsettings[p_root].setinst(p_key, |
1057 |
self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) |
1048 |
self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) |
1058 |
|
1049 |
|
1059 |
if not mymerge: |
|
|
1060 |
return 1 |
1061 |
|
1062 |
if "--debug" in self.myopts: |
1050 |
if "--debug" in self.myopts: |
1063 |
print "Candidates:",mymerge |
1051 |
print "Candidates:",mymerge |
1064 |
for x in mymerge: |
1052 |
for x in mymerge: |
Lines 1076-1081
Link Here
|
1076 |
selected_pkg = ["blocks", myroot, x[1:], None] |
1064 |
selected_pkg = ["blocks", myroot, x[1:], None] |
1077 |
else: |
1065 |
else: |
1078 |
#We are not processing a blocker but a normal dependency |
1066 |
#We are not processing a blocker but a normal dependency |
|
|
1067 |
pkg_key = portage.dep_getkey(x) |
1068 |
if pkg_key in pkgsettings.pprovideddict and \ |
1069 |
portage.match_from_list( |
1070 |
x, pkgsettings.pprovideddict[pkg_key]): |
1071 |
continue |
1072 |
|
1079 |
# List of acceptable packages, ordered by type preference. |
1073 |
# List of acceptable packages, ordered by type preference. |
1080 |
matched_packages = [] |
1074 |
matched_packages = [] |
1081 |
myeb_matches = portdb.xmatch("match-visible", x) |
1075 |
myeb_matches = portdb.xmatch("match-visible", x) |
Lines 1178-1192
Link Here
|
1178 |
|
1172 |
|
1179 |
if myparent: |
1173 |
if myparent: |
1180 |
#we are a dependency, so we want to be unconditionally added |
1174 |
#we are a dependency, so we want to be unconditionally added |
|
|
1175 |
soft_dep = soft_deps or vardb.match(x) |
1181 |
if not self.create(selected_pkg[0:3], myparent, |
1176 |
if not self.create(selected_pkg[0:3], myparent, |
1182 |
myuse=selected_pkg[-1]): |
1177 |
myuse=selected_pkg[-1], soft_dep=soft_dep, arg=arg): |
1183 |
return 0 |
1178 |
return 0 |
1184 |
else: |
1179 |
else: |
1185 |
#if mysource is not set, then we are a command-line dependency and should not be added |
1180 |
#if mysource is not set, then we are a command-line dependency and should not be added |
1186 |
#if --onlydeps is specified. |
1181 |
#if --onlydeps is specified. |
1187 |
if not self.create(selected_pkg[0:3], myparent, |
1182 |
if not self.create(selected_pkg[0:3], myparent, |
1188 |
addme=("--onlydeps" not in self.myopts), |
1183 |
addme=("--onlydeps" not in self.myopts), |
1189 |
myuse=selected_pkg[-1]): |
1184 |
myuse=selected_pkg[-1], arg=arg): |
1190 |
return 0 |
1185 |
return 0 |
1191 |
|
1186 |
|
1192 |
if "--debug" in self.myopts: |
1187 |
if "--debug" in self.myopts: |
Lines 1205-1217
Link Here
|
1205 |
while (not mygraph.empty()): |
1200 |
while (not mygraph.empty()): |
1206 |
mycurkey=mygraph.firstzero() |
1201 |
mycurkey=mygraph.firstzero() |
1207 |
if not mycurkey: |
1202 |
if not mycurkey: |
1208 |
print "!!! Error: circular dependencies:" |
1203 |
installables = mygraph.leaf_nodes(ignore_soft_deps=True) |
1209 |
print |
1204 |
if not installables: |
1210 |
for x in mygraph.dict.keys(): |
1205 |
print "!!! Error: circular dependencies:" |
1211 |
for y in mygraph.dict[x][1]: |
1206 |
print |
1212 |
print y,"depends on",x |
1207 |
for x in mygraph.allnodes(): |
1213 |
print |
1208 |
for y in mygraph.parent_nodes(x): |
1214 |
sys.exit(1) |
1209 |
print y,"depends on",x |
|
|
1210 |
print |
1211 |
sys.exit(1) |
1212 |
mycurkey = installables[0] |
1215 |
splitski=string.split(mycurkey) |
1213 |
splitski=string.split(mycurkey) |
1216 |
#I'm not sure of the significance of the following lines (vestigal?) so I'm commenting 'em out. |
1214 |
#I'm not sure of the significance of the following lines (vestigal?) so I'm commenting 'em out. |
1217 |
#These lines remove already-merged things from our alt-list |
1215 |
#These lines remove already-merged things from our alt-list |