diff options
author | Bill Randle <william.c.randle@intel.com> | 2016-04-12 08:22:21 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-13 10:12:52 +0100 |
commit | 9262d2ff39f898605fe6f4224a4684e782439497 (patch) | |
tree | 2480aa6ad77712724f45cf56b16dac7725f35da0 /meta/classes | |
parent | 29cf26363f9f71f13ff1548b8daf11052b0dc839 (diff) | |
download | poky-9262d2ff39f898605fe6f4224a4684e782439497.tar.gz |
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]
(From OE-Core rev: d71f4f54b4c22c9382bddce66c1580d875dcfef2)
Signed-off-by: Bill Randle <william.c.randle@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/package.bbclass | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 4452e2f4f4..894b7294a2 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -727,6 +727,7 @@ python fixup_perms () { | |||
727 | dvar = d.getVar('PKGD', True) | 727 | dvar = d.getVar('PKGD', True) |
728 | 728 | ||
729 | fs_perms_table = {} | 729 | fs_perms_table = {} |
730 | fs_link_table = {} | ||
730 | 731 | ||
731 | # By default all of the standard directories specified in | 732 | # By default all of the standard directories specified in |
732 | # bitbake.conf will get 0755 root:root. | 733 | # bitbake.conf will get 0755 root:root. |
@@ -773,24 +774,27 @@ python fixup_perms () { | |||
773 | continue | 774 | continue |
774 | entry = fs_perms_entry(d.expand(line)) | 775 | entry = fs_perms_entry(d.expand(line)) |
775 | if entry and entry.path: | 776 | if entry and entry.path: |
776 | fs_perms_table[entry.path] = entry | 777 | if entry.link: |
778 | fs_link_table[entry.link] = entry | ||
779 | else: | ||
780 | fs_perms_table[entry.path] = entry | ||
777 | f.close() | 781 | f.close() |
778 | 782 | ||
779 | # Debug -- list out in-memory table | 783 | # Debug -- list out in-memory table |
780 | #for dir in fs_perms_table: | 784 | #for dir in fs_perms_table: |
781 | # bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir]))) | 785 | # bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir]))) |
786 | #for link in fs_link_table: | ||
787 | # bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link]))) | ||
782 | 788 | ||
783 | # We process links first, so we can go back and fixup directory ownership | 789 | # We process links first, so we can go back and fixup directory ownership |
784 | # for any newly created directories | 790 | # for any newly created directories |
785 | for dir in fs_perms_table: | 791 | # Process in sorted order so /run gets created before /run/lock, etc. |
786 | if not fs_perms_table[dir].link: | 792 | for link in sorted(fs_link_table): |
787 | continue | 793 | dir = fs_link_table[link].path |
788 | |||
789 | origin = dvar + dir | 794 | origin = dvar + dir |
790 | if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)): | 795 | if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)): |
791 | continue | 796 | continue |
792 | 797 | ||
793 | link = fs_perms_table[dir].link | ||
794 | if link[0] == "/": | 798 | if link[0] == "/": |
795 | target = dvar + link | 799 | target = dvar + link |
796 | ptarget = link | 800 | ptarget = link |
@@ -810,9 +814,6 @@ python fixup_perms () { | |||
810 | os.symlink(link, origin) | 814 | os.symlink(link, origin) |
811 | 815 | ||
812 | for dir in fs_perms_table: | 816 | for dir in fs_perms_table: |
813 | if fs_perms_table[dir].link: | ||
814 | continue | ||
815 | |||
816 | origin = dvar + dir | 817 | origin = dvar + dir |
817 | if not (cpath.exists(origin) and cpath.isdir(origin)): | 818 | if not (cpath.exists(origin) and cpath.isdir(origin)): |
818 | continue | 819 | continue |