<div dir="ltr">You might be interested in some of the patches I&#39;ve got sitting in <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=ross/mutb">http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=ross/mutb</a> specifically around &quot;Add new ELF parser&quot;.  This adds a fully-featured Python ELF parser to lib/oe which could be used to inspect the binaries the way file does, but without having to call and parse the output of file.<div><br></div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 1 December 2017 at 15:50, Olof Johansson <span dir="ltr">&lt;<a href="mailto:olof.johansson@axis.com" target="_blank">olof.johansson@axis.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Avoid matching substrings that are picked up from paths, for instance.<br>
Do this by anchoring the tokens we look for (e.g &quot;executable&quot; or &quot;not<br>
stripped&quot;) with whitespace and punctuation.<br>
<br>
Submitted with this patch series is a change that adds the use of<br>
--brief to file. This removes the path prefix to the output, but the<br>
path can still be included in shebang lines (which file will report as<br>
something like &quot;a /foo/bar/baz.py script&quot;).<br>
<br>
Signed-off-by: Olof Johansson &lt;<a href="mailto:olofjn@axis.com">olofjn@axis.com</a>&gt;<br>
---<br>
 meta/lib/oe/package.py | 10 +++++-----<br>
 1 file changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py<br>
index 976d2ef36c..2bd771cfc5 100644<br>
--- a/meta/lib/oe/package.py<br>
+++ b/meta/lib/oe/package.py<br>
@@ -84,17 +84,17 @@ def is_elf(path, on_error=_is_elf_error):<br>
         error_cb(&#39;&quot;file %s&quot; failed&#39;)<br>
         return<br>
<br>
-    if not &quot;ELF&quot; in result:<br>
+    if not result.startswith(&quot;ELF &quot;):<br>
         return 0<br>
<br>
     exec_type = 1<br>
-    if &quot;not stripped&quot; not in result:<br>
+    if &quot;, not stripped&quot; not in result:<br>
         exec_type |= 2<br>
-    if &quot;executable&quot; in result:<br>
+    if &quot; executable, &quot; in result:<br>
         exec_type |= 4<br>
-    if &quot;shared&quot; in result:<br>
+    if &quot; shared object, &quot; in result:<br>
         exec_type |= 8<br>
-    if &quot;relocatable&quot; in result and is_kernel_module(path):<br>
+    if &quot;relocatable, &quot; in result and is_kernel_module(path):<br>
         exec_type |= 16<br>
     return exec_type<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.11.0<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div>