Lines 352-358
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"): |
Lines 679-685
Link Here
|
679 |
"--getbinpkg" in self.myopts, |
679 |
"--getbinpkg" in self.myopts, |
680 |
"--getbinpkgonly" in self.myopts) |
680 |
"--getbinpkgonly" in self.myopts) |
681 |
|
681 |
|
682 |
def create(self,mybigkey,myparent=None,addme=1,myuse=None): |
682 |
def create(self,mybigkey,myparent=None,addme=1,myuse=None,hard_dep=True,arg=None): |
683 |
""" |
683 |
""" |
684 |
Fills the digraph with nodes comprised of packages to merge. |
684 |
Fills the digraph with nodes comprised of packages to merge. |
685 |
mybigkey is the package spec of the package to merge. |
685 |
mybigkey is the package spec of the package to merge. |
Lines 697-706
Link Here
|
697 |
if addme and jbigkey != myparent: |
697 |
if addme and jbigkey != myparent: |
698 |
# Refuse to make a node depend on itself so that the we don't |
698 |
# 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(). |
699 |
# don't create a bogus circular dependency in self.altlist(). |
700 |
self.digraph.addnode(jbigkey, myparent) |
700 |
self.digraph.addnode(jbigkey, myparent, hard_dep=hard_dep) |
701 |
return 1 |
701 |
return 1 |
702 |
jbigkey = " ".join(mybigkey) + " nomerge" |
702 |
jbigkey = " ".join(mybigkey) + " nomerge" |
703 |
if self.digraph.hasnode(jbigkey): |
703 |
if self.digraph.hasnode(jbigkey): |
|
|
704 |
self.digraph.addnode(jbigkey, myparent, hard_dep=hard_dep) |
704 |
return 1 |
705 |
return 1 |
705 |
|
706 |
|
706 |
self.spinner.update() |
707 |
self.spinner.update() |
Lines 723-729
Link Here
|
723 |
if self.mydbapi[parent_root].match(mykey) or \ |
724 |
if self.mydbapi[parent_root].match(mykey) or \ |
724 |
self.trees[parent_root]["vartree"].dbapi.match(mykey): |
725 |
self.trees[parent_root]["vartree"].dbapi.match(mykey): |
725 |
mybigkey.append(myparent.split()[2]) |
726 |
mybigkey.append(myparent.split()[2]) |
726 |
self.digraph.addnode(" ".join(mybigkey), myparent) |
727 |
self.digraph.addnode(" ".join(mybigkey), myparent, hard_dep) |
727 |
return 1 |
728 |
return 1 |
728 |
else: |
729 |
else: |
729 |
mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi |
730 |
mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi |
Lines 744-750
Link Here
|
744 |
installed we skip merging it.""" |
745 |
installed we skip merging it.""" |
745 |
if "self" not in self.myparams or \ |
746 |
if "self" not in self.myparams or \ |
746 |
("selective" in self.myparams and \ |
747 |
("selective" in self.myparams and \ |
747 |
vardbapi.cpv_exists(mykey)): |
748 |
not arg and vardbapi.cpv_exists(mykey)): |
748 |
merging=0 |
749 |
merging=0 |
749 |
elif "selective" in self.myparams and vardbapi.cpv_exists(mykey): |
750 |
elif "selective" in self.myparams and vardbapi.cpv_exists(mykey): |
750 |
merging=0 |
751 |
merging=0 |
Lines 782-788
Link Here
|
782 |
""" At this point, we have either hit a blocker and returned, found the package in the |
783 |
""" 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 |
784 |
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. """ |
785 |
add the package to the depgraph; so we do that here. """ |
785 |
self.digraph.addnode(string.join(mybigkey),myparent) |
786 |
self.digraph.addnode(string.join(mybigkey),myparent,hard_dep=hard_dep) |
786 |
|
787 |
|
787 |
""" This section determines whether we go deeper into dependencies or not. |
788 |
""" This section determines whether we go deeper into dependencies or not. |
788 |
We want to go deeper on a few occasions: |
789 |
We want to go deeper on a few occasions: |
Lines 821-840
Link Here
|
821 |
try: |
822 |
try: |
822 |
if myroot=="/": |
823 |
if myroot=="/": |
823 |
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] |
824 |
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] |
824 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
825 |
if not self.select_dep("/",edepend["DEPEND"],myparent=mp,myuse=myuse): |
|
|
826 |
return 0 |
827 |
if not self.select_dep("/",edepend["RDEPEND"],myparent=mp,myuse=myuse,soft_deps=True): |
825 |
return 0 |
828 |
return 0 |
826 |
else: |
829 |
else: |
827 |
mydep["/"]=edepend["DEPEND"] |
830 |
mydep["/"]=edepend["DEPEND"] |
828 |
mydep[myroot]=edepend["RDEPEND"] |
831 |
mydep[myroot]=edepend["RDEPEND"] |
829 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
832 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
830 |
return 0 |
833 |
return 0 |
831 |
if not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse): |
834 |
if not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse,soft_deps=True): |
832 |
return 0 |
835 |
return 0 |
833 |
|
836 |
|
834 |
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
837 |
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
835 |
# Post Depend -- Add to the list without a parent, as it depends |
838 |
# 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. |
839 |
# on a package being present AND must be built after that package. |
837 |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse): |
840 |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,soft_deps=True): |
838 |
return 0 |
841 |
return 0 |
839 |
except ValueError, e: |
842 |
except ValueError, e: |
840 |
pkgs = e.args[0] |
843 |
pkgs = e.args[0] |
Lines 940-946
Link Here
|
940 |
sys.stderr.flush() |
943 |
sys.stderr.flush() |
941 |
|
944 |
|
942 |
try: |
945 |
try: |
943 |
self.mysd = self.select_dep(myroot, mykey, arg=x) |
946 |
if "--noreplace" in self.myopts: |
|
|
947 |
arg = None |
948 |
else: |
949 |
arg = x |
950 |
self.mysd = self.select_dep(myroot, mykey, arg=arg) |
944 |
except portage_exception.MissingSignature, e: |
951 |
except portage_exception.MissingSignature, e: |
945 |
portage.writemsg("\n\n!!! A missing gpg signature is preventing portage from calculating the\n") |
952 |
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") |
953 |
portage.writemsg("!!! required dependencies. This is a security feature enabled by the admin\n") |
Lines 969-975
Link Here
|
969 |
|
976 |
|
970 |
missing=0 |
977 |
missing=0 |
971 |
if "--usepkgonly" in self.myopts: |
978 |
if "--usepkgonly" in self.myopts: |
972 |
for x in self.digraph.dict.keys(): |
979 |
for x in self.digraph.all_nodes(): |
973 |
xs=string.split(x," ") |
980 |
xs=string.split(x," ") |
974 |
if (xs[0] != "binary") and (xs[3]=="merge"): |
981 |
if (xs[0] != "binary") and (xs[3]=="merge"): |
975 |
if missing == 0: |
982 |
if missing == 0: |
Lines 993-999
Link Here
|
993 |
if curslot == myslot: |
1000 |
if curslot == myslot: |
994 |
return match |
1001 |
return match |
995 |
|
1002 |
|
996 |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False): |
1003 |
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. |
1004 |
""" Given a depstring, create the depgraph such that all dependencies are satisfied. |
998 |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
1005 |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
999 |
myparent = the node whose depstring is being passed in |
1006 |
myparent = the node whose depstring is being passed in |
Lines 1006-1011
Link Here
|
1006 |
|
1013 |
|
1007 |
portdb = self.trees[myroot]["porttree"].dbapi |
1014 |
portdb = self.trees[myroot]["porttree"].dbapi |
1008 |
bindb = self.trees[myroot]["bintree"].dbapi |
1015 |
bindb = self.trees[myroot]["bintree"].dbapi |
|
|
1016 |
vardb = self.trees[myroot]["vartree"].dbapi |
1009 |
pkgsettings = self.pkgsettings[myroot] |
1017 |
pkgsettings = self.pkgsettings[myroot] |
1010 |
|
1018 |
|
1011 |
if "--debug" in self.myopts: |
1019 |
if "--debug" in self.myopts: |
Lines 1020-1026
Link Here
|
1020 |
mycheck = portage.dep_check(depstring, self.mydbapi[myroot], |
1028 |
mycheck = portage.dep_check(depstring, self.mydbapi[myroot], |
1021 |
pkgsettings, myuse=myuse, |
1029 |
pkgsettings, myuse=myuse, |
1022 |
use_binaries=("--usepkgonly" in self.myopts), |
1030 |
use_binaries=("--usepkgonly" in self.myopts), |
1023 |
myroot=myroot, trees=self.trees) |
1031 |
myroot=myroot, trees=self.trees, return_all_deps=True) |
1024 |
|
1032 |
|
1025 |
if not mycheck[0]: |
1033 |
if not mycheck[0]: |
1026 |
mymerge=[] |
1034 |
mymerge=[] |
Lines 1056-1064
Link Here
|
1056 |
self.pkgsettings[p_root].setinst(p_key, |
1064 |
self.pkgsettings[p_root].setinst(p_key, |
1057 |
self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) |
1065 |
self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) |
1058 |
|
1066 |
|
1059 |
if not mymerge: |
|
|
1060 |
return 1 |
1061 |
|
1062 |
if "--debug" in self.myopts: |
1067 |
if "--debug" in self.myopts: |
1063 |
print "Candidates:",mymerge |
1068 |
print "Candidates:",mymerge |
1064 |
for x in mymerge: |
1069 |
for x in mymerge: |
Lines 1076-1081
Link Here
|
1076 |
selected_pkg = ["blocks", myroot, x[1:], None] |
1081 |
selected_pkg = ["blocks", myroot, x[1:], None] |
1077 |
else: |
1082 |
else: |
1078 |
#We are not processing a blocker but a normal dependency |
1083 |
#We are not processing a blocker but a normal dependency |
|
|
1084 |
pkg_key = portage.dep_getkey(x) |
1085 |
if pkg_key in pkgsettings.pprovideddict and \ |
1086 |
portage.match_from_list( |
1087 |
x, pkgsettings.pprovideddict[pkg_key]): |
1088 |
continue |
1089 |
|
1079 |
# List of acceptable packages, ordered by type preference. |
1090 |
# List of acceptable packages, ordered by type preference. |
1080 |
matched_packages = [] |
1091 |
matched_packages = [] |
1081 |
myeb_matches = portdb.xmatch("match-visible", x) |
1092 |
myeb_matches = portdb.xmatch("match-visible", x) |
Lines 1178-1192
Link Here
|
1178 |
|
1189 |
|
1179 |
if myparent: |
1190 |
if myparent: |
1180 |
#we are a dependency, so we want to be unconditionally added |
1191 |
#we are a dependency, so we want to be unconditionally added |
|
|
1192 |
hard_dep = not soft_deps and len(vardb.match(x)) == 0 |
1181 |
if not self.create(selected_pkg[0:3], myparent, |
1193 |
if not self.create(selected_pkg[0:3], myparent, |
1182 |
myuse=selected_pkg[-1]): |
1194 |
myuse=selected_pkg[-1], hard_dep=hard_dep, arg=arg): |
1183 |
return 0 |
1195 |
return 0 |
1184 |
else: |
1196 |
else: |
1185 |
#if mysource is not set, then we are a command-line dependency and should not be added |
1197 |
#if mysource is not set, then we are a command-line dependency and should not be added |
1186 |
#if --onlydeps is specified. |
1198 |
#if --onlydeps is specified. |
1187 |
if not self.create(selected_pkg[0:3], myparent, |
1199 |
if not self.create(selected_pkg[0:3], myparent, |
1188 |
addme=("--onlydeps" not in self.myopts), |
1200 |
addme=("--onlydeps" not in self.myopts), |
1189 |
myuse=selected_pkg[-1]): |
1201 |
myuse=selected_pkg[-1], arg=arg): |
1190 |
return 0 |
1202 |
return 0 |
1191 |
|
1203 |
|
1192 |
if "--debug" in self.myopts: |
1204 |
if "--debug" in self.myopts: |
Lines 1205-1217
Link Here
|
1205 |
while (not mygraph.empty()): |
1217 |
while (not mygraph.empty()): |
1206 |
mycurkey=mygraph.firstzero() |
1218 |
mycurkey=mygraph.firstzero() |
1207 |
if not mycurkey: |
1219 |
if not mycurkey: |
1208 |
print "!!! Error: circular dependencies:" |
1220 |
installables = mygraph.leaf_nodes(include_soft_deps=False) |
1209 |
print |
1221 |
if not installables: |
1210 |
for x in mygraph.dict.keys(): |
1222 |
print "!!! Error: circular dependencies:" |
1211 |
for y in mygraph.dict[x][1]: |
1223 |
print |
1212 |
print y,"depends on",x |
1224 |
for x in mygraph.allnodes(): |
1213 |
print |
1225 |
for y in mygraph.parent_nodes(x): |
1214 |
sys.exit(1) |
1226 |
print y,"depends on",x |
|
|
1227 |
print |
1228 |
sys.exit(1) |
1229 |
mycurkey = installables[0] |
1215 |
splitski=string.split(mycurkey) |
1230 |
splitski=string.split(mycurkey) |
1216 |
#I'm not sure of the significance of the following lines (vestigal?) so I'm commenting 'em out. |
1231 |
#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 |
1232 |
#These lines remove already-merged things from our alt-list |