package.bbclass: Fix handling of symlinks in debug packages

When copying the sources for the debug source package we use cpio -Ll
which means to copy files as hardlinks and to dereference symlinks.
It appears there is a bug in cpio since -Ll will copy symlinks and
not dereference them. We therefore do a second pass over copied symlinks
resolving them into files. Ideally we would copy these as hardlinks as well
however it doesn't seem worth the extra code and effort for what amounts
to a corner case for a minor space improvement.

This means that the -dbg packages no longer contain broken symlinks.

[YOCTO #5020]

(From OE-Core rev: 2ca2c4747f645a0d478c2171fff4c65752188285)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2013-08-20 13:01:49 +00:00
parent 199b1a8c7d
commit 694f034ec0
1 changed files with 6 additions and 0 deletions

View File

@ -316,6 +316,12 @@ def copydebugsources(debugsrcdir, d):
#if retval:
# bb.fatal("debug source copy failed with exit code %s (cmd was %s)" % (retval, cmd))
# cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced.
# Work around this by manually finding and copying any symbolic links that made it through.
cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s' 2>/dev/null)" % (dvar, debugsrcdir, dvar, debugsrcdir, workparentdir, dvar, debugsrcdir)
(retval, output) = oe.utils.getstatusoutput(cmd)
if retval:
bb.fatal("debugsrc symlink fixup failed with exit code %s (cmd was %s)" % (retval, cmd))
# The copy by cpio may have resulted in some empty directories! Remove these
cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir)