diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2008-12-06 12:27:37 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2008-12-06 12:27:37 +0000 |
commit | 038cb1325af263b0ec165e69a9faa374f49074fc (patch) | |
tree | a73ef983604b15c04ae711cff77d36ed7de2b809 /lib | |
parent | e3e9aec503052ae5d71ab1fda519748ff1e08499 (diff) | |
download | bitbake-038cb1325af263b0ec165e69a9faa374f49074fc.tar.gz |
utils.py: Add clean_environment() function and call where appropriate (from Poky)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/fetch/wget.py | 25 | ||||
-rw-r--r-- | lib/bb/utils.py | 15 |
2 files changed, 40 insertions, 0 deletions
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! |