Fix config protect from being broken in prefix: a prefix got lost here
authorFabian Groffen <grobian@gentoo.org>
Thu, 15 Mar 2007 20:08:12 +0000 (20:08 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 15 Mar 2007 20:08:12 +0000 (20:08 -0000)
when trying to follow genone's code moving I guess.

svn path=/main/branches/prefix/; revision=6209

pym/portage/update.py
pym/portage/util.py

index 472eebe9699a5b813b70a29c92a148ba2fa0badc..804ee759827006a1aba47912f202c75dbb67a75e 100644 (file)
@@ -9,7 +9,7 @@ from portage.util import ConfigProtect, grabfile, new_protect_filename, \
 from portage.exception import DirectoryNotFound, PortageException
 from portage.versions import ververify
 from portage.dep import dep_getkey, get_operator, isvalidatom, isjustname
-from portage.const import USER_CONFIG_PATH, WORLD_FILE
+from portage.const import USER_CONFIG_PATH, WORLD_FILE, EPREFIX
 
 ignored_dbentries = ("CONTENTS", "environment.bz2")
 
@@ -144,8 +144,13 @@ def update_config_files(config_root, protect, protect_mask, update_iter):
        myxfiles = ["package.mask", "package.unmask", \
                "package.keywords", "package.use"]
        myxfiles += [os.path.join("profile", x) for x in myxfiles]
-       abs_user_config = os.path.join(config_root,
-               USER_CONFIG_PATH.lstrip(os.path.sep))
+       # if the user gives a path, respect it, otherwise use our prefix
+       if USER_CONFIG_PATH != "":
+               abs_user_config = os.path.join(config_root,
+                       USER_CONFIG_PATH.lstrip(os.path.sep))
+       else:
+               abs_user_config = os.path.join(config_root,
+                       EPREFIX.lstrip(os.path.sep))
        recursivefiles = []
        for x in myxfiles:
                config_file = os.path.join(abs_user_config, x)
index 964fa25addb53940c31f497c62393b16ecf9e54a..b54b991feb975147f0ed05619b0752a659a3b40d 100644 (file)
@@ -6,6 +6,7 @@ from portage.exception import PortageException, FileNotFound, \
        OperationNotPermitted, PermissionDenied, ReadOnlyFileSystem
 import portage.exception
 from portage.dep import isvalidatom
+from portage.const import EPREFIX
 
 import os, errno, shlex, stat, string, sys
 try:
@@ -932,7 +933,7 @@ class ConfigProtect(object):
                self._dirs = set()
                for x in self.protect_list:
                        ppath = normalize_path(
-                               os.path.join(self.myroot, x.lstrip(os.path.sep)))
+                               os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
                        mystat = None
                        try:
                                if stat.S_ISDIR(os.stat(ppath).st_mode):
@@ -945,7 +946,7 @@ class ConfigProtect(object):
                self.protectmask = []
                for x in self.mask_list:
                        ppath = normalize_path(
-                               os.path.join(self.myroot, x.lstrip(os.path.sep)))
+                               os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
                        mystat = None
                        try:
                                """Use lstat so that anything, even a broken symlink can be