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,force_merge=False): |
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 743-752
Link Here
|
743 |
is always included and if in 'selective' mode package is already |
744 |
is always included and if in 'selective' mode package is already |
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 not force_merge and \ |
747 |
vardbapi.cpv_exists(mykey)): |
748 |
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 not force_merge and vardbapi.cpv_exists(mykey): |
750 |
merging=0 |
751 |
merging=0 |
751 |
|
752 |
|
752 |
""" If we aren't merging, perform the --newuse check. |
753 |
""" If we aren't merging, perform the --newuse check. |
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 883-889
Link Here
|
883 |
print colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n") |
886 |
print colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n") |
884 |
sys.exit(1) |
887 |
sys.exit(1) |
885 |
if not self.create(["binary", myroot, mykey], |
888 |
if not self.create(["binary", myroot, mykey], |
886 |
None, "--onlydeps" not in self.myopts): |
889 |
None, "--onlydeps" not in self.myopts, force_merge=("--noreplace" not in self.myopts)): |
887 |
return (0,myfavorites) |
890 |
return (0,myfavorites) |
888 |
elif not "--oneshot" in self.myopts: |
891 |
elif not "--oneshot" in self.myopts: |
889 |
myfavorites.append(mykey) |
892 |
myfavorites.append(mykey) |
Lines 906-912
Link Here
|
906 |
raise portage_exception.PackageNotFound( |
909 |
raise portage_exception.PackageNotFound( |
907 |
"%s is not in a valid portage tree hierarchy or does not exist" % x) |
910 |
"%s is not in a valid portage tree hierarchy or does not exist" % x) |
908 |
if not self.create(["ebuild", myroot, mykey], |
911 |
if not self.create(["ebuild", myroot, mykey], |
909 |
None, "--onlydeps" not in self.myopts): |
912 |
None, "--onlydeps" not in self.myopts, force_merge==("--noreplace" not in self.myopts)): |
910 |
return (0,myfavorites) |
913 |
return (0,myfavorites) |
911 |
elif not "--oneshot" in self.myopts: |
914 |
elif not "--oneshot" in self.myopts: |
912 |
myfavorites.append(mykey) |
915 |
myfavorites.append(mykey) |
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 |
self.mysd = self.select_dep(myroot, mykey, arg=x, force_merge=("--noreplace" not in self.myopts)) |
944 |
except portage_exception.MissingSignature, e: |
947 |
except portage_exception.MissingSignature, e: |
945 |
portage.writemsg("\n\n!!! A missing gpg signature is preventing portage from calculating the\n") |
948 |
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") |
949 |
portage.writemsg("!!! required dependencies. This is a security feature enabled by the admin\n") |
Lines 969-975
Link Here
|
969 |
|
972 |
|
970 |
missing=0 |
973 |
missing=0 |
971 |
if "--usepkgonly" in self.myopts: |
974 |
if "--usepkgonly" in self.myopts: |
972 |
for x in self.digraph.dict.keys(): |
975 |
for x in self.digraph.all_nodes(): |
973 |
xs=string.split(x," ") |
976 |
xs=string.split(x," ") |
974 |
if (xs[0] != "binary") and (xs[3]=="merge"): |
977 |
if (xs[0] != "binary") and (xs[3]=="merge"): |
975 |
if missing == 0: |
978 |
if missing == 0: |
Lines 993-999
Link Here
|
993 |
if curslot == myslot: |
996 |
if curslot == myslot: |
994 |
return match |
997 |
return match |
995 |
|
998 |
|
996 |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False): |
999 |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,raise_on_missing=False,soft_deps=False,force_merge=False): |
997 |
""" Given a depstring, create the depgraph such that all dependencies are satisfied. |
1000 |
""" Given a depstring, create the depgraph such that all dependencies are satisfied. |
998 |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
1001 |
myroot = $ROOT from environment, where {R,P}DEPENDs are merged to. |
999 |
myparent = the node whose depstring is being passed in |
1002 |
myparent = the node whose depstring is being passed in |
Lines 1006-1011
Link Here
|
1006 |
|
1009 |
|
1007 |
portdb = self.trees[myroot]["porttree"].dbapi |
1010 |
portdb = self.trees[myroot]["porttree"].dbapi |
1008 |
bindb = self.trees[myroot]["bintree"].dbapi |
1011 |
bindb = self.trees[myroot]["bintree"].dbapi |
|
|
1012 |
vardb = self.trees[myroot]["vartree"].dbapi |
1009 |
pkgsettings = self.pkgsettings[myroot] |
1013 |
pkgsettings = self.pkgsettings[myroot] |
1010 |
|
1014 |
|
1011 |
if "--debug" in self.myopts: |
1015 |
if "--debug" in self.myopts: |
Lines 1020-1026
Link Here
|
1020 |
mycheck = portage.dep_check(depstring, self.mydbapi[myroot], |
1024 |
mycheck = portage.dep_check(depstring, self.mydbapi[myroot], |
1021 |
pkgsettings, myuse=myuse, |
1025 |
pkgsettings, myuse=myuse, |
1022 |
use_binaries=("--usepkgonly" in self.myopts), |
1026 |
use_binaries=("--usepkgonly" in self.myopts), |
1023 |
myroot=myroot, trees=self.trees) |
1027 |
myroot=myroot, trees=self.trees, return_all_deps=True) |
1024 |
|
1028 |
|
1025 |
if not mycheck[0]: |
1029 |
if not mycheck[0]: |
1026 |
mymerge=[] |
1030 |
mymerge=[] |
Lines 1056-1064
Link Here
|
1056 |
self.pkgsettings[p_root].setinst(p_key, |
1060 |
self.pkgsettings[p_root].setinst(p_key, |
1057 |
self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) |
1061 |
self.trees[p_root][self.pkg_tree_map[p_type]].dbapi) |
1058 |
|
1062 |
|
1059 |
if not mymerge: |
|
|
1060 |
return 1 |
1061 |
|
1062 |
if "--debug" in self.myopts: |
1063 |
if "--debug" in self.myopts: |
1063 |
print "Candidates:",mymerge |
1064 |
print "Candidates:",mymerge |
1064 |
for x in mymerge: |
1065 |
for x in mymerge: |
Lines 1178-1192
Link Here
|
1178 |
|
1179 |
|
1179 |
if myparent: |
1180 |
if myparent: |
1180 |
#we are a dependency, so we want to be unconditionally added |
1181 |
#we are a dependency, so we want to be unconditionally added |
|
|
1182 |
hard_dep = not soft_deps and len(vardb.match(x)) == 0 |
1181 |
if not self.create(selected_pkg[0:3], myparent, |
1183 |
if not self.create(selected_pkg[0:3], myparent, |
1182 |
myuse=selected_pkg[-1]): |
1184 |
myuse=selected_pkg[-1], hard_dep=hard_dep): |
1183 |
return 0 |
1185 |
return 0 |
1184 |
else: |
1186 |
else: |
1185 |
#if mysource is not set, then we are a command-line dependency and should not be added |
1187 |
#if mysource is not set, then we are a command-line dependency and should not be added |
1186 |
#if --onlydeps is specified. |
1188 |
#if --onlydeps is specified. |
1187 |
if not self.create(selected_pkg[0:3], myparent, |
1189 |
if not self.create(selected_pkg[0:3], myparent, |
1188 |
addme=("--onlydeps" not in self.myopts), |
1190 |
addme=("--onlydeps" not in self.myopts), |
1189 |
myuse=selected_pkg[-1]): |
1191 |
myuse=selected_pkg[-1], force_merge=force_merge): |
1190 |
return 0 |
1192 |
return 0 |
1191 |
|
1193 |
|
1192 |
if "--debug" in self.myopts: |
1194 |
if "--debug" in self.myopts: |
Lines 1205-1217
Link Here
|
1205 |
while (not mygraph.empty()): |
1207 |
while (not mygraph.empty()): |
1206 |
mycurkey=mygraph.firstzero() |
1208 |
mycurkey=mygraph.firstzero() |
1207 |
if not mycurkey: |
1209 |
if not mycurkey: |
1208 |
print "!!! Error: circular dependencies:" |
1210 |
installables = mygraph.leaf_nodes(include_soft_deps=True) |
1209 |
print |
1211 |
if not installables: |
1210 |
for x in mygraph.allnodes(): |
1212 |
print "!!! Error: circular dependencies:" |
1211 |
for y in mygraph.parent_nodes(x): |
1213 |
print |
1212 |
print y,"depends on",x |
1214 |
for x in mygraph.allnodes(): |
1213 |
print |
1215 |
for y in mygraph.parent_nodes(x): |
1214 |
sys.exit(1) |
1216 |
print y,"depends on",x |
|
|
1217 |
print |
1218 |
sys.exit(1) |
1219 |
mycurkey = installables[0] |
1215 |
splitski=string.split(mycurkey) |
1220 |
splitski=string.split(mycurkey) |
1216 |
#I'm not sure of the significance of the following lines (vestigal?) so I'm commenting 'em out. |
1221 |
#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 |
1222 |
#These lines remove already-merged things from our alt-list |