summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2008-12-06 12:27:37 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2008-12-06 12:27:37 +0000
commit038cb1325af263b0ec165e69a9faa374f49074fc (patch)
treea73ef983604b15c04ae711cff77d36ed7de2b809
parente3e9aec503052ae5d71ab1fda519748ff1e08499 (diff)
downloadbitbake-038cb1325af263b0ec165e69a9faa374f49074fc.tar.gz
utils.py: Add clean_environment() function and call where appropriate (from Poky)
-rwxr-xr-xbin/bitbake12
-rw-r--r--lib/bb/fetch/wget.py25
-rw-r--r--lib/bb/utils.py15
3 files changed, 43 insertions, 9 deletions
diff --git a/bin/bitbake b/bin/bitbake
index 0087be3b7..6a69e340f 100755
--- a/bin/bitbake
+++ b/bin/bitbake
@@ -116,15 +116,9 @@ Default BBFILES are the .bb files in the current directory.""" )
cooker = bb.cooker.BBCooker(configuration)
- # Optionally clean up the environment
- if 'BB_PRESERVE_ENV' not in os.environ:
- if 'BB_ENV_WHITELIST' in os.environ:
- good_vars = os.environ['BB_ENV_WHITELIST'].split()
- else:
- good_vars = bb.utils.preserved_envvars_list()
- if 'BB_ENV_EXTRAWHITE' in os.environ:
- good_vars.extend(os.environ['BB_ENV_EXTRAWHITE'].split())
- bb.utils.filter_environment(good_vars)
+ # Clear away any spurious environment variables. But don't wipe the
+ # environment totally.
+ bb.utils.clean_environment()
cooker.parseConfiguration()
diff --git a/lib/bb/fetch/wget.py b/lib/bb/fetch/wget.py
index 739d5a1bc..0008a2870 100644
--- a/lib/bb/fetch/wget.py
+++ b/lib/bb/fetch/wget.py
@@ -60,9 +60,34 @@ class Wget(Fetch):
else:
fetchcmd = data.getVar("FETCHCOMMAND", d, 1)
+ uri = uri.split(";")[0]
+ uri_decoded = list(bb.decodeurl(uri))
+ uri_type = uri_decoded[0]
+ uri_host = uri_decoded[1]
+
bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri)
fetchcmd = fetchcmd.replace("${URI}", uri)
fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
+ httpproxy = None
+ ftpproxy = None
+ if uri_type == 'http':
+ httpproxy = data.getVar("HTTP_PROXY", d, True)
+ httpproxy_ignore = (data.getVar("HTTP_PROXY_IGNORE", d, True) or "").split()
+ for p in httpproxy_ignore:
+ if uri_host.endswith(p):
+ httpproxy = None
+ break
+ if uri_type == 'ftp':
+ ftpproxy = data.getVar("FTP_PROXY", d, True)
+ ftpproxy_ignore = (data.getVar("HTTP_PROXY_IGNORE", d, True) or "").split()
+ for p in ftpproxy_ignore:
+ if uri_host.endswith(p):
+ ftpproxy = None
+ break
+ if httpproxy:
+ fetchcmd = "http_proxy=" + httpproxy + " " + fetchcmd
+ if ftpproxy:
+ fetchcmd = "ftp_proxy=" + ftpproxy + " " + fetchcmd
bb.msg.debug(2, bb.msg.domain.Fetcher, "executing " + fetchcmd)
ret = os.system(fetchcmd)
if ret != 0:
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index ba3089d13..aebeb3315 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -359,6 +359,21 @@ def filter_environment(good_vars):
return removed_vars
+def clean_environment():
+ """
+ Clean up any spurious environment variables. This will remove any
+ variables the user hasn't chose to preserve.
+ """
+ if 'BB_PRESERVE_ENV' not in os.environ:
+ if 'BB_ENV_WHITELIST' in os.environ:
+ good_vars = os.environ['BB_ENV_WHITELIST'].split()
+ else:
+ good_vars = preserved_envvars_list()
+ if 'BB_ENV_EXTRAWHITE' in os.environ:
+ good_vars.extend(os.environ['BB_ENV_EXTRAWHITE'].split())
+ filter_environment(good_vars)
+
+
def prunedir(topdir):
# Delete everything reachable from the directory named in 'topdir'.
# CAUTION: This is dangerous!