From: Zac Medico Date: Mon, 27 Jun 2011 00:34:13 +0000 (-0700) Subject: config: disallow per-package/repo CONFIG_PROTECT X-Git-Tag: v2.2.0_alpha42~29 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=84f53ead91047d1389c80edeb7d9d1720e07e2a4;p=portage.git config: disallow per-package/repo CONFIG_PROTECT In order for reliable etc-update behavior, CONFIG_PROTECT needs to be a global constant (see bug 370693, comment #8). --- diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 0214c8675..3da724d13 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -165,6 +165,12 @@ environ_filter += [ environ_filter = frozenset(environ_filter) +# Variables that are not allowed to have per-repo or per-package +# settings. +global_only_vars = frozenset([ + "CONFIG_PROTECT", +]) + default_globals = { 'ACCEPT_LICENSE': '* -@EULA', 'ACCEPT_PROPERTIES': '*', diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index c8ea1c86e..c467efe81 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -130,6 +130,7 @@ class config(object): _environ_filter = special_env_vars.environ_filter _environ_whitelist = special_env_vars.environ_whitelist _environ_whitelist_re = special_env_vars.environ_whitelist_re + _global_only_vars = special_env_vars.global_only_vars def __init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, @@ -1142,6 +1143,8 @@ class config(object): # make a copy, since we might modify it with # package.use settings d = d.copy() + for k in self._global_only_vars: + d.pop(k, None) repo_env.append(d) cpdict = self._use_manager._repo_puse_dict.get(repo, {}).get(cp) if cpdict: @@ -1206,6 +1209,7 @@ class config(object): protected_pkg_keys = set(pkg_configdict) protected_pkg_keys.discard('USE') + protected_pkg_keys.update(self._global_only_vars) # If there are _any_ package.env settings for this package # then it automatically triggers config.reset(), in order