[oe-commits] Ed Bartosh : split_and_strip_files: regroup hardlinks to make build deterministic
git at git.openembedded.org
git at git.openembedded.org
Tue Apr 28 16:55:22 UTC 2015
Module: openembedded-core.git
Branch: master-next
Commit: aa713f0676711e7721ee47e1a9406c1fe8abebff
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=aa713f0676711e7721ee47e1a9406c1fe8abebff
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date: Tue Apr 28 19:46:38 2015 +0300
split_and_strip_files: regroup hardlinks to make build deterministic
Reverted 7c0fd561bad0250a00cef63e3d787573112a59cf
Created separate group of hardlinks for the files inside
the same package. This should prevent stripped files to be
populated outside of package directories.
[YOCTO #7586]
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/package.bbclass | 12 ++++++++++++
meta/lib/oe/package.py | 3 +--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index f1b966d..dc87206 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -877,6 +877,7 @@ python split_and_strip_files () {
symlinks = {}
hardlinks = {}
kernmods = []
+ inodes = {}
libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir", True))
baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir", True))
if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
@@ -914,6 +915,17 @@ python split_and_strip_files () {
#bb.note("Sym: %s (%d)" % (ltarget, isELF(ltarget)))
symlinks[file] = target
continue
+ if s.st_nlink > 1:
+ if s.st_ino in inodes:
+ os.unlink(file)
+ os.link(inodes[s.st_ino], file)
+ elif s.st_nlink > 1:
+ inodes[s.st_ino] = file
+ # break hardlink
+ bb.utils.copyfile(file, file)
+ cpath.updatecache(file)
+ s = cpath.lstat(file)
+
# It's a file (or hardlink), not a link
# ...but is it ELF, and is it already stripped?
elf_file = isELF(file)
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 8bc56c6..ea6feaa 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -30,8 +30,7 @@ def runstrip(arg):
elif elftype & 8 or elftype & 4:
extraflags = "--remove-section=.comment --remove-section=.note"
- # Use mv to break hardlinks
- stripcmd = "'%s' %s '%s' -o '%s.tmp' && chown --reference='%s' '%s.tmp' && mv '%s.tmp' '%s'" % (strip, extraflags, file, file, file, file, file, file)
+ stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
bb.debug(1, "runstrip: %s" % stripcmd)
ret = subprocess.call(stripcmd, shell=True)
More information about the Openembedded-commits
mailing list