diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/bb/fetch/__init__.py | 19 |
2 files changed, 15 insertions, 5 deletions
@@ -124,6 +124,7 @@ Changes in Bitbake 1.9.x: - Handle exit codes correctly (from pH5) - Work around refs/HEAD issues with git over http (#3410) - Add proxy support to the CVS fetcher (from Cyril Chemparathy) + - Improve runfetchcmd so errors are seen and various GIT variables are exported Changes in Bitbake 1.8.0: - Release 1.7.x as a stable series diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py index 4919b9d47..41eebb29b 100644 --- a/lib/bb/fetch/__init__.py +++ b/lib/bb/fetch/__init__.py @@ -248,13 +248,22 @@ def runfetchcmd(cmd, d, quiet = False): Raise an error if interrupted or cmd fails Optionally echo command output to stdout """ - bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cmd) # Need to export PATH as binary could be in metadata paths # rather than host provided - pathcmd = 'export PATH=%s; %s' % (data.expand('${PATH}', d), cmd) + # Also include some other variables. + # FIXME: Should really include all export varaiables? + exportvars = ['PATH', 'GIT_PROXY_HOST', 'GIT_PROXY_PORT', 'GIT_PROXY_COMMAND'] + + for var in exportvars: + val = data.getVar(var, d, True) + if val: + cmd = 'export ' + var + '=%s; %s' % (val, cmd) + + bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cmd) - stdout_handle = os.popen(pathcmd, "r") + # redirect stderr to stdout + stdout_handle = os.popen(cmd + " 2>&1", "r") output = "" while 1: @@ -270,9 +279,9 @@ def runfetchcmd(cmd, d, quiet = False): exitstatus = status & 0xff if signal: - raise FetchError("Fetch command %s failed with signal %s, output:\n%s" % (pathcmd, signal, output)) + raise FetchError("Fetch command %s failed with signal %s, output:\n%s" % (cmd, signal, output)) elif status != 0: - raise FetchError("Fetch command %s failed with exit code %s, output:\n%s" % (pathcmd, status, output)) + raise FetchError("Fetch command %s failed with exit code %s, output:\n%s" % (cmd, status, output)) return output |