public inbox for gentoo-osx@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-osx] [PREFIX] config protect behavior in prefix
@ 2006-05-16 19:59 Christopher Chan
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Chan @ 2006-05-16 19:59 UTC (permalink / raw
  To: gentoo-osx

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@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-osx] [PREFIX] config protect behavior in prefix
@ 2006-05-18 23:05 Christopher Chan
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Chan @ 2006-05-18 23:05 UTC (permalink / raw
  To: gentoo-osx

Also, I discovered that 'etc-update' does not pre-pend EPREFIX when 
resolving CONFIG_PROTECT directories.

In etc-update, in the scan() function, the following line should prepend 
if portage does the same.

        for path in ${CONFIG_PROTECT} ; do
                ## EPREFIX + path here
                [ ! -d ${path} ] && continue
                ofile=""
                for file in `find ${path}/ -iname "._cfg????_*" |
                           sed -e 
"s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\\2\%\3:" |
                           sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX 
cut -f1\ -d'%'`; do

-- 
gentoo-osx@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-18 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-16 19:59 [gentoo-osx] [PREFIX] config protect behavior in prefix Christopher Chan
  -- strict thread matches above, loose matches on Subject: below --
2006-05-18 23:05 Christopher Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox