[OE-core] [PATCH 1/1] archiver.bbclass: exclude recursive symlink for diff

Robert Yang liezhi.yang at windriver.com
Tue Sep 3 11:51:59 UTC 2013


There would be errors if there are recursive symlinks in the ${S}:

diff: /xxx/udev/182-r8/udev-182/test/sys/block/loop0/bdi/subsystem/0:16/subsystem: recursive directory loop

We can check the recursive symlink and save it to the exclude file, then
the diff's --exclude-from argument can exclude them

[YOCTO #4986]

Signed-off-by: Valentin Cobelea <valentin.cobelea at enea.com>
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 meta/classes/archiver.bbclass |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 66efe7d..f5ad562 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -493,6 +493,24 @@ def create_diff_gz(d):
     for i in exclude_from:
         f.write(i)
         f.write("\n")
+
+    symlinks = []
+    directories = []
+
+    # Add symlink and root dir to the separated lists for checking whether
+    # there is recursive symlink
+    for root, dirs, files in os.walk(os.getcwd(), followlinks=True):
+        if os.path.islink(root):
+            symlinks.append(root)
+        elif os.path.isdir(root):
+            directories.append(root)
+
+    # Check if there is a recursive symlink to a dir
+    for sym in symlinks:
+        if sym in directories:
+            # write the 'sym' in the 'exclude-from' file
+            f.write(os.path.basename(sym))
+
     f.close()
 
     s=d.getVar('S', True)
-- 
1.7.10.4




More information about the Openembedded-core mailing list