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()
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:
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!