Gentoo Archives: gentoo-osx

From: Christopher Chan <cchan@×××××××××××.com>
To: gentoo-osx@l.g.o
Subject: [gentoo-osx] [PREFIX] config protect behavior in prefix
Date: Tue, 16 May 2006 20:09:09
Message-Id: 446A2F39.80201@spikesource.com
Hi,

I have a question on the config protect funcitonality in a prefixed 
environment.  

We typically set the CONFIG_PROTECT and CONFIG_PROTECT_MASK flags in the 
profile make.defaults, etc/make.globals, etc/make.conf, or environment 
variable.

If my prefix is '/opt/myprefix', I would expect to set my CONFIG_PROTECT 
to something like:

CONFIG_PROTECT="/opt/myprefix/etc 
/opt/myprefix/var/www/localhost/htdocs/mediawiki"

Basically, be explicit on the full path to be protected by portage.

But a closer look in the portage.py, it does some path manipulation 
which, to me, seems to be a bug and out of place.

This line defined mergedir as a prefixed directory path
self.mergedir = os.path.normpath(myroot+os.path.sep+portage_const.EPREFIX)

Then in updateprotect(), we append the contents of CONFIG_PROTECT to the 
prefixed mergedir.

    def updateprotect(self):
        #do some config file management prep
        self.protect=[]
        for x in string.split(self.settings["CONFIG_PROTECT"]):
            ppath=normalize_path(self.mergedir+x)+"/"
            if os.path.isdir(ppath):
                self.protect.append(ppath)

        self.protectmask=[]
        for x in string.split(self.settings["CONFIG_PROTECT_MASK"]):
            ppath=normalize_path(self.mergedir+x)+"/"
            if os.path.isdir(ppath):
                self.protectmask.append(ppath)
            #if it doesn't exist, silently skip it

So, it ends up with my path looking like 
'/opt/myprefix/opt/myprefix/etc', basically, double prefixed.  I believe 
the correct functionality would be to have the CONFIG_PROTECT 
directories be explicit with prefix instead of implicitly prepending to 
the list.   The original portage only appends to 'myroot' and uses the 
explicit paths in CONFIG_PROTECT.

Thought from others on what should be the behavior?
-- 
gentoo-osx@g.o mailing list