[oe-commits] [openembedded-core] 08/14: package.bbclass: handle links in sorted order

git at git.openembedded.org git at git.openembedded.org
Wed Apr 13 09:13:57 UTC 2016


rpurdie pushed a commit to branch krogoth
in repository openembedded-core.

commit d71f4f54b4c22c9382bddce66c1580d875dcfef2
Author: Bill Randle <william.c.randle at intel.com>
AuthorDate: Tue Apr 12 08:22:21 2016 -0700

    package.bbclass: handle links in sorted order
    
    When processing links, the directories are processed in unsorted order
    which can result in cases like /var/lock -> /run/lock handled before
    /var/run -> /run throwing an error for /var/run because /run already exists.
    Change the link processing to ensure links are processed in sorted order of
    the destination.
    
    [YOCTO #9430]
    
    Signed-off-by: Bill Randle <william.c.randle at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/package.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 4452e2f..894b729 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -727,6 +727,7 @@ python fixup_perms () {
     dvar = d.getVar('PKGD', True)
 
     fs_perms_table = {}
+    fs_link_table = {}
 
     # By default all of the standard directories specified in
     # bitbake.conf will get 0755 root:root.
@@ -773,24 +774,27 @@ python fixup_perms () {
                     continue
                 entry = fs_perms_entry(d.expand(line))
                 if entry and entry.path:
-                    fs_perms_table[entry.path] = entry
+                    if entry.link:
+                        fs_link_table[entry.link] = entry
+                    else:
+                        fs_perms_table[entry.path] = entry
             f.close()
 
     # Debug -- list out in-memory table
     #for dir in fs_perms_table:
     #    bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir])))
+    #for link in fs_link_table:
+    #    bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link])))
 
     # We process links first, so we can go back and fixup directory ownership
     # for any newly created directories
-    for dir in fs_perms_table:
-        if not fs_perms_table[dir].link:
-            continue
-
+    # Process in sorted order so /run gets created before /run/lock, etc.
+    for link in sorted(fs_link_table):
+        dir = fs_link_table[link].path
         origin = dvar + dir
         if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)):
             continue
 
-        link = fs_perms_table[dir].link
         if link[0] == "/":
             target = dvar + link
             ptarget = link
@@ -810,9 +814,6 @@ python fixup_perms () {
         os.symlink(link, origin)
 
     for dir in fs_perms_table:
-        if fs_perms_table[dir].link:
-            continue
-
         origin = dvar + dir
         if not (cpath.exists(origin) and cpath.isdir(origin)):
             continue

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list