--- bin/ebuild.sh.orig 2003-08-01 16:47:08.000000000 -0700 +++ bin/ebuild.sh 2003-08-01 16:43:32.000000000 -0700 @@ -83,6 +83,14 @@ use() { local x + for x in ${PUSE}; do + if [ "${x}" == "${1}" ]; then + tty --quiet < /dev/stdout || echo "${x}" + return 0 + elif [ "${x}" == "-${1}" ]; then + return 1 + fi + done for x in ${USE}; do if [ "${x}" == "${1}" ]; then tty --quiet < /dev/stdout || echo "${x}" @@ -706,6 +714,7 @@ echo "$CXXFLAGS" > CXXFLAGS echo "$DEPEND" > DEPEND echo "$IUSE" > IUSE + echo "$PUSE" > PUSE echo "$LICENSE" > LICENSE echo "$CATEGORY" > CATEGORY echo "$PDEPEND" > PDEPEND --- pym/portage.py 2003-08-07 13:29:11.000000000 -0700 +++ pym/portage.py 2003-08-07 13:16:01.000000000 -0700 @@ -897,6 +897,7 @@ sys.exit(1) self.configlist.append(self.mygcfg) self.configdict["conf"]=self.configlist[-1] + self.configdict["conf"]["PUSEDICT"]=grabdict("/etc/portage/package.use") for x in incrementals: if os.environ.has_key(x): @@ -925,7 +926,11 @@ self.regenerate() def regenerate(self,useonly=0): - global incrementals,usesplit,profiledir + global incrementals,usesplit,pkgusesplit,profiledir + + # initialize per-package use variables to an empty dictionary + pkgusesplit={} + if useonly: myincrementals=["USE"] else: @@ -968,6 +973,35 @@ #now append our new setting if add: mysetting.append(add) + #override per-package use flags + if mykey=="USE" and pkgusesplit!={}: + for y in pkgusesplit: + if add in pkgusesplit[y]: + pkgusesplit[y].remove(add) + if add[0]=="-" and add[1:] in pkgusesplit[y]: + pkgusesplit[y].remove(add[1:]) + if add[0]!="-" and "-"+add in pkgusesplit[y]: + pkgusesplit[y].remove("-"+add) + + # initialize per-package use flags + if mykey=="USE" and curdb.has_key("PUSEDICT"): + for x in curdb["PUSEDICT"]: + if x[0]=="#": + continue + mypkgusesplit=[] + for y in curdb["PUSEDICT"][x]: + if y=="-*" or y=="*": + continue + if y[0]=="-": + z=y[1:] + else: + z="-"+y + if y not in mysetting and y not in mypkgusesplit and z not in mypkgusesplit: + mypkgusesplit.append(y) + if mypkgusesplit: + pkgusesplit[x]=mypkgusesplit + del(curdb["PUSEDICT"]) + #store setting in last element of configlist, the original environment: self.configlist[-1][mykey]=string.join(mysetting," ") #cache split-up USE var in a global @@ -992,7 +1026,16 @@ if self.configdict["defaults"]["ARCH"] not in usesplit: usesplit.insert(0,self.configdict["defaults"]["ARCH"]) self.configlist[-1]["USE"]=string.join(usesplit," ") - + + # Store per-package setting in configlist for display in emerge --info + self.configlist[-1]["PKGUSE"]="" + mypkgusesplit=pkgusesplit.copy() + for x in mypkgusesplit: + if pkgusesplit[x]==[]: + del(pkgusesplit[x]) + else: + self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )" + def __getitem__(self,mykey): if mykey=="CONFIG_PROTECT_MASK": suffix=" /etc/env.d" @@ -1546,6 +1589,9 @@ settings["PVR"]=mysplit[1] else: settings["PVR"]=mysplit[1]+"-"+mysplit[2] + + settings["PUSE"]=string.join(dep_getpuse(category+"/"+pf)," ") + settings["SLOT"]="" if settings.has_key("PATH"): mysplit=string.split(settings["PATH"],":") @@ -2565,7 +2611,23 @@ mydep=mydep[1:] return prefix+cpv_expand(mydep,mydb)+postfix +def dep_getpuse(mypkg): + global usesplit,pkgusesplit + if not len(mypkg): + return [] + mylist=[] + for mykey in pkgusesplit: + if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", mykey, None, None, [mypkg]): + for x in pkgusesplit[mykey]: + if x[0]=="-": + y=x[1:] + else: + y="-"+x + if y not in mylist and x not in mylist: + mylist.append(x) + return mylist + def dep_check(depstring,mydbapi,use="yes",mode=None,myuse=None): """Takes a depend string and parses the condition.""" global usesplit if use=="all": @@ -3773,6 +3841,15 @@ if mylist==None: return [] newlist=[] + pkglist=grabfile("/etc/portage/package.keywords") + pkgdict = {} + for line in pkglist: + if len(line.split()) == 1: + mykeywordlist = [] + mykeywordlist = ["~"+keyword for keyword in groups if not keyword[0] in "~-"] + pkgdict[line] = mykeywordlist + else: + pkgdict[line.split()[0]] = line.split()[1:] for mycpv in mylist: #we need to update this next line when we have fully integrated the new db api auxerr=0 @@ -3785,15 +3854,19 @@ #print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status" continue mygroups=myaux[0].split() + pgroups=groups[:] match=0 + for mykey in pkgdict: + if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", mykey, None, None, [mycpv]): + pgroups.extend(pkgdict[mykey]) for gp in mygroups: if gp=="*": match=1 break - elif "-"+gp in groups: + elif "-"+gp in pgroups: match=0 break - elif gp in groups: + elif gp in pgroups: match=1 break if match: --- bin/emerge.orig 2003-08-01 16:47:22.000000000 -0700 +++ bin/emerge 2003-08-01 16:43:32.000000000 -0700 @@ -640,6 +640,13 @@ mytype,myroot,mykey=mybigkey if myuse == None: myuse=string.split(portage.settings["USE"], " ") + for x in portage.dep_getpuse(mykey): + if x[0]=="-" and x[1:] in myuse: + myuse.remove(x[1:]) + myuse.append(x) + elif "-"+x in myuse: + myuse.remove("-"+x) + myuse.append(x) # select the correct /var database that we'll be checking against vardbapi=portage.db[myroot]["vartree"].dbapi @@ -1059,13 +1059,16 @@ iuse="" if "--verbose" in myopts: + myiuse=portage.dep_getpuse(x[2]) 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)+" " + if ebuild_iuse in myiuse: + iuse=iuse+darkred("+"+ebuild_iuse)+" " + elif "-"+ebuild_iuse in myiuse: + iuse=iuse+darkblue("-"+ebuild_iuse)+" " + elif ebuild_iuse in portage.usesplit: + iuse=iuse+red("+"+ebuild_iuse)+" " + elif ebuild_iuse != "": + iuse=iuse+blue("-"+ebuild_iuse)+" " xs=portage.pkgsplit(x[2]) if xs[2]=="r0": @@ -1810,8 +1812,8 @@ else: myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK', 'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY', - 'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', - 'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES'] + 'USE', 'PKGUSE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS', + 'ACCEPT_KEYWORDS', 'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES'] myvars.sort() for x in myvars: print x+'="'+portage.settings[x]+'"'