summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-11-25 00:23:15 -0800
committerZac Medico <zmedico@gentoo.org>2010-11-25 00:23:15 -0800
commit154aa71455be8564134d14167f839eb9fdc8160f (patch)
treeafd99ce959d40313b86ec36a4e0d7c29a6710342
parentc865e74f1eeb5d1e0bfcf4e95a6dbccb058ddf47 (diff)
downloadportage-154aa71455be8564134d14167f839eb9fdc8160f.tar.gz
portage-154aa71455be8564134d14167f839eb9fdc8160f.tar.bz2
portage-154aa71455be8564134d14167f839eb9fdc8160f.zip
fetch: pass full env to fetcher (for proxy vars)
This should fix bug #315421.
-rw-r--r--pym/portage/package/ebuild/config.py2
-rw-r--r--pym/portage/package/ebuild/fetch.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 9d53888ce..043a310b8 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -2008,7 +2008,7 @@ class config(object):
eapi = self.get('EAPI')
phase = self.get('EBUILD_PHASE')
filter_calling_env = False
- if phase not in ('clean', 'cleanrm', 'depend'):
+ if phase not in ('clean', 'cleanrm', 'depend', 'fetch'):
temp_dir = self.get('T')
if temp_dir is not None and \
os.path.exists(os.path.join(temp_dir, 'environment')):
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
index 2c7f00703..f97707fd6 100644
--- a/pym/portage/package/ebuild/fetch.py
+++ b/pym/portage/package/ebuild/fetch.py
@@ -81,7 +81,18 @@ def _spawn_fetch(settings, args, **kwargs):
if args[0] != BASH_BINARY:
args = [BASH_BINARY, "-c", "exec \"$@\"", args[0]] + args
- rval = spawn_func(args, env=settings.environ(), **kwargs)
+ # Ensure that EBUILD_PHASE is set to fetch, so that config.environ()
+ # does not filter the calling environment (which may contain needed
+ # proxy variables, as in bug #315421).
+ phase_backup = settings.get('EBUILD_PHASE')
+ settings['EBUILD_PHASE'] = 'fetch'
+ try:
+ rval = spawn_func(args, env=settings.environ(), **kwargs)
+ finally:
+ if phase_backup is None:
+ settings.pop('EBUILD_PHASE', None)
+ else:
+ settings['EBUILD_PHASE'] = phase_backup
return rval