Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 20637 Details for
Bug 13616
per package USE flags and KEYWORDS
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Diff for the modified per-package-use support
the.diff (text/plain), 26.99 KB, created by
Nicholas Jones (RETIRED)
on 2003-11-12 03:35:50 UTC
(
hide
)
Description:
Diff for the modified per-package-use support
Filename:
MIME Type:
Creator:
Nicholas Jones (RETIRED)
Created:
2003-11-12 03:35:50 UTC
Size:
26.99 KB
patch
obsolete
>Index: bin/ebuild.sh >=================================================================== >RCS file: /home/cvsroot/gentoo-src/portage/bin/ebuild.sh,v >retrieving revision 1.145 >diff -u -r1.145 ebuild.sh >--- bin/ebuild.sh 10 Nov 2003 08:30:55 -0000 1.145 >+++ bin/ebuild.sh 12 Nov 2003 11:29:04 -0000 >@@ -727,6 +727,7 @@ > echo "$CXXFLAGS" > CXXFLAGS > echo "$DEPEND" > DEPEND > echo "$IUSE" > IUSE >+ echo "$PKGUSE" > PKGUSE > echo "$LICENSE" > LICENSE > echo "$CATEGORY" > CATEGORY > echo "$PDEPEND" > PDEPEND >Index: bin/emerge >=================================================================== >RCS file: /home/cvsroot/gentoo-src/portage/bin/emerge,v >retrieving revision 1.230 >diff -u -r1.230 emerge >--- bin/emerge 12 Nov 2003 01:16:33 -0000 1.230 >+++ bin/emerge 12 Nov 2003 11:29:04 -0000 >@@ -7,7 +7,7 @@ > os.environ["PORTAGE_CALLER"]="emerge" > sys.path = ["/usr/lib/portage/pym"]+sys.path > >-import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal >+import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal,socket > from stat import * > from output import * > >@@ -15,6 +15,12 @@ > if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true"]): > nocolor() > >+def normpath(mystr): >+ if mystr and (mystr[0]=='/'): >+ return os.path.normpath("///"+mystr) >+ else: >+ return os.path.normpath(mystr) >+ > if portage.settings.has_key("PORTAGE_NICENESS"): > try: > os.nice(int(portage.settings["PORTAGE_NICENESS"])) >@@ -605,6 +611,9 @@ > > def __init__(self,myaction,myopts): > global olddbapi >+ self.pkgsettings = portage.config(clone=portage.settings) >+ self.applied_useflags = {} >+ > self.missingbins=[] > self.myaction=myaction > self.virts=portage.getvirtuals("/") >@@ -652,7 +661,10 @@ > > mytype,myroot,mykey=mybigkey > if myuse == None: >- myuse=string.split(portage.settings["USE"], " ") >+ self.pkgsettings.setcpv(mykey) >+ myuse=string.split(self.pkgsettings["USE"], " ") >+ >+ self.applied_useflags[mykey] = myuse > > # select the correct /var database that we'll be checking against > vardbapi=portage.db[myroot]["vartree"].dbapi >@@ -1146,13 +1158,15 @@ > > iuse="" > if "--verbose" in myopts: >- for ebuild_iuse in string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " "): >- try: >- if (portage.usesplit.index(ebuild_iuse) >= 0) : >- iuse=iuse+red("+"+ebuild_iuse)+" " >- except ValueError: >- if ebuild_iuse != "": >- iuse=iuse+blue("-"+ebuild_iuse)+" " >+ iuse_split = string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " ") >+ iuse_split.sort() >+ for ebuild_iuse in iuse_split: >+ if not ebuild_iuse: >+ continue >+ if ebuild_iuse in self.applied_useflags[x[2]]: >+ iuse=iuse+red("+"+ebuild_iuse)+" " >+ else: >+ iuse=iuse+blue("-"+ebuild_iuse)+" " > > xs=portage.pkgsplit(x[2]) > if xs[2]=="r0": >Index: pym/portage.py >=================================================================== >RCS file: /home/cvsroot/gentoo-src/portage/pym/portage.py,v >retrieving revision 1.346 >diff -u -r1.346 portage.py >--- pym/portage.py 10 Nov 2003 08:30:55 -0000 1.346 >+++ pym/portage.py 12 Nov 2003 11:29:05 -0000 >@@ -3,9 +3,21 @@ > # Distributed under the GNU Public License v2 > # $Header: /home/cvsroot/gentoo-src/portage/pym/portage.py,v 1.346 2003/11/10 08:30:55 carpaski Exp $ > >-VERSION="2.0.49-r15" >+VERSION="2.0.49-r17" > >-import sys >+import sys,string,os,re,types,shlex,shutil,xpak,fcntl,signal >+import time,cPickle,atexit,grp,traceback,commands,pwd,cvstree,copy >+ >+import getbinpkg >+from output import * >+ >+from stat import * >+from commands import * >+from select import * >+from time import sleep >+from random import shuffle >+ >+signal.signal(signal.SIGCHLD, signal.SIG_DFL) > > noiselimit = 0 > def writemsg(mystr,noiselevel=0): >@@ -100,20 +112,6 @@ > > return 1 > >- >-from stat import * >-from commands import * >-from select import * >-from output import * >-from time import sleep >-from random import shuffle >-import string,os >- >-import re,types,sys,shlex,shutil,xpak,fcntl,signal,time,cPickle,atexit,grp,traceback,commands,pwd,cvstree >-signal.signal(signal.SIGCHLD, signal.SIG_DFL) >- >-import getbinpkg >- > ostype=os.uname()[0] > if ostype=="Linux": > userland="GNU" >@@ -976,77 +974,152 @@ > return myusevars > > class config: >- def __init__(self): >- global incrementals >- self.usemask=[] >- self.configlist=[] >- self.backupenv={} >- # back up our incremental variables: >- global profiledir >- self.configdict={} >- # configlist will contain: [ globals, (optional) profile, make.conf, backupenv (incrementals), origenv ] >- >- #get the masked use flags >- if os.path.exists("/etc/make.profile/use.mask"): >- self.usemask=grabfile("/etc/make.profile/use.mask") >- if os.path.exists("/etc/portage/use.mask"): >- self.usemask=self.usemask+grabfile("/etc/portage/use.mask") >- >- self.mygcfg=getconfig("/etc/make.globals") >- if self.mygcfg==None: >- writemsg("!!! Parse error in /etc/make.globals. NEVER EDIT THIS FILE.\n") >- writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n") >- writemsg("!!! Errors in this file should be reported on bugs.gentoo.org.\n") >- sys.exit(1) >- self.configlist.append(self.mygcfg) >- self.configdict["globals"]=self.configlist[-1] >+ def __init__(self, clone=None, mycpv=None): >+ global incrementals,profiledir >+ self.locked = 1 >+ self.mycpv = None >+ self.puse = [] >+ self.modifiedkeys = [] > >- if profiledir: >- self.mygcfg=getconfig("/etc/make.profile/make.defaults") >+ if clone: >+ self.usemask = copy.deepcopy(clone.usemask) >+ self.configlist = copy.deepcopy(clone.configlist) >+ self.configlist[-1] = os.environ >+ self.configdict = { "globals": self.configlist[0], >+ "defaults": self.configlist[1], >+ "conf": self.configlist[2], >+ "pkg": self.configlist[3], >+ "auto": self.configlist[4], >+ "backupenv": self.configlist[5], >+ "env": self.configlist[6] } >+ self.backupenv = copy.deepcopy(clone.backupenv) >+ self.pusedict = copy.deepcopy(clone.pusedict) >+ self.lookuplist = copy.deepcopy(clone.lookuplist) >+ self.uvlist = copy.deepcopy(clone.uvlist) >+ self.locked = 0 >+ else: >+ self.usemask=[] >+ self.configlist=[] >+ self.backupenv={} >+ # back up our incremental variables: >+ self.configdict={} >+ # configlist will contain: [ globals, defaults, conf, pkg, auto, backupenv (incrementals), origenv ] >+ >+ self.pusedict=grabdict("/etc/portage/package.use") >+ >+ #get the masked use flags >+ if os.path.exists("/etc/make.profile/use.mask"): >+ self.usemask=grabfile("/etc/make.profile/use.mask") >+ if os.path.exists("/etc/portage/use.mask"): >+ self.usemask=self.usemask+grabfile("/etc/portage/use.mask") >+ >+ self.mygcfg=getconfig("/etc/make.globals") > if self.mygcfg==None: >- writemsg("!!! Parse error in /etc/make.defaults. Never modify this file.\n") >- writemsg("!!! 'emerge sync' may fix this. If it does not then please report\n") >- writemsg("!!! this to bugs.gentoo.org and, if possible, a dev on #gentoo (IRC)\n") >+ writemsg("!!! Parse error in /etc/make.globals. NEVER EDIT THIS FILE.\n") >+ writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n") >+ writemsg("!!! Errors in this file should be reported on bugs.gentoo.org.\n") > sys.exit(1) > self.configlist.append(self.mygcfg) >- self.configdict["defaults"]=self.configlist[-1] >+ self.configdict["globals"]=self.configlist[-1] > >- self.mygcfg=getconfig("/etc/make.conf") >- if self.mygcfg==None: >- writemsg("!!! Parse error in /etc/make.conf.\n") >- writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n") >- sys.exit(1) >- self.configlist.append(self.mygcfg) >- self.configdict["conf"]=self.configlist[-1] >+ if profiledir: >+ self.mygcfg=getconfig("/etc/make.profile/make.defaults") >+ if self.mygcfg==None: >+ writemsg("!!! Parse error in /etc/make.defaults. Never modify this file.\n") >+ writemsg("!!! 'emerge sync' may fix this. If it does not then please report\n") >+ writemsg("!!! this to bugs.gentoo.org and, if possible, a dev on #gentoo (IRC)\n") >+ sys.exit(1) >+ self.configlist.append(self.mygcfg) >+ self.configdict["defaults"]=self.configlist[-1] >+ >+ self.mygcfg=getconfig("/etc/make.conf") >+ if self.mygcfg==None: >+ writemsg("!!! Parse error in /etc/make.conf.\n") >+ writemsg("!!! Incorrect multiline literals can cause this. Do not use them.\n") >+ sys.exit(1) >+ self.configlist.append(self.mygcfg) >+ self.configdict["conf"]=self.configlist[-1] >+ >+ # Never set anything in this. It's for non-originals. >+ self.pusedict=grabdict("/etc/portage/package.use") >+ for x in self.pusedict.keys(): >+ self.pusedict[x] = string.join(self.pusedict[x]) >+ self.configlist.append({}) >+ self.configdict["pkg"]=self.configlist[-1] >+ >+ self.backupenv = os.environ.copy() >+ >+ #auto-use: >+ self.configlist.append({}) >+ self.configdict["auto"]=self.configlist[-1] >+ #backup-env (for recording our calculated incremental variables:) >+ self.configlist.append(self.backupenv) # XXX Why though? >+ self.configlist.append(os.environ) >+ self.configdict["env"]=self.configlist[-1] > >- for x in incrementals: >- if os.environ.has_key(x): >- self.backupenv[x]=os.environ[x] >- #auto-use: >- self.configlist.append({}) >- self.configdict["auto"]=self.configlist[-1] >- #backup-env (for recording our calculated incremental variables:) >- self.configlist.append(self.backupenv) >- self.configlist.append(os.environ) >- self.configdict["env"]=self.configlist[-1] > self.lookuplist=self.configlist[:] > self.lookuplist.reverse() > > useorder=self["USE_ORDER"] > if not useorder: > #reasonable defaults; this is important as without USE_ORDER, USE will always be "" (nothing set)! >- useorder="env:conf:auto:defaults" >- usevaluelist=useorder.split(":") >+ useorder="env:pkg:conf:auto:defaults" >+ useordersplit=useorder.split(":") >+ > self.uvlist=[] >- for x in usevaluelist: >+ for x in useordersplit: > if self.configdict.has_key(x): >+ if "PKGUSE" in self.configdict[x].keys(): >+ del self.configdict[x]["PKGUSE"] # Delete PkgUse, Not legal to set. > #prepend db to list to get correct order > self.uvlist[0:0]=[self.configdict[x]] > self.configdict["env"]["PORTAGE_GID"]=str(portage_gid) >+ > self.regenerate() >+ if mycpv: >+ self.original = 0 >+ self.setcpv(mycpv) >+ >+ def lock(self): >+ self.locked = 1 >+ >+ def unlock(self): >+ self.locked = 0 >+ >+ def modifying(self): >+ # We want this to prevent accidental modification... >+ # Due to the global use and os.environ() requirement of >+ # getstatusoutput we can't lock this down yet. >+ if 0 and self.locked: >+ raise Exception, "Configuration is locked." > >+ def reset(self): >+ "reset environment to original settings" >+ for x in self.configlist[-1].keys(): >+ if x not in self.backupenv.keys(): >+ del self.configlist[-1][x] >+ for x in self.backupenv.keys(): >+ self.configdict["env"][x] = self.backupenv[x] >+ else: >+ del self.configdict["env"][x] >+ self.regenerate() >+ >+ def setcpv(self,mycpv): >+ self.modifying() >+ self.mycpv = mycpv >+ self.pusekey = best_match_to_list(self.mycpv, self.pusedict.keys()) >+ if self.pusekey: >+ self.puse = self.pusedict[self.pusekey] >+ else: >+ self.puse = "" >+ self.configdict["pkg"]["PKGUSE"] = self.puse[:] # For saving to PUSE file >+ self.configdict["pkg"]["USE"] = self.puse[:] # this gets appended to USE >+ self.reset() >+ self.regenerate(useonly=1) >+ > def regenerate(self,useonly=0): > global incrementals,usesplit,profiledir >+ > if useonly: > myincrementals=["USE"] > else: >@@ -1057,42 +1130,45 @@ > self.configdict["auto"]["USE"]=autouse(db[root]["vartree"]) > else: > mydbs=self.configlist[:-1] >- mysetting=[] >+ >+ myflags=[] > for curdb in mydbs: > if not curdb.has_key(mykey): > continue > #variables are already expanded > mysplit=curdb[mykey].split() >- # XXX FIXME -- This needs to be rewritten sanely... use 'not in' XXX >+ > for x in mysplit: > if x=="-*": >- # "-*" is a special "minus" var that means "unset all settings". so USE="-* gnome" will have *just* gnome enabled. >- mysetting=[] >+ # "-*" is a special "minus" var that means "unset all settings". >+ # so USE="-* gnome" will have *just* gnome enabled. >+ print "-*" >+ myflags=[] > continue >+ > if x[0]=="+": >- add=x[1:] >- else: >- add=x >- if x[0]=="-": >- remove=x[1:] >- else: >- remove=x >- #remove any previous settings of this variable >- dellist=[] >- for y in range(0,len(mysetting)): >- if mysetting[y]==remove: >- #we found a previously-defined variable; add it to our dellist for later removal. >- dellist.append(mysetting[y]) >- for y in dellist: >- while y in mysetting: >- mysetting.remove(y) >- #now append our new setting >- if add: >- mysetting.append(add) >+ # Not legal. People assume too much. Complain. >+ writemsg(red("USE flags should not start with a '+': %s\n" % x)) >+ x=x[1:] >+ >+ if (x[0]=="-"): >+ if (x[1:] in myflags): >+ # Unset/Remove it. >+ del myflags[myflags.index(x[1:])] >+ continue >+ >+ # We got here, so add it now. >+ if x not in myflags: >+ myflags.append(x) >+ >+ myflags.sort() > #store setting in last element of configlist, the original environment: >- self.configlist[-1][mykey]=string.join(mysetting," ") >+ self.configlist[-1][mykey]=string.join(myflags," ") >+ del myflags >+ > #cache split-up USE var in a global > usesplit=[] >+ > for x in string.split(self.configlist[-1]["USE"]): > if x not in self.usemask: > usesplit.append(x) >@@ -1142,15 +1218,9 @@ > > def __setitem__(self,mykey,myvalue): > "set a value; will be thrown away at reset() time" >+ self.modifying() > self.configdict["env"][mykey]=myvalue > >- def reset(self): >- "reset environment to original settings" >- #for x in self.backupenv.keys(): >- # self.configdict["env"][x]==self.backupenv[x] >- #self.regenerate(useonly=1) >- pass >- > def environ(self): > "return our locally-maintained environment" > mydict={} >@@ -1673,49 +1743,65 @@ > > def doebuild(myebuild,mydo,myroot,debug=0,listonly=0,fetchonly=0): > global settings,db >+ >+ ebuild_path = os.path.abspath(myebuild) >+ pkg_dir = os.path.dirname(ebuild_path) >+ cat = os.path.basename(os.path.normpath(pkg_dir+"/..")) >+ mypv = os.path.basename(ebuild_path)[:-7] >+ mycpv = cat+"/"+mypv >+ >+ settings.reset() >+ settings.setcpv(mycpv) >+ > if mydo not in ["help","clean","prerm","postrm","preinst","postinst", > "config","touch","setup","depend","fetch","digest", > "unpack","compile","install","rpm","qmerge","merge", > "package","unmerge", "manifest"]: > writemsg("!!! doebuild: Please specify a valid command.\n"); > return 1 >+ > if not os.path.exists(myebuild): > writemsg("!!! doebuild: "+str(myebuild)+" not found for "+str(mydo)+"\n") > return 1 >+ > if myebuild[-7:]!=".ebuild": > writemsg("!!! doebuild: "+str(myebuild)+" does not appear to be an ebuild file.\n") > return 1 > >- settings.reset() > if debug: # Otherwise it overrides emerge's settings. > # We have no other way to set debug... debug can't be passed in > # due to how it's coded... Don't overwrite this so we can use it. > settings["PORTAGE_DEBUG"]=str(debug) >- #settings["ROOT"]=root >- settings["ROOT"]=myroot >- settings["STARTDIR"]=getcwd() >- settings["EBUILD"]=os.path.abspath(myebuild) >- settings["O"]=os.path.dirname(settings["EBUILD"]) >- category=settings["CATEGORY"]=os.path.basename(os.path.normpath(settings["O"]+"/..")) >- #PEBUILD >- settings["FILESDIR"]=settings["O"]+"/files" >- pf=settings["PF"]=os.path.basename(settings["EBUILD"])[:-7] >- mykey=category+"/"+pf >- settings["ECLASSDIR"]=settings["PORTDIR"]+"/eclass" >- settings["SANDBOX_LOG"]=settings["PF"] >+ >+ settings["ROOT"] = myroot >+ settings["STARTDIR"] = getcwd() >+ >+ settings["EBUILD"] = ebuild_path >+ settings["O"] = pkg_dir >+ settings["CATEGORY"] = cat >+ settings["FILESDIR"] = pkg_dir+"/files" >+ settings["PF"] = mypv >+ >+ settings["ECLASSDIR"] = settings["PORTDIR"]+"/eclass" >+ settings["SANDBOX_LOG"] = mycpv >+ > mysplit=pkgsplit(settings["PF"],0) > if mysplit==None: > print "!!! Error: PF is null; exiting." > return 1 >- settings["P"]=mysplit[0]+"-"+mysplit[1] >- settings["PN"]=mysplit[0] >- settings["PV"]=mysplit[1] >- settings["PR"]=mysplit[2] >- if mysplit[2]=="r0": >+ >+ settings["P"] = mysplit[0]+"-"+mysplit[1] >+ settings["PN"] = mysplit[0] >+ settings["PV"] = mysplit[1] >+ settings["PR"] = mysplit[2] >+ >+ if mysplit[2] == "r0": > settings["PVR"]=mysplit[1] > else: > settings["PVR"]=mysplit[1]+"-"+mysplit[2] >+ > settings["SLOT"]="" >+ > if settings.has_key("PATH"): > mysplit=string.split(settings["PATH"],":") > else: >@@ -1723,9 +1809,9 @@ > if not "/usr/lib/portage/bin" in mysplit: > settings["PATH"]="/usr/lib/portage/bin:"+settings["PATH"] > >- settings["BUILD_PREFIX"]=settings["PORTAGE_TMPDIR"]+"/portage" >- settings["PKG_TMPDIR"]=settings["PORTAGE_TMPDIR"]+"/portage-pkg" >- settings["BUILDDIR"]=settings["BUILD_PREFIX"]+"/"+settings["PF"] >+ settings["BUILD_PREFIX"] = settings["PORTAGE_TMPDIR"]+"/portage" >+ settings["PKG_TMPDIR"] = settings["PORTAGE_TMPDIR"]+"/portage-pkg" >+ settings["BUILDDIR"] = settings["BUILD_PREFIX"]+"/"+settings["PF"] > > #set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent. > if (mydo!="depend") or not settings.has_key("KV"): >@@ -1864,7 +1950,7 @@ > return spawn("/usr/sbin/ebuild.sh "+mydo,debug,free=1) > > try: >- settings["SLOT"], settings["RESTRICT"], myuris = db["/"]["porttree"].dbapi.aux_get(mykey,["SLOT","RESTRICT","SRC_URI"]) >+ settings["SLOT"], settings["RESTRICT"], myuris = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT","SRC_URI"]) > except (IOError,KeyError): > print red("doebuild():")+" aux_get() error; aborting." > sys.exit(1) >@@ -2932,6 +3018,142 @@ > p2=catpkgsplit(bestmatch)[1:] > return bestmatch > >+def match_to_list(mypkg,mylist): >+ """(pkgname,list) >+ Searches list for entries that matches the package. >+ """ >+ matches=[] >+ for x in mylist: >+ if match_from_list(x,[mypkg]): >+ if x not in matches: >+ matches.append(x) >+ return matches >+ >+def best_match_to_list(mypkg,mylist): >+ """(pkgname,list) >+ Returns the most specific entry (assumed to be the longest one) >+ that matches the package given. >+ """ >+ maxlen = 0 >+ bestm = None >+ for x in match_to_list(mypkg,mylist): >+ if len(x) > maxlen: >+ maxlen = len(x) >+ bestm = x >+ return bestm >+ >+def match_from_list(mydep,mylist): >+ """(dep,list) >+ Reduces the list down to those that fit the dep >+ """ >+ mycpv=dep_getcpv(mydep) >+ if isspecific(mycpv): >+ cp_key=catpkgsplit(mycpv) >+ if cp_key==None: >+ return [] >+ else: >+ cp_key=None >+ #Otherwise, this is a special call; we can only select out of the ebuilds specified in the specified mylist >+ if (mydep[0]=="="): >+ if cp_key==None: >+ return [] >+ if mydep[-1]=="*": >+ #example: "=sys-apps/foo-1.0*" >+ try: >+ #now, we grab the version of our dependency... >+ mynewsplit=string.split(cp_key[2],'.') >+ #split it... >+ mynewsplit[-1]=`int(mynewsplit[-1])+1` >+ #and increment the last digit of the version by one. >+ #We don't need to worry about _pre and friends because they're not supported with '*' deps. >+ new_v=string.join(mynewsplit,".")+"_alpha0" >+ #new_v will be used later in the code when we do our comparisons using pkgcmp() >+ except: >+ #erp, error. >+ return [] >+ mynodes=[] >+ cmp1=cp_key[1:] >+ cmp1[1]=cmp1[1]+"_alpha0" >+ cmp2=[cp_key[1],new_v,"r0"] >+ for x in mylist: >+ cp_x=catpkgsplit(x) >+ if cp_x==None: >+ #hrm, invalid entry. Continue. >+ continue >+ #skip entries in our list that do not have matching categories >+ if cp_key[0]!=cp_x[0]: >+ continue >+ # ok, categories match. Continue to next step. >+ if ((pkgcmp(cp_x[1:],cmp1)>=0) and (pkgcmp(cp_x[1:],cmp2)<0)): >+ # entry is >= the version in specified in our dependency, and <= the version in our dep + 1; add it: >+ mynodes.append(x) >+ return mynodes >+ else: >+ # Does our stripped key appear literally in our list? If so, we have a match; if not, we don't. >+ if mycpv in mylist: >+ return [mycpv] >+ else: >+ return [] >+ elif (mydep[0]==">") or (mydep[0]=="<"): >+ if cp_key==None: >+ return [] >+ if (len(mydep)>1) and (mydep[1]=="="): >+ cmpstr=mydep[0:2] >+ else: >+ cmpstr=mydep[0] >+ mynodes=[] >+ for x in mylist: >+ cp_x=catpkgsplit(x) >+ if cp_x==None: >+ #invalid entry; continue. >+ continue >+ if cp_key[0]!=cp_x[0]: >+ continue >+ if eval("pkgcmp(cp_x[1:],cp_key[1:])"+cmpstr+"0"): >+ mynodes.append(x) >+ return mynodes >+ elif mydep[0]=="~": >+ if cp_key==None: >+ return [] >+ myrev=-1 >+ for x in mylist: >+ cp_x=catpkgsplit(x) >+ if cp_x==None: >+ #invalid entry; continue >+ continue >+ if cp_key[0]!=cp_x[0]: >+ continue >+ if cp_key[2]!=cp_x[2]: >+ #if version doesn't match, skip it >+ continue >+ if string.atoi(cp_x[3][1:])>myrev: >+ myrev=string.atoi(cp_x[3][1:]) >+ mymatch=x >+ if myrev==-1: >+ return [] >+ else: >+ return [mymatch] >+ elif cp_key==None: >+ if mydep[0]=="!": >+ return [] >+ #we check ! deps in emerge itself, so always returning [] is correct. >+ mynodes=[] >+ cp_key=mycpv.split("/") >+ for x in mylist: >+ cp_x=catpkgsplit(x) >+ if cp_x==None: >+ #invalid entry; continue >+ continue >+ if cp_key[0]!=cp_x[0]: >+ continue >+ if cp_key[1]!=cp_x[1]: >+ continue >+ mynodes.append(x) >+ return mynodes >+ else: >+ return [] >+ >+ > class portagetree: > def __init__(self,root="/",virtual=None,clone=None): > global portdb >@@ -3006,116 +3228,11 @@ > mydep=dep_expand(origdep,self) > mykey=dep_getkey(mydep) > mycat=mykey.split("/")[0] >- return self.match2(mydep,mykey,self.cp_list(mykey)) >- >+ return match_from_list(mydep,self.cp_list(mykey)) >+ > def match2(self,mydep,mykey,mylist): >- "Notable difference to our match() function is that we don't return None. Ever. Just empty list." >- mycpv=dep_getcpv(mydep) >- if isspecific(mycpv): >- cp_key=catpkgsplit(mycpv) >- if cp_key==None: >- return [] >- else: >- cp_key=None >- #Otherwise, this is a special call; we can only select out of the ebuilds specified in the specified mylist >- if (mydep[0]=="="): >- if cp_key==None: >- return [] >- if mydep[-1]=="*": >- #example: "=sys-apps/foo-1.0*" >- try: >- #now, we grab the version of our dependency... >- mynewsplit=string.split(cp_key[2],'.') >- #split it... >- mynewsplit[-1]=`int(mynewsplit[-1])+1` >- #and increment the last digit of the version by one. >- #We don't need to worry about _pre and friends because they're not supported with '*' deps. >- new_v=string.join(mynewsplit,".")+"_alpha0" >- #new_v will be used later in the code when we do our comparisons using pkgcmp() >- except: >- #erp, error. >- return [] >- mynodes=[] >- cmp1=cp_key[1:] >- cmp1[1]=cmp1[1]+"_alpha0" >- cmp2=[cp_key[1],new_v,"r0"] >- for x in mylist: >- cp_x=catpkgsplit(x) >- if cp_x==None: >- #hrm, invalid entry. Continue. >- continue >- #skip entries in our list that do not have matching categories >- if cp_key[0]!=cp_x[0]: >- continue >- # ok, categories match. Continue to next step. >- if ((pkgcmp(cp_x[1:],cmp1)>=0) and (pkgcmp(cp_x[1:],cmp2)<0)): >- # entry is >= the version in specified in our dependency, and <= the version in our dep + 1; add it: >- mynodes.append(x) >- return mynodes >- else: >- # Does our stripped key appear literally in our list? If so, we have a match; if not, we don't. >- if mycpv in mylist: >- return [mycpv] >- else: >- return [] >- elif (mydep[0]==">") or (mydep[0]=="<"): >- if cp_key==None: >- return [] >- if (len(mydep)>1) and (mydep[1]=="="): >- cmpstr=mydep[0:2] >- else: >- cmpstr=mydep[0] >- mynodes=[] >- for x in mylist: >- cp_x=catpkgsplit(x) >- if cp_x==None: >- #invalid entry; continue. >- continue >- if cp_key[0]!=cp_x[0]: >- continue >- if eval("pkgcmp(cp_x[1:],cp_key[1:])"+cmpstr+"0"): >- mynodes.append(x) >- return mynodes >- elif mydep[0]=="~": >- if cp_key==None: >- return [] >- myrev=-1 >- for x in mylist: >- cp_x=catpkgsplit(x) >- if cp_x==None: >- #invalid entry; continue >- continue >- if cp_key[0]!=cp_x[0]: >- continue >- if cp_key[2]!=cp_x[2]: >- #if version doesn't match, skip it >- continue >- if string.atoi(cp_x[3][1:])>myrev: >- myrev=string.atoi(cp_x[3][1:]) >- mymatch=x >- if myrev==-1: >- return [] >- else: >- return [mymatch] >- elif cp_key==None: >- if mydep[0]=="!": >- return [] >- #we check ! deps in emerge itself, so always returning [] is correct. >- mynodes=[] >- cp_key=mycpv.split("/") >- for x in mylist: >- cp_x=catpkgsplit(x) >- if cp_x==None: >- #invalid entry; continue >- continue >- if cp_key[0]!=cp_x[0]: >- continue >- if cp_key[1]!=cp_x[1]: >- continue >- mynodes.append(x) >- return mynodes >- else: >- return [] >+ writemsg("DEPRECATED: dbapi.match2\n") >+ match_from_list(mydep,mylist) > > def counter_tick(self,myroot,mycpv=None): > return self.counter_tick_core(myroot,1,mycpv) >@@ -3439,7 +3556,7 @@ > if self.mtdircache[mycat]==curmtime: > return self.matchcache[mydep] > #generate new cache entry >- mymatch=self.match2(mydep,mykey,self.cp_list(mykey)) >+ mymatch=match_from_list(mydep,self.cp_list(mykey)) > self.mtdircache[mycat]=curmtime > self.matchcache[mydep]=mymatch > return mymatch >@@ -4133,18 +4250,18 @@ > #get all visible matches (from xmatch()), then choose the best one > elif level=="bestmatch-list": > #dep match -- find best match but restrict search to sublist >- myval=best(self.match2(mydep,mykey,mylist)) >+ myval=best(match_from_list(mydep,mylist)) > #no point is calling xmatch again since we're not caching list deps > elif level=="match-list": > #dep match -- find all matches but restrict search to sublist (used in 2nd half of visible()) >- myval=self.match2(mydep,mykey,mylist) >+ myval=match_from_list(mydep,mylist) > elif level=="match-visible": > #dep match -- find all visible matches >- myval=self.match2(mydep,mykey,self.xmatch("list-visible",None,mydep,mykey)) >+ myval=match_from_list(mydep,self.xmatch("list-visible",None,mydep,mykey)) > #get all visible packages, then get the matching ones > elif level=="match-all": > #match *all* visible *and* masked packages >- myval=self.match2(mydep,mykey,self.cp_list(mykey)) >+ myval=match_from_list(mydep,self.cp_list(mykey)) > else: > print "ERROR: xmatch doesn't handle",level,"query!" > raise KeyError >@@ -4409,7 +4526,7 @@ > self.populate() > mydep=dep_expand(mydep,self.dbapi) > mykey=dep_getkey(mydep) >- mymatch=best(self.dbapi.match2(mydep,mykey,self.dbapi.cp_list(mykey))) >+ mymatch=best(match_from_list(mydep,self.dbapi.cp_list(mykey))) > if mymatch==None: > return "" > return mymatch >@@ -5693,6 +5810,9 @@ > if not os.path.islink("/etc/make.profile"): > writemsg("!!! /etc/make.profile is not a symlink and will probably prevent most merges.") > writemsg("!!! It should point into a profile within %s/profiles/" % settings["PORTDIR"]) >+ >+settings.lock() # Prevent accidental modifications from the clean configs. >+ > > def pickle_write(data,filename,debug=0): > import cPickle
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13616
:
7155
|
7156
|
7264
|
7265
|
9218
|
9219
|
10588
|
10589
|
12254
|
12255
|
13752
|
13753
|
14390
|
14678
|
14679
|
14847
|
14873
|
15239
|
15240
|
15241
|
15291
|
15303
|
15304
|
15347
|
15348
|
15349
|
15614
|
15715
|
16609
|
16610
|
16611
|
16768
|
17925
|
17926
|
19128
| 20637 |
20652
|
21575
|
21577