--- /tmp/portage.py 2003-03-10 07:58:04.000000000 -0800 +++ portage.py 2003-03-10 09:04:00.000000000 -0800 @@ -47,8 +47,8 @@ print green(" portage::250:portage") print -incrementals=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"] -stickies=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"] +incrementals=["USE","PKGUSE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"] +stickies=["KEYWORDS_ACCEPT","PKGUSE","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"] def getcwd(): "this fixes situations where the current directory doesn't exist" @@ -839,7 +839,7 @@ self.regenerate() def regenerate(self,useonly=0): - global incrementals,usesplit,profiledir + global incrementals,usesplit,pkgusesplit,profiledir if useonly: myincrementals=["USE"] else: @@ -856,6 +856,8 @@ continue #variables are already expanded mysplit=curdb[mykey].split() + if mykey=="USE": + mysplit=self.parseuse(mysplit) for x in mysplit: if x=="-*": # "-*" is a special "minus" var that means "unset all settings". so USE="-* gnome" will have *just* gnome enabled. @@ -893,7 +895,57 @@ if self.configdict["defaults"]["ARCH"] not in usesplit: usesplit.insert(0,self.configdict["defaults"]["ARCH"]) self.configlist[-1]["USE"]=string.join(usesplit," ") + mypkgusesplit=pkgusesplit + pkgusesplit={} + for x in mypkgusesplit: + mypos=0 + while mypos "+string.join(pkgusesplit[x]," ")+" )" + def parseuse(self,myusesplit,mypos=0): + global pkgusesplit + try: + if pkgusesplit: pass + except: + pkgusesplit={} + while myposfirstpos+3: + myitems=myusesplit[firstpos+2:mypos] + pkg=myusesplit[firstpos+1] + pkgusesplit[pkg]=[] + for x in myitems: + if x=="-*" or x=="*": + myusesplit[firstpos:mypos+1]=[] + mypos=firstpos-1 + break + if x[0]=="-": + y=x[1:] + else: + y="-"+x + if x not in pkgusesplit[pkg] and y not in pkgusesplit[pkg]: + pkgusesplit[pkg].append(x) + myusesplit[firstpos:mypos+1]=[] + mypos=firstpos-1 + break + mypos=mypos+1 + mypos=mypos+1 + return myusesplit + def __getitem__(self,mykey): if mykey=="CONFIG_PROTECT_MASK": suffix=" /etc/env.d" @@ -2262,15 +2314,28 @@ mydep=mydep[1:] return prefix+cpv_expand(mydep,mydb)+postfix -def dep_check(depstring,mydbapi,use="yes",mode=None): +def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None): """Takes a depend string and parses the condition.""" - global usesplit + global usesplit,pkgusesplit if use=="all": #enable everything (for repoman) myusesplit=["*"] elif use=="yes": #default behavior myusesplit=usesplit + if parent and (pkgusesplit!={}): + myparent=string.split(parent)[2] + for x in pkgusesplit: + if string.count(myparent,x,0): + for y in pkgusesplit[x]: + if y[0]=="-": + z=y[1:] + else: + z="-"+y + if z in myusesplit: + myusesplit.remove(z) + if y not in myusesplit: + myusesplit.append(y) else: #we are being run by autouse(), don't consult USE vars yet. myusesplit=[]