summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2013-02-10 13:41:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-11 14:46:11 +0000
commitf2e16c655286aab465054db6727fa3365bef3124 (patch)
treeaff12d2e16376137a10b90f30437d3e86163335e
parenta09c5d66732fdd22b0f5f78304000798db88e495 (diff)
downloadpoky-f2e16c655286aab465054db6727fa3365bef3124.tar.gz
package.bbclass: use oe.path.realpath()
oe.path.realpath() provides are common and more correct implementation for resolving symlinks within sysroot. Use it. Old implementation suffered from lot of problems; e.g. * redundant code * calls 'os.stat()' which references files on host; this can give wrong results about existing/non-existing and can cause EPERM (instead of the catched ENONENT) exceptions * does not deal with special cases like '..' leaving the sysroot. (From OE-Core rev: ec2aab09769f4b6817d74d2175afa2b7c7598750) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass16
1 files changed, 5 insertions, 11 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index b10e6f6a4a..a74ec8a847 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -741,7 +741,8 @@ python split_and_strip_files () {
741 continue 741 continue
742 742
743 try: 743 try:
744 s = os.stat(file) 744 ltarget = oe.path.realpath(file, dvar, False)
745 s = os.lstat(ltarget)
745 except OSError, (err, strerror): 746 except OSError, (err, strerror):
746 if err != errno.ENOENT: 747 if err != errno.ENOENT:
747 raise 748 raise
@@ -752,11 +753,6 @@ python split_and_strip_files () {
752 # If it's a symlink, and points to an ELF file, we capture the readlink target 753 # If it's a symlink, and points to an ELF file, we capture the readlink target
753 if os.path.islink(file): 754 if os.path.islink(file):
754 target = os.readlink(file) 755 target = os.readlink(file)
755 if not os.path.isabs(target):
756 ltarget = os.path.join(os.path.dirname(file), target)
757 else:
758 ltarget = target
759
760 if isELF(ltarget): 756 if isELF(ltarget):
761 #bb.note("Sym: %s (%d)" % (ltarget, isELF(ltarget))) 757 #bb.note("Sym: %s (%d)" % (ltarget, isELF(ltarget)))
762 symlinks[file] = target 758 symlinks[file] = target
@@ -1005,14 +1001,12 @@ python package_fixsymlinks () {
1005 rpath = path[len(inst_root):] 1001 rpath = path[len(inst_root):]
1006 pkg_files[pkg].append(rpath) 1002 pkg_files[pkg].append(rpath)
1007 try: 1003 try:
1008 s = os.stat(path) 1004 rtarget = oe.path.realpath(path, inst_root, True)
1005 os.lstat(rtarget)
1009 except OSError, (err, strerror): 1006 except OSError, (err, strerror):
1010 if err != errno.ENOENT: 1007 if err != errno.ENOENT:
1011 raise 1008 raise
1012 target = os.readlink(path) 1009 dangling_links[pkg].append(os.path.normpath(rtarget[len(inst_root):]))
1013 if target[0] != '/':
1014 target = os.path.join(os.path.dirname(path)[len(inst_root):], target)
1015 dangling_links[pkg].append(os.path.normpath(target))
1016 1010
1017 newrdepends = {} 1011 newrdepends = {}
1018 for pkg in dangling_links: 1012 for pkg in dangling_links: