Add LocationsManager.profile_and_user_locations for use with config.categories and...
authorSebastian Luther <SebastianLuther@gmx.de>
Sun, 29 Aug 2010 18:48:06 +0000 (11:48 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 29 Aug 2010 18:48:06 +0000 (11:48 -0700)
pym/portage/package/ebuild/_config/LocationsManager.py
pym/portage/package/ebuild/config.py

index 2ac2e7492c8a0154a410caaa08e2474f915cec03..88f500bd39fd0c0629a6c4707135a9c44724eebf 100644 (file)
@@ -24,6 +24,7 @@ class LocationsManager(object):
                self.eprefix = eprefix
                self.config_root = config_root
                self.target_root = target_root
+               self._user_config = local_config
                
                if self.eprefix is None:
                        self.eprefix = ""
@@ -64,7 +65,7 @@ class LocationsManager(object):
                                writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1)
                                self.profiles = []
 
-               if local_config and self.profiles:
+               if self._user_config and self.profiles:
                        custom_prof = os.path.join(
                                self.config_root, CUSTOM_PROFILE_PATH)
                        if os.path.exists(custom_prof):
@@ -169,7 +170,12 @@ class LocationsManager(object):
                                self.overlay_profiles.append(profiles_dir)
 
                self.profile_locations = [os.path.join(portdir, "profiles")] + self.overlay_profiles
+               self.profile_and_user_locations = self.profile_locations[:]
+               if self._user_config:
+                       self.profile_and_user_locations.append(self.abs_user_config)
+
                self.profile_locations = tuple(self.profile_locations)
+               self.profile_and_user_locations = tuple(self.profile_and_user_locations)
 
                self.pmask_locations = [os.path.join(portdir, "profiles")]
                self.pmask_locations.extend(self.profiles)
index c91de9356a03d434ca7f4a00f2e57172a61ddced..e41760b50073faa08c3e6fa4bf96e69ddcd5a089 100644 (file)
@@ -284,7 +284,7 @@ class config(object):
                        self.profile_path = locations_manager.profile_path
                        self.user_profile_dir = locations_manager.user_profile_dir
                        abs_user_config = locations_manager.abs_user_config
-                       
+
                        make_conf = getconfig(
                                os.path.join(config_root, MAKE_CONF_FILE),
                                tolerant=tolerant, allow_sourcing=True) or {}
@@ -563,11 +563,7 @@ class config(object):
 
                        self._virtuals_manager = VirtualsManager(self.profiles)
 
-                       locations = list(locations_manager.profile_locations)
-
                        if local_config:
-                               locations.append(abs_user_config)
-
                                # package.accept_keywords and package.keywords
                                pkgdict = grabdict_package(
                                        os.path.join(abs_user_config, "package.keywords"),
@@ -659,13 +655,15 @@ class config(object):
                                                        _local_repo_config(repo_name, repo_opts)
 
                        #getting categories from an external file now
-                       self.categories = [grabfile(os.path.join(x, "categories")) for x in locations]
+                       self.categories = [grabfile(os.path.join(x, "categories")) \
+                               for x in locations_manager.profile_and_user_locations]
                        category_re = dbapi._category_re
                        self.categories = tuple(sorted(
                                x for x in stack_lists(self.categories, incremental=1)
                                if category_re.match(x) is not None))
 
-                       archlist = [grabfile(os.path.join(x, "arch.list")) for x in locations]
+                       archlist = [grabfile(os.path.join(x, "arch.list")) \
+                               for x in locations_manager.profile_and_user_locations]
                        archlist = stack_lists(archlist, incremental=1)
                        self.configdict["conf"]["PORTAGE_ARCHLIST"] = " ".join(archlist)