diff options
author | Richard Purdie <richard@openedhand.com> | 2008-04-08 11:34:15 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-04-08 11:34:15 +0000 |
commit | 67d5f0483b66a5688a62dab90395a23dc4bc2772 (patch) | |
tree | 642bb9a7f2e5eb27e454a970c5dbf3869623c471 /bitbake | |
parent | a546b63011f5a3db1f393a6f5fb56757c26ce25d (diff) | |
download | poky-67d5f0483b66a5688a62dab90395a23dc4bc2772.tar.gz |
bitbake: Improve fetcher runcmd function so error messages are visable and various variables are exported for the benefit of the git fetcher
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4194 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 4919b9d473..41eebb29b5 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -248,13 +248,22 @@ def runfetchcmd(cmd, d, quiet = False): | |||
248 | Raise an error if interrupted or cmd fails | 248 | Raise an error if interrupted or cmd fails |
249 | Optionally echo command output to stdout | 249 | Optionally echo command output to stdout |
250 | """ | 250 | """ |
251 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cmd) | ||
252 | 251 | ||
253 | # Need to export PATH as binary could be in metadata paths | 252 | # Need to export PATH as binary could be in metadata paths |
254 | # rather than host provided | 253 | # rather than host provided |
255 | pathcmd = 'export PATH=%s; %s' % (data.expand('${PATH}', d), cmd) | 254 | # Also include some other variables. |
255 | # FIXME: Should really include all export varaiables? | ||
256 | exportvars = ['PATH', 'GIT_PROXY_HOST', 'GIT_PROXY_PORT', 'GIT_PROXY_COMMAND'] | ||
257 | |||
258 | for var in exportvars: | ||
259 | val = data.getVar(var, d, True) | ||
260 | if val: | ||
261 | cmd = 'export ' + var + '=%s; %s' % (val, cmd) | ||
262 | |||
263 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % cmd) | ||
256 | 264 | ||
257 | stdout_handle = os.popen(pathcmd, "r") | 265 | # redirect stderr to stdout |
266 | stdout_handle = os.popen(cmd + " 2>&1", "r") | ||
258 | output = "" | 267 | output = "" |
259 | 268 | ||
260 | while 1: | 269 | while 1: |
@@ -270,9 +279,9 @@ def runfetchcmd(cmd, d, quiet = False): | |||
270 | exitstatus = status & 0xff | 279 | exitstatus = status & 0xff |
271 | 280 | ||
272 | if signal: | 281 | if signal: |
273 | raise FetchError("Fetch command %s failed with signal %s, output:\n%s" % (pathcmd, signal, output)) | 282 | raise FetchError("Fetch command %s failed with signal %s, output:\n%s" % (cmd, signal, output)) |
274 | elif status != 0: | 283 | elif status != 0: |
275 | raise FetchError("Fetch command %s failed with exit code %s, output:\n%s" % (pathcmd, status, output)) | 284 | raise FetchError("Fetch command %s failed with exit code %s, output:\n%s" % (cmd, status, output)) |
276 | 285 | ||
277 | return output | 286 | return output |
278 | 287 | ||