summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-09-19 20:13:40 -0700
committerZac Medico <zmedico@gentoo.org>2012-09-19 20:13:40 -0700
commit81dc208f64523eaf6f67d064af436e25992e461f (patch)
tree9993cb17349b22fd170646d1fd94718024ce5e3e
parentMAKE_CONF_FILE: refer to /etc/portage/make.conf (diff)
downloadportage-81dc208f64523eaf6f67d064af436e25992e461f.tar.gz
portage-81dc208f64523eaf6f67d064af436e25992e461f.tar.bz2
portage-81dc208f64523eaf6f67d064af436e25992e461f.zip
config: source make.conf only once if samefile
Since migration from /etc/make.conf to /etc/portage/make.conf, people frequently ask if hardlinking or symlinking them is allowed. So, detect this case and avoid redundant sourcing when appropriate.
-rw-r--r--pym/portage/package/ebuild/config.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 2a0590486..684de16db 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -301,15 +301,21 @@ class config(object):
eprefix = locations_manager.eprefix
config_root = locations_manager.config_root
abs_user_config = locations_manager.abs_user_config
-
- make_conf = getconfig(
+ make_conf_paths = [
os.path.join(config_root, 'etc', 'make.conf'),
- tolerant=tolerant, allow_sourcing=True) or {}
+ os.path.join(config_root, MAKE_CONF_FILE)
+ ]
+ try:
+ if os.path.samefile(*make_conf_paths):
+ make_conf_paths.pop()
+ except OSError:
+ pass
- make_conf.update(getconfig(
- os.path.join(config_root, MAKE_CONF_FILE),
- tolerant=tolerant, allow_sourcing=True,
- expand=make_conf) or {})
+ make_conf = {}
+ for x in make_conf_paths:
+ make_conf.update(getconfig(x,
+ tolerant=tolerant, allow_sourcing=True,
+ expand=make_conf) or {})
# Allow ROOT setting to come from make.conf if it's not overridden
# by the constructor argument (from the calling environment).
@@ -481,15 +487,11 @@ class config(object):
self.configlist.append(mygcfg)
self.configdict["defaults"]=self.configlist[-1]
- mygcfg = getconfig(
- os.path.join(config_root, 'etc', 'make.conf'),
- tolerant=tolerant, allow_sourcing=True,
- expand=expand_map) or {}
-
- mygcfg.update(getconfig(
- os.path.join(config_root, MAKE_CONF_FILE),
- tolerant=tolerant, allow_sourcing=True,
- expand=expand_map) or {})
+ mygcfg = {}
+ for x in make_conf_paths:
+ mygcfg.update(getconfig(x,
+ tolerant=tolerant, allow_sourcing=True,
+ expand=expand_map) or {})
# Don't allow the user to override certain variables in make.conf
profile_only_variables = self.configdict["defaults"].get(