]> code.ossystems Code Review - openembedded-core.git/commitdiff
binutils: fix symlinks
authorAchille Fouilleul <achille.fouilleul@gadz.org>
Fri, 5 Oct 2018 14:38:08 +0000 (16:38 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 9 Oct 2018 11:02:41 +0000 (12:02 +0100)
For nativesdk, symlinks created by do_install contain ${SDKPATHNATIVE}.

This is a problem with SDKs that include nativesdk-binutils and nativesdk-gcc.
When extracting such an SDK dangling symlinks are created, because
relocate_sdk.py does not adjust symlinks. As a result gcc ends up calling the
host binutils.

Use the os.path.relpath function to obtain shorter relative paths, which do not
contain ${SDKPATHNATIVE}.

Signed-off-by: Achille Fouilleul <achille.fouilleul@gadz.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/binutils/binutils.inc

index 81ecbb50cc1217bd4a69ce245d407db3eb86fd8b..0fb6cae407b5abe116304b60560e7c59ca07fbeb 100644 (file)
@@ -131,12 +131,12 @@ do_install () {
        # We don't really need these, so we'll remove them...
        rm -rf ${D}${libdir}/ldscripts
 
+       bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')}
+
        # Fix the /usr/${TARGET_SYS}/bin/* links
        for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
                rm -f $l
-               ln -sf `echo ${prefix}/${TARGET_SYS}/bin \
-                       | tr -s / \
-                       | sed -e 's,^/,,' -e 's,[^/]*,..,g'`${bindir}/${TARGET_PREFIX}`basename $l` $l
+               ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l
        done
 
        # Install the libiberty header