Lines 55-62
Link Here
|
55 |
sys.stderr.write(red("*** Please add this user to the portage group if you wish to use portage.\n")) |
55 |
sys.stderr.write(red("*** Please add this user to the portage group if you wish to use portage.\n")) |
56 |
sys.stderr.write("\n") |
56 |
sys.stderr.write("\n") |
57 |
|
57 |
|
58 |
incrementals=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"] |
58 |
incrementals=["USE","PKGUSE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"] |
59 |
stickies=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"] |
59 |
stickies=["KEYWORDS_ACCEPT","USE","PKGUSE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"] |
60 |
|
60 |
|
61 |
def getcwd(): |
61 |
def getcwd(): |
62 |
"this fixes situations where the current directory doesn't exist" |
62 |
"this fixes situations where the current directory doesn't exist" |
Lines 887-893
Link Here
|
887 |
self.regenerate() |
887 |
self.regenerate() |
888 |
|
888 |
|
889 |
def regenerate(self,useonly=0): |
889 |
def regenerate(self,useonly=0): |
890 |
global incrementals,usesplit,profiledir |
890 |
global incrementals,usesplit,pkgusesplit,profiledir |
891 |
if useonly: |
891 |
if useonly: |
892 |
myincrementals=["USE"] |
892 |
myincrementals=["USE"] |
893 |
else: |
893 |
else: |
Lines 904-909
Link Here
|
904 |
continue |
904 |
continue |
905 |
#variables are already expanded |
905 |
#variables are already expanded |
906 |
mysplit=curdb[mykey].split() |
906 |
mysplit=curdb[mykey].split() |
|
|
907 |
if mykey=="USE": |
908 |
mysplit=self.parseuse(mysplit) |
907 |
for x in mysplit: |
909 |
for x in mysplit: |
908 |
if x=="-*": |
910 |
if x=="-*": |
909 |
# "-*" is a special "minus" var that means "unset all settings". so USE="-* gnome" will have *just* gnome enabled. |
911 |
# "-*" is a special "minus" var that means "unset all settings". so USE="-* gnome" will have *just* gnome enabled. |
Lines 920-925
Link Here
|
920 |
if mysetting[y]==remove: |
922 |
if mysetting[y]==remove: |
921 |
#we found a previously-defined variable; add it to our dellist for later removal. |
923 |
#we found a previously-defined variable; add it to our dellist for later removal. |
922 |
dellist.append(mysetting[y]) |
924 |
dellist.append(mysetting[y]) |
|
|
925 |
|
923 |
for y in dellist: |
926 |
for y in dellist: |
924 |
while y in mysetting: |
927 |
while y in mysetting: |
925 |
mysetting.remove(y) |
928 |
mysetting.remove(y) |
Lines 933-939
Link Here
|
933 |
for x in string.split(self.configlist[-1]["USE"]): |
936 |
for x in string.split(self.configlist[-1]["USE"]): |
934 |
if x not in self.usemask: |
937 |
if x not in self.usemask: |
935 |
usesplit.append(x) |
938 |
usesplit.append(x) |
936 |
|
939 |
|
|
|
940 |
mypkgusesplit=pkgusesplit |
941 |
pkgusesplit={} |
942 |
for x in mypkgusesplit: |
943 |
mypos=0 |
944 |
while mypos<len(mypkgusesplit[x]): |
945 |
if mypkgusesplit[x][mypos] in usesplit: |
946 |
del mypkgusesplit[x][mypos] |
947 |
else: |
948 |
mypos=mypos+1 |
949 |
if mypkgusesplit[x]!=[]: |
950 |
pkgusesplit[x]=mypkgusesplit[x] |
951 |
|
937 |
# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch. |
952 |
# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch. |
938 |
if profiledir: |
953 |
if profiledir: |
939 |
if self.configdict["defaults"].has_key("ARCH"): |
954 |
if self.configdict["defaults"].has_key("ARCH"): |
Lines 941-947
Link Here
|
941 |
if self.configdict["defaults"]["ARCH"] not in usesplit: |
956 |
if self.configdict["defaults"]["ARCH"] not in usesplit: |
942 |
usesplit.insert(0,self.configdict["defaults"]["ARCH"]) |
957 |
usesplit.insert(0,self.configdict["defaults"]["ARCH"]) |
943 |
self.configlist[-1]["USE"]=string.join(usesplit," ") |
958 |
self.configlist[-1]["USE"]=string.join(usesplit," ") |
|
|
959 |
|
960 |
self.configlist[-1]["PKGUSE"]="" |
961 |
for x in pkgusesplit: |
962 |
self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )" |
963 |
|
944 |
|
964 |
|
|
|
965 |
def parseuse(self,myusesplit,mypos=0): |
966 |
global pkgusesplit |
967 |
try: |
968 |
if pkgusesplit: pass |
969 |
except: |
970 |
pkgusesplit={} |
971 |
|
972 |
if mypos==0: |
973 |
while mypos<len(myusesplit): |
974 |
for x in "()": |
975 |
if len(myusesplit[mypos]) > 1: |
976 |
if x in myusesplit[mypos]: |
977 |
tmpstr=myusesplit[mypos].split(x) |
978 |
if myusesplit[mypos][0]==x: |
979 |
myusesplit[mypos:mypos+1]=[x,tmpstr[1]] |
980 |
elif myusesplit[mypos][len(myusesplit[mypos])-1]==x: |
981 |
myusesplit[mypos:mypos+1]=[tmpstr[0],x] |
982 |
else: |
983 |
myusesplit[mypos:mypos+1]=[tmpstr[0],x,tmpstr[1]] |
984 |
mypos=mypos+1 |
985 |
mypos=0 |
986 |
|
987 |
while mypos<len(myusesplit): |
988 |
if myusesplit[mypos]=="(": |
989 |
firstpos=mypos |
990 |
mypos=mypos+1 |
991 |
while mypos<len(myusesplit): |
992 |
if myusesplit[mypos]==")": |
993 |
if mypos==firstpos+3: |
994 |
myitems=[myusesplit[mypos-1]] |
995 |
elif mypos>firstpos+3: |
996 |
myitems=myusesplit[firstpos+2:mypos] |
997 |
else: |
998 |
print "parseuse(): USE flags error: not enough elements in ():",myusesplit[firstpos:mypos+1] |
999 |
myusesplit[firstpos:mypos+1]=[] |
1000 |
break |
1001 |
pkg=myusesplit[firstpos+1] |
1002 |
pkgusesplit[pkg]=[] |
1003 |
for x in myitems: |
1004 |
if x=="-*" or x=="*": |
1005 |
myusesplit[firstpos:mypos+1]=[] |
1006 |
mypos=firstpos-1 |
1007 |
break |
1008 |
if x[0]=="-": |
1009 |
y=x[1:] |
1010 |
else: |
1011 |
y="-"+x |
1012 |
if x not in pkgusesplit[pkg] and y not in pkgusesplit[pkg]: |
1013 |
pkgusesplit[pkg].append(x) |
1014 |
myusesplit[firstpos:mypos+1]=[] |
1015 |
mypos=firstpos-1 |
1016 |
break |
1017 |
mypos=mypos+1 |
1018 |
mypos=mypos+1 |
1019 |
return myusesplit |
1020 |
|
945 |
def __getitem__(self,mykey): |
1021 |
def __getitem__(self,mykey): |
946 |
if mykey=="CONFIG_PROTECT_MASK": |
1022 |
if mykey=="CONFIG_PROTECT_MASK": |
947 |
suffix=" /etc/env.d" |
1023 |
suffix=" /etc/env.d" |
Lines 2507-2521
Link Here
|
2507 |
mydep=mydep[1:] |
2583 |
mydep=mydep[1:] |
2508 |
return prefix+cpv_expand(mydep,mydb)+postfix |
2584 |
return prefix+cpv_expand(mydep,mydb)+postfix |
2509 |
|
2585 |
|
2510 |
def dep_check(depstring,mydbapi,use="yes",mode=None): |
2586 |
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None): |
2511 |
"""Takes a depend string and parses the condition.""" |
2587 |
"""Takes a depend string and parses the condition.""" |
2512 |
global usesplit |
2588 |
global usesplit,pkgusesplit |
2513 |
if use=="all": |
2589 |
if use=="all": |
2514 |
#enable everything (for repoman) |
2590 |
#enable everything (for repoman) |
2515 |
myusesplit=["*"] |
2591 |
myusesplit=["*"] |
2516 |
elif use=="yes": |
2592 |
elif use=="yes": |
2517 |
#default behavior |
2593 |
#default behavior |
2518 |
myusesplit=usesplit |
2594 |
myusesplit=usesplit[:] |
|
|
2595 |
if parent and (pkgusesplit!={}): |
2596 |
myparent=pkgsplit(parent.split()[2])[0] |
2597 |
if pkgusesplit.has_key(myparent): |
2598 |
for x in pkgusesplit[myparent]: |
2599 |
if x[0]=="-": |
2600 |
y=x[1:] |
2601 |
else: |
2602 |
y="-"+x |
2603 |
if y in myusesplit: |
2604 |
myusesplit.remove(y) |
2605 |
if x not in myusesplit: |
2606 |
myusesplit.append(x) |
2519 |
else: |
2607 |
else: |
2520 |
#we are being run by autouse(), don't consult USE vars yet. |
2608 |
#we are being run by autouse(), don't consult USE vars yet. |
2521 |
myusesplit=[] |
2609 |
myusesplit=[] |