diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-20 18:08:59 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-20 18:08:59 -0700 |
commit | 1fdeb78d08bac14f3f999f112499d179a87cf342 (patch) | |
tree | 07d939f93be6c796a4b6b997ee71437e561539cc /pym/portage | |
parent | aa838c657803ac29628a1aa706bda3fc89c94dab (diff) | |
download | portage-1fdeb78d08bac14f3f999f112499d179a87cf342.tar.gz portage-1fdeb78d08bac14f3f999f112499d179a87cf342.tar.bz2 portage-1fdeb78d08bac14f3f999f112499d179a87cf342.zip |
config: repo-level make.defaults/package.use
This completes the implementation of bug #370693.
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/package/ebuild/_config/UseManager.py | 1 | ||||
-rw-r--r-- | pym/portage/package/ebuild/config.py | 45 |
2 files changed, 45 insertions, 1 deletions
diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py index 3905f4fa1..de18500a9 100644 --- a/pym/portage/package/ebuild/_config/UseManager.py +++ b/pym/portage/package/ebuild/_config/UseManager.py @@ -53,6 +53,7 @@ class UseManager(object): self._repo_useforce_dict = self._parse_repository_files_to_dict_of_tuples("use.force", repositories) self._repo_pusemask_dict = self._parse_repository_files_to_dict_of_dicts("package.use.mask", repositories) self._repo_puseforce_dict = self._parse_repository_files_to_dict_of_dicts("package.use.force", repositories) + self._repo_puse_dict = self._parse_repository_files_to_dict_of_dicts("package.use", repositories) self._usemask_list = self._parse_profile_files_to_tuple_of_tuples("use.mask", profiles) self._useforce_list = self._parse_profile_files_to_tuple_of_tuples("use.force", profiles) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index b75a17716..6b7af51e9 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -206,6 +206,7 @@ class config(object): self.repositories = clone.repositories self._iuse_implicit_match = clone._iuse_implicit_match self._non_user_variables = clone._non_user_variables + self._repo_make_defaults = clone._repo_make_defaults self.usemask = clone.usemask self.useforce = clone.useforce self.puse = clone.puse @@ -229,6 +230,7 @@ class config(object): self.configdict = copy.deepcopy(clone.configdict) self.configlist = [ self.configdict['env.d'], + self.configdict['repo'], self.configdict['pkginternal'], self.configdict['globals'], self.configdict['defaults'], @@ -319,6 +321,9 @@ class config(object): self.configdict["env.d"] = self.configlist[-1] self.configlist.append({}) + self.configdict["repo"] = self.configlist[-1] + + self.configlist.append({}) self.configdict["pkginternal"] = self.configlist[-1] self.packages_list = [grabfile_package(os.path.join(x, "packages"), verify_eapi=True) for x in self.profiles] @@ -509,6 +514,14 @@ class config(object): locations_manager.set_port_dirs(self["PORTDIR"], self["PORTDIR_OVERLAY"]) + self._repo_make_defaults = {} + for repo in self.repositories.repos_with_profiles(): + d = getconfig(os.path.join(repo.location, "profiles", "make.defaults"), + expand=self.configdict["globals"].copy()) or {} + for blacklisted in self._env_blacklist: + d.pop(blacklisted, None) + self._repo_make_defaults[repo.name] = d + #Read package.keywords and package.accept_keywords. self._keywords_manager = KeywordsManager(self.profiles, abs_user_config, \ local_config, global_accept_keywords=self.configdict["defaults"].get("ACCEPT_KEYWORDS", "")) @@ -629,7 +642,7 @@ class config(object): # reasonable defaults; this is important as without USE_ORDER, # USE will always be "" (nothing set)! if "USE_ORDER" not in self: - self.backupenv["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal:env.d" + self.backupenv["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal:repo:env.d" self["PORTAGE_GID"] = str(portage_gid) self.backup_changes("PORTAGE_GID") @@ -890,6 +903,7 @@ class config(object): del self._penv[:] self.configdict["pkg"].clear() self.configdict["pkginternal"].clear() + self.configdict["repo"].clear() self.configdict["defaults"]["USE"] = \ " ".join(self.make_defaults_use) self.usemask = self._use_manager.getUseMask() @@ -1065,6 +1079,7 @@ class config(object): pkg_configdict["CATEGORY"] = cat pkg_configdict["PF"] = pf + repository = None if mydb: if not hasattr(mydb, "aux_get"): for k in aux_keys: @@ -1109,6 +1124,34 @@ class config(object): self.configdict["pkginternal"]["USE"] = pkginternaluse has_changed = True + repo_env = [] + repo_env_empty = True + if repository and repository != Package.UNKNOWN_REPO: + for repo in [repo.name for + repo in self.repositories[repository].masters] + [repository]: + d = self._repo_make_defaults.get(repo) + if d is None: + d = {} + else: + # make a copy, since we might modify it with + # package.use settings + d = d.copy() + repo_env.append(d) + cpdict = self._use_manager._repo_puse_dict.get(repo, {}).get(cp) + if cpdict: + repo_puse = ordered_by_atom_specificity(cpdict, pkg) + if repo_puse: + for x in repo_puse: + d["USE"] = d.get("USE", "") + " " + " ".join(x) + if d: + repo_env_empty = False + + if not repo_env_empty or self.configdict["repo"]: + self.configdict["repo"].clear() + self.configdict["repo"].update(stack_dicts(repo_env, + incrementals=self.incrementals)) + has_changed = True + defaults = [] for i, pkgprofileuse_dict in enumerate(self._use_manager._pkgprofileuse): if self.make_defaults_use[i]: |