summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-26 17:34:13 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-26 17:34:13 -0700
commit84f53ead91047d1389c80edeb7d9d1720e07e2a4 (patch)
tree84c57165d2428d89dbd6ca410b8114599d8771a6
parentc3f0895fb89c7b0647428de37eb0f893939d93f7 (diff)
downloadportage-84f53ead91047d1389c80edeb7d9d1720e07e2a4.tar.gz
portage-84f53ead91047d1389c80edeb7d9d1720e07e2a4.tar.bz2
portage-84f53ead91047d1389c80edeb7d9d1720e07e2a4.zip
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).
-rw-r--r--pym/portage/package/ebuild/_config/special_env_vars.py6
-rw-r--r--pym/portage/package/ebuild/config.py4
2 files changed, 10 insertions, 0 deletions
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