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
1 Hi,
2
3 I have a question on the config protect funcitonality in a prefixed
4 environment.
5
6 We typically set the CONFIG_PROTECT and CONFIG_PROTECT_MASK flags in the
7 profile make.defaults, etc/make.globals, etc/make.conf, or environment
8 variable.
9
10 If my prefix is '/opt/myprefix', I would expect to set my CONFIG_PROTECT
11 to something like:
12
13 CONFIG_PROTECT="/opt/myprefix/etc
14 /opt/myprefix/var/www/localhost/htdocs/mediawiki"
15
16 Basically, be explicit on the full path to be protected by portage.
17
18 But a closer look in the portage.py, it does some path manipulation
19 which, to me, seems to be a bug and out of place.
20
21 This line defined mergedir as a prefixed directory path
22 self.mergedir = os.path.normpath(myroot+os.path.sep+portage_const.EPREFIX)
23
24 Then in updateprotect(), we append the contents of CONFIG_PROTECT to the
25 prefixed mergedir.
26
27 def updateprotect(self):
28 #do some config file management prep
29 self.protect=[]
30 for x in string.split(self.settings["CONFIG_PROTECT"]):
31 ppath=normalize_path(self.mergedir+x)+"/"
32 if os.path.isdir(ppath):
33 self.protect.append(ppath)
34
35 self.protectmask=[]
36 for x in string.split(self.settings["CONFIG_PROTECT_MASK"]):
37 ppath=normalize_path(self.mergedir+x)+"/"
38 if os.path.isdir(ppath):
39 self.protectmask.append(ppath)
40 #if it doesn't exist, silently skip it
41
42 So, it ends up with my path looking like
43 '/opt/myprefix/opt/myprefix/etc', basically, double prefixed. I believe
44 the correct functionality would be to have the CONFIG_PROTECT
45 directories be explicit with prefix instead of implicitly prepending to
46 the list. The original portage only appends to 'myroot' and uses the
47 explicit paths in CONFIG_PROTECT.
48
49 Thought from others on what should be the behavior?
50 --
51 gentoo-osx@g.o mailing list