Lines 208-214
Link Here
|
208 |
writemsg(red("*** Please add this user to the portage group if you wish to use portage.\n")) |
208 |
writemsg(red("*** Please add this user to the portage group if you wish to use portage.\n")) |
209 |
writemsg("\n") |
209 |
writemsg("\n") |
210 |
|
210 |
|
211 |
incrementals=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"] |
211 |
incrementals=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","CONFIG_PROTECT_FILES_MASK","CONFIG_PROTECT_FILES","PRELINK_PATH","PRELINK_PATH_MASK"] |
212 |
stickies=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"] |
212 |
stickies=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"] |
213 |
|
213 |
|
214 |
def getcwd(): |
214 |
def getcwd(): |
Lines 611-618
Link Here
|
611 |
specials={ |
611 |
specials={ |
612 |
"KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[], |
612 |
"KDEDIRS":[],"PATH":[],"CLASSPATH":[],"LDPATH":[],"MANPATH":[], |
613 |
"INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[], |
613 |
"INFODIR":[],"INFOPATH":[],"ROOTPATH":[],"CONFIG_PROTECT":[], |
614 |
"CONFIG_PROTECT_MASK":[],"PRELINK_PATH":[],"PRELINK_PATH_MASK":[], |
614 |
"CONFIG_PROTECT_MASK":[],"CONFIG_PROTECT_FILES":[], |
615 |
"PYTHONPATH":[], "ADA_INCLUDE_PATH":[], "ADA_OBJECTS_PATH":[] |
615 |
"CONFIG_PROTECT_FILES_MASK":[],"PRELINK_PATH":[], |
|
|
616 |
"PRELINK_PATH_MASK":[],"PYTHONPATH":[],"ADA_INCLUDE_PATH":[], |
617 |
"ADA_OBJECTS_PATH":[] |
616 |
} |
618 |
} |
617 |
colon_seperated = [ |
619 |
colon_seperated = [ |
618 |
"ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH", |
620 |
"ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH", |
Lines 740-746
Link Here
|
740 |
if len(specials[path])==0: |
742 |
if len(specials[path])==0: |
741 |
continue |
743 |
continue |
742 |
outstring="export "+path+"='" |
744 |
outstring="export "+path+"='" |
743 |
if path in ["CONFIG_PROTECT","CONFIG_PROTECT_MASK"]: |
745 |
if path in ["CONFIG_PROTECT","CONFIG_PROTECT_MASK","CONFIG_PROTECT_FILES","CONFIG_PROTECT_FILES_MASK"]: |
744 |
for x in specials[path][:-1]: |
746 |
for x in specials[path][:-1]: |
745 |
outstring += x+" " |
747 |
outstring += x+" " |
746 |
else: |
748 |
else: |
Lines 5190-5222
Link Here
|
5190 |
|
5192 |
|
5191 |
def updateprotect(self): |
5193 |
def updateprotect(self): |
5192 |
#do some config file management prep |
5194 |
#do some config file management prep |
5193 |
self.protect=[] |
5195 |
self.protect={} |
5194 |
for x in string.split(self.settings["CONFIG_PROTECT"]): |
5196 |
for x in string.split(self.settings["CONFIG_PROTECT"]): |
5195 |
ppath=os.path.normpath(self.myroot+"///"+x)+"/" |
5197 |
x=os.path.normpath(self.myroot+"///"+x) |
5196 |
if os.path.isdir(ppath): |
5198 |
if os.path.isdir(x): |
5197 |
self.protect.append(ppath) |
5199 |
if os.path.basename(x)=="": |
5198 |
|
5200 |
self.protect[os.path.dirname(x)]=1 |
5199 |
self.protectmask=[] |
5201 |
else: |
|
|
5202 |
self.protect[x]=1 |
5203 |
|
5204 |
self.protectmask={} |
5200 |
for x in string.split(self.settings["CONFIG_PROTECT_MASK"]): |
5205 |
for x in string.split(self.settings["CONFIG_PROTECT_MASK"]): |
5201 |
ppath=os.path.normpath(self.myroot+"///"+x)+"/" |
5206 |
x=os.path.normpath(self.myroot+"///"+x) |
5202 |
if os.path.isdir(ppath): |
5207 |
if os.path.isdir(x): |
5203 |
self.protectmask.append(ppath) |
5208 |
if os.path.basename(x)=="": |
5204 |
#if it doesn't exist, silently skip it |
5209 |
self.protectmask[os.path.dirname(x)]=1 |
|
|
5210 |
else: |
5211 |
self.protectmask[x]=1 |
5212 |
|
5213 |
self.protectfiles={} |
5214 |
for x in string.split(self.settings["CONFIG_PROTECT_FILES"]): |
5215 |
x=os.path.normpath(self.myroot+"///"+x) |
5216 |
if os.path.isfile(x): |
5217 |
self.protectfiles[x]=1 |
5218 |
|
5219 |
self.protectfilesmask={} |
5220 |
for x in string.split(self.settings["CONFIG_PROTECT_FILES_MASK"]): |
5221 |
x=os.path.normpath(self.myroot+"///"+x) |
5222 |
if os.path.isfile(x): |
5223 |
self.protectfilesmask[x]=1 |
5205 |
|
5224 |
|
5206 |
def isprotected(self,obj): |
5225 |
def isprotected(self,obj): |
5207 |
"""Checks if obj is in the current protect/mask directories. Returns |
5226 |
"""Checks if obj is in the current protect/mask directories or is a file protected. |
5208 |
0 on unprotected/masked, and 1 on protected.""" |
5227 |
Returns 0 on unprotected/masked, and 1 on protected.""" |
5209 |
masked=0 |
|
|
5210 |
protected=0 |
5228 |
protected=0 |
5211 |
for ppath in self.protect: |
5229 |
npath=os.path.normpath(obj) |
5212 |
if (len(ppath) > masked) and (obj[0:len(ppath)]==ppath): |
5230 |
myobj="" |
5213 |
protected=len(ppath) |
5231 |
|
5214 |
#config file management |
5232 |
#if obj is a file, we need to check the files protect/mask |
5215 |
for pmpath in self.protectmask: |
5233 |
if os.path.isfile(npath): |
5216 |
if (len(pmpath) >= protected) and (obj[0:len(pmpath)]==pmpath): |
5234 |
if self.protectfilesmask.has_key(npath): |
5217 |
#skip, it's in the mask |
5235 |
return 0 |
5218 |
masked=len(pmpath) |
5236 |
if self.protectfiles.has_key(npath): |
5219 |
return (protected > masked) |
5237 |
return 1 |
|
|
5238 |
|
5239 |
#now we check/traverse the directory protects/masks |
5240 |
for x in string.split(npath, "/"): |
5241 |
myobj=myobj+x |
5242 |
if self.protect.has_key(myobj): |
5243 |
protected=1 |
5244 |
if self.protectmask.has_key(myobj): |
5245 |
protected=0 |
5246 |
myobj=myobj+"/" |
5247 |
|
5248 |
return protected |
5220 |
|
5249 |
|
5221 |
def unmerge(self,pkgfiles=None,trimworld=1,cleanup=0): |
5250 |
def unmerge(self,pkgfiles=None,trimworld=1,cleanup=0): |
5222 |
global dircache |
5251 |
global dircache |
Lines 5700-5710
Link Here
|
5700 |
#A directory is specified. Figure out protection paths, listdir() it and process it. |
5729 |
#A directory is specified. Figure out protection paths, listdir() it and process it. |
5701 |
mergelist=listdir(srcroot+stufftomerge) |
5730 |
mergelist=listdir(srcroot+stufftomerge) |
5702 |
offset=stufftomerge |
5731 |
offset=stufftomerge |
5703 |
# We need mydest defined up here to calc. protection paths. This is now done once per |
|
|
5704 |
# directory rather than once per file merge. This should really help merge performance. |
5705 |
# Trailing / ensures that protects/masks with trailing /'s match. |
5706 |
mytruncpath="/"+offset+"/" |
5707 |
myppath=self.isprotected(mytruncpath) |
5708 |
else: |
5732 |
else: |
5709 |
mergelist=stufftomerge |
5733 |
mergelist=stufftomerge |
5710 |
offset="" |
5734 |
offset="" |
Lines 5843-5849
Link Here
|
5843 |
# install of destination is blocked by an existing regular file; |
5867 |
# install of destination is blocked by an existing regular file; |
5844 |
# now, config file management may come into play. |
5868 |
# now, config file management may come into play. |
5845 |
# we only need to tweak mydest if cfg file management is in play. |
5869 |
# we only need to tweak mydest if cfg file management is in play. |
5846 |
if myppath: |
5870 |
if self.isprotected(myrealdest): |
5847 |
# we have a protection path; enable config file management. |
5871 |
# we have a protection path; enable config file management. |
5848 |
destmd5=perform_md5(mydest) |
5872 |
destmd5=perform_md5(mydest) |
5849 |
cycled=0 |
5873 |
cycled=0 |