From 95a03cd27c98cafd33ea60650d5ce500dbea80d9 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 15 Mar 2007 20:08:12 +0000 Subject: [PATCH] Fix config protect from being broken in prefix: a prefix got lost here when trying to follow genone's code moving I guess. svn path=/main/branches/prefix/; revision=6209 --- pym/portage/update.py | 11 ++++++++--- pym/portage/util.py | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pym/portage/update.py b/pym/portage/update.py index 472eebe96..804ee7598 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -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) diff --git a/pym/portage/util.py b/pym/portage/util.py index 964fa25ad..b54b991fe 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -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 -- 2.26.2