[oe-commits] Paul Eggleton : recipetool: appendfile: fix file command error handling

git at git.openembedded.org git at git.openembedded.org
Fri Jun 19 21:53:44 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 7bf9dccef1aa626adc9c45addcd066fed69cace9
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=7bf9dccef1aa626adc9c45addcd066fed69cace9

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Tue Jun  9 17:08:43 2015 +0100

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.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>

---

 scripts/lib/recipetool/append.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py
index 28015c6..ed4ce4a 100644
--- a/scripts/lib/recipetool/append.py
+++ b/scripts/lib/recipetool/append.py
@@ -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:



More information about the Openembedded-commits mailing list