recipetool: appendfile: fix file command error handling

* It turns out that not all versions of the file command support the -E
  option - the version in Ubuntu 14.04 doesn't support it for example.
  This option is supposed to force file to return an error if the file
  can't be opened - since we can't rely upon it then fall back to
  looking at the output instead. (The results of this issue were simply
  that we didn't notice if the file was executable and give a warning,
  which tripped an oe-selftest failure - so it was minor.)
* If we receive an error there's not much point looking at the output to
  see what type was returned because there wasn't one.

(From OE-Core rev: 7bf9dccef1aa626adc9c45addcd066fed69cace9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2015-06-09 17:08:43 +01:00 committed by Richard Purdie
parent 44e036904c
commit 32ed5f5769
1 changed files with 4 additions and 2 deletions

View File

@ -262,10 +262,12 @@ def appendfile(args):
stdout = ''
try:
(stdout, _) = bb.process.run('LANG=C file -E -b %s' % args.newfile, shell=True)
(stdout, _) = bb.process.run('LANG=C file -b %s' % args.newfile, shell=True)
if 'cannot open' in stdout:
raise bb.process.ExecutionError(stdout)
except bb.process.ExecutionError as err:
logger.debug('file command returned error: %s' % err)
pass
stdout = ''
if stdout:
logger.debug('file command output: %s' % stdout.rstrip())
if ('executable' in stdout and not 'shell script' in stdout) or 'shared object' in stdout: