[01/28] package.bbclass: Fix handling of symlinks in debug packages

Submitted by Richard Purdie on Aug. 22, 2013, 11:29 a.m. | Patch ID: 56191


Message ID 1377171000-6469-1-git-send-email-richard.purdie@linuxfoundation.org
State Accepted
Commit 2ca2c4747f645a0d478c2171fff4c65752188285
Headers show

Commit Message

Richard Purdie Aug. 22, 2013, 11:29 a.m.
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]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
 meta/classes/package.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 2460d0a..f6f9310 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -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)


Richard Purdie Aug. 22, 2013, 11:46 a.m.
Playing with meta-mingw, it was clear that there were some simple
changes we could make to the core that would improve things for
non-linux SDKs. This series includes those changes. Since I like pain, I
also attempted a darwin build and have included some tweaks for that

When looking at the gcc recipes, it also became clear that we have way
too many include files and the whole thing was a bit of a maze. The
series has some changes in to combine various files together and
simplify things.

I appreciate this may complicate moving things into meta-oe such as gcc
4.7. I would propose when we do that, we put them into
recipes-gcc-<version> and include a snapshot of the .inc files at that
time. The alternative is the continual copy and paste growth of the .bb
files (libgcc being a more extreme example) which I don't think lends
itself to future maintenance of the recipes.

There are some layers which for example use gcc-cross4.inc, they should
just be able to switch directly to gcc-cross.inc. I think this applies
to meta-arago-extras.

This also leads the way to possibly further unify and clean up some of
the configuration (e.g. the do_configure_prepends) but I will leave that
for another series when someone has some further time to spend on it.