--- bin/emerge 2003-02-20 14:34:16.000000000 -0700 +++ bin/emerge 2003-02-20 14:36:36.000000000 -0700 @@ -25,7 +25,7 @@ "--oneshot", "--onlydeps", "--pretend", "--quiet", "--resume", "--searchdesc", "--selective", "--update", "--usepkg", "--usepkgonly", "--verbose", "--version", -"--columns" +"--columns", "--nodowngrade" ] shortmapping={ "b":"--buildpkg", "B":"--buildpkgonly", @@ -33,6 +33,7 @@ "d":"--debug", "e":"--emptytree", "f":"--fetchonly", +"g":"--nodowngrade", "h":"--help", "i":"inject", "k":"--usepkg", "K":"--usepkgonly", @@ -614,6 +615,22 @@ # We're true here unless we are missing binaries. return (not self.missingbins,myfavorites) + def is_newer_ver_installed(self,myroot,pkg,pkgver): + "if there is a version of pkg installed newer than pkgver, return it" + vardbapi=portage.db[myroot]["vartree"].dbapi + + alleb=portage.portdb.xmatch("match-all",pkg) + while alleb: + cand=portage.portdb.xmatch("bestmatch-list",pkg,mylist=alleb) + if not cand: + break + if vardbapi.cpv_exists(cand): + # installed, is this package newer? + if portage.pkgcmp(portage.catpkgsplit(pkgver)[1:], portage.catpkgsplit(cand)[1:]) < 0: + return cand + break + alleb.remove(cand) + def select_dep(self,myroot,depstring,myparent=None,arg=None): "given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure" if not arg: @@ -654,6 +671,12 @@ else: print "\nemerge: there are no masked or unmasked ebuilds to satisfy "+xinfo+"." return 0 + + if "--nodowngrade" in myopts: + # Check that there isn't a newer version of this package already installed + cand=self.is_newer_ver_installed(myroot,x,myeb) + if cand: + myeb=cand if "--usepkg" in myopts: #If we want to use packages, see if we have a pre-built one... @@ -740,6 +763,12 @@ if not myeb: #this is an unavailable world entry; just continue continue + + if "--nodowngrade" in myopts: + cand=self.is_newer_ver_installed(portage.root,mydep,myeb) + if cand: + myeb=cand + #THIS NEXT BUNCH OF CODE NEEDS TO BE REPLACED TO SUPPORT WORLD ANTI-DEPS #if mydep2[0]=="!":, etc. if "--usepkg" in myopts: --- bin/emergehelp.py 2003-02-20 14:34:25.000000000 -0700 +++ bin/emergehelp.py 2003-02-20 14:38:23.000000000 -0700 @@ -15,7 +15,7 @@ print " "+turquoise("emerge")+" < "+turquoise("sync")+" | "+turquoise("rsync")+" | "+turquoise("info")+" >" print " "+turquoise("emerge")+" "+turquoise("--resume")+" ["+green("--pretend")+"]" print " "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("system")+" | "+green("config")+" | "+green("rsync")+" ] " - print bold("Options:")+" "+green("-")+"["+green("bcCdefhikKlnoOpPsSuvV")+"] ["+green("--deep")+"] ["+green("--oneshot")+"] ["+green("--noconfmem")+"]" + print bold("Options:")+" "+green("-")+"["+green("bcCdefghikKlnoOpPsSuvV")+"] ["+green("--deep")+"] ["+green("--oneshot")+"] ["+green("--noconfmem")+"]" print bold("Actions:")+" [ clean | depclean | inject | prune | regen | search | unmerge ]" print @@ -163,6 +163,10 @@ print " used in combination with --pretend all the SRC_URIs will be" print " displayed multiple mirrors per line, one line per file." print + print " "+green("--nodowngrade")+" ("+green("-g")+" short option)" + print " If an installed package becomes masked, do not downgrade to" + print " a lower, unmasked version." + print print " "+green("--noconfmem") print " Portage keeps track of files that have been placed into" print " CONFIG_PROTECT directories, and normally it will not merge the"