diff mbox

classes/sdk-image: fixup ELF_SOWRAP.

Message ID 1373541070-26288-1-git-send-email-jabk@prevas.dk
State Accepted
Delegated to: Esben Haabendal
Headers show

Commit Message

Jacob Kjaergaard July 11, 2013, 11:11 a.m. UTC
From: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>

ELF_SOWRAP was intended to fixup dynamically linked binaries.
However it also did so for statically linked files. This patch
avoids the latter behaviour.
---
 classes/sdk-image.oeclass |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Esben Haabendal Aug. 7, 2013, 8:26 a.m. UTC | #1
<jabk@prevas.dk> writes:

> From: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>
>
> ELF_SOWRAP was intended to fixup dynamically linked binaries.
> However it also did so for statically linked files. This patch
> avoids the latter behaviour.
> ---
>  classes/sdk-image.oeclass |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

Merged to master. I split the filemagic fd leak bugfix into separate
commit.

/Esben
diff mbox

Patch

diff --git a/classes/sdk-image.oeclass b/classes/sdk-image.oeclass
index 3b32454..8d52da0 100644
--- a/classes/sdk-image.oeclass
+++ b/classes/sdk-image.oeclass
@@ -31,6 +31,11 @@  def image_preprocess_elf_sowrap(d):
         filetype = filemagic.file(path)
         return bool(host_elf_re.match(filetype))
 
+    def is_static(path):
+        filetype = filemagic.file(path)
+        static_re = re.compile(".*statically.*")
+        return bool(static_re.match(filetype))
+
     def sowrap_dir(dir, recursive=False):
         if not os.path.exists(dir):
             return True
@@ -49,6 +54,8 @@  def image_preprocess_elf_sowrap(d):
                 print "ERROR: file already exists:", os.path.join(dir, path)
                 ok = False
                 continue
+            if is_elf(path) and is_static(path):
+                continue
             os.rename(path, dotpath)
             with open(path, "w") as wrapper:
                 dirparts = len(os.path.dirname(path).split('/'))
@@ -67,8 +74,9 @@  def image_preprocess_elf_sowrap(d):
         dir = dir.strip("/")
         rc = sowrap_dir(dir, recursive)
         if not rc:
+            filemagic.close()
             return rc
-
+    filemagic.close()
     return
 
 image_preprocess_linux_netfilter_headers () {