--- bin/emerge 2003/01/15 22:57:42 1.177 +++ bin/emerge 2003/01/18 22:03:59 @@ -552,6 +552,7 @@ mykey=portage.dep_expand(x,portage.portdb) #select needs to return 0 on dep_check failure try: + mybackup=self.digraph.copy() self.mysd=self.select_dep(portage.root,mykey,arg=x) except Exception, e: print "\n!!! Problem in",mykey,"dependancies." @@ -559,7 +560,8 @@ sys.exit(1) if not self.mysd: - return (0,myfavorites) + # ignore the uninstallable package and keep going + self.digraph=mybackup elif not "--oneshot" in myopts: myfavorites.append(mykey) @@ -588,54 +590,73 @@ #we're processing a command-line argument; unconditionally merge it even if it's already merged mymerge=[depstring] for x in mymerge: - if x[0]=="!": - #add our blocker; it will be ignored later if necessary (if we are remerging the same pkg, for example) - myk=["blocks",myroot,x[1:]] - else: - #We are not processing a blocker but a normal dependency - if "--usepkgonly" in myopts: - myeb=portage.db[portage.root]["bintree"].dep_bestmatch(x) + + if x[0]!="!": + viseb=portage.portdb.xmatch("match-visible",x) + + retry=1 + while retry: + retry=0 + + if x[0]=="!": + #add our blocker; it will be ignored later if necessary (if we are remerging the same pkg, for example) + myk=["blocks",myroot,x[1:]] else: - myeb=portage.portdb.xmatch("bestmatch-visible",x) - if not myeb: - if not arg: - xinfo='"'+x+'"' + #We are not processing a blocker but a normal dependency + if "--usepkgonly" in myopts: + myeb=portage.db[portage.root]["bintree"].dep_bestmatch(x) else: - xinfo='"'+arg+'"' - if myparent: - xfrom = '(dependency required by '+green('"'+myparent.split()[2]+'"')+red(' ['+myparent.split()[0]+"])") - alleb=portage.portdb.xmatch("match-all",x) - if alleb: - if "--usepkgonly" not in myopts: - print "\n!!! "+red("all ebuilds that could satisfy ")+green(xinfo)+red(" have been masked.") - if myparent: - print "!!! "+red(xfrom) + myeb=portage.portdb.xmatch("bestmatch-list",x,mylist=viseb) + if not myeb: + if not arg: + xinfo='"'+x+'"' else: - print "\n!!! "+red("There are no packages available to satisfy: ")+green(xinfo) - print "!!! Either add a suitable binary package or compile from an ebuild." - else: - print "\nemerge: there are no masked or unmasked ebuilds to satisfy "+xinfo+"." - return 0 - - if "--usepkg" in myopts: - #If we want to use packages, see if we have a pre-built one... - mypk=portage.db["/"]["bintree"].dbapi.match(x) - if myeb in mypk: - #Use it only if it's exactly the version we want. - myk=["binary",myroot,myeb] + xinfo='"'+arg+'"' + if myparent: + xfrom = '(dependency required by '+green('"'+myparent.split()[2]+'"')+red(' ['+myparent.split()[0]+"])") + alleb=portage.portdb.xmatch("match-all",x) + if alleb: + if "--usepkgonly" not in myopts: + print "\n!!! "+red("all ebuilds that could satisfy ")+green(xinfo)+red(" have been masked.") + if myparent: + print "!!! "+red(xfrom) + else: + print "\n!!! "+red("There are no packages available to satisfy: ")+green(xinfo) + print "!!! Either add a suitable binary package or compile from an ebuild." + else: + print "\nemerge: there are no masked or unmasked ebuilds to satisfy "+xinfo+"." + return 0 + + if "--usepkg" in myopts: + #If we want to use packages, see if we have a pre-built one... + mypk=portage.db["/"]["bintree"].dbapi.match(x) + if myeb in mypk: + #Use it only if it's exactly the version we want. + myk=["binary",myroot,myeb] + else: + myk=["ebuild",myroot,myeb] else: myk=["ebuild",myroot,myeb] + mybackup=self.digraph.copy() + if myparent: + #we are a dependency, so we want to be unconditionally added + if not self.create(myk,myparent): + if myeb in viseb: + viseb.remove(myeb) + self.digraph=mybackup + retry=1 + else: + return 0 else: - myk=["ebuild",myroot,myeb] - if myparent: - #we are a dependency, so we want to be unconditionally added - if not self.create(myk,myparent): - return 0 - else: - #if mysource is not set, then we are a command-line dependency and should not be added - #if --onlydeps is specified. - if not self.create(myk,myparent,"--onlydeps" not in myopts): - return 0 + #if mysource is not set, then we are a command-line dependency and should not be added + #if --onlydeps is specified. + if not self.create(myk,myparent,"--onlydeps" not in myopts): + if myeb in viseb: + viseb.remove(myeb) + self.digraph=mybackup + retry=1 + else: + return 0 return 1 @@ -698,22 +719,36 @@ mylist.append(sysdict[x]) for mydep in mylist: - myeb=portage.portdb.xmatch("bestmatch-visible",mydep) - if not myeb: + viseb=portage.portdb.xmatch("match-visible",mydep) + if not viseb: #this is an unavailable world entry; just continue continue - #THIS NEXT BUNCH OF CODE NEEDS TO BE REPLACED TO SUPPORT WORLD ANTI-DEPS - #if mydep2[0]=="!":, etc. - if "--usepkg" in myopts: - mypk=portage.db[portage.root]["bintree"].dep_bestmatch(mydep) - if myeb==mypk: - myk=["binary",portage.root,mypk] + + while viseb: + # keep trying for a 'create'able version of this package + myeb=portage.portdb.xmatch("bestmatch-list",mydep,mylist=viseb) + + #THIS NEXT BUNCH OF CODE NEEDS TO BE REPLACED TO SUPPORT WORLD ANTI-DEPS + #if mydep2[0]=="!":, etc. + if "--usepkg" in myopts: + mypk=portage.db[portage.root]["bintree"].dep_bestmatch(mydep) + if myeb==mypk: + myk=["binary",portage.root,mypk] + else: + myk=["ebuild",portage.root,myeb] else: myk=["ebuild",portage.root,myeb] - else: - myk=["ebuild",portage.root,myeb] - if not self.create(myk): - return 0 + mybackup=self.digraph.copy() + if not self.create(myk): + # retry, excluding myeb + viseb.remove(myeb) + self.digraph=mybackup + if not viseb: + # no version of this package can be installed, but + # why give up altogether? + break + else: + break return 1 def match(self,mydep,myroot=portage.root,mykey=None):