cmake: Avoid passing empty prefix to os.path.relpath
PATCH v2 1/1 cmake: Avoid passing empty prefix to os.path.relpath
With meta-micro, ${prefix} is the empty string. This means that CMAKE_INSTALL_BINDIR:PATH and friends end up containing paths starting with many instances of "../", presumably due to os.path.relpath attempting to find its way to the current directory.
Let's avoid this by ensuring that the root path always ends in a slash. If it already ends in a slash then adding another one shouldn't cause any problems.
--- meta/classes/cmake.bbclass | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
meta/classes/cmake.bbclass +7 -7
@@ -119,15 +119,15 @@ cmake_do_configure() { $oecmake_sitefile \ ${OECMAKE_SOURCEPATH} \ -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ - -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix'))} \ + -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \ -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \ - -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix'))} \ + -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix') + '/')} \ -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \ - -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix'))} \ + -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \ -DCMAKE_INSTALL_SO_NO_EXE=0 \ -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \ -DCMAKE_VERBOSE_MAKEFILE=1 \
Signature · 1 line
2.11.0
Quoted 10 lines · Mike Crowe
With meta-micro, ${prefix} is the empty string. This means that CMAKE_INSTALL_BINDIR:PATH and friends end up containing paths starting with many instances of "../", presumably due to os.path.relpath attempting to find its way to the current directory.
Let's avoid this by ensuring that the root path always ends in a slash. If it already ends in a slash then adding another one shouldn't cause any problems.
Signed-off-by Mike Crowe <[email protected]>
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Quoted 6 lines · Otavio Salvador
Quoted 5 lines · Mike Crowe
With meta-micro, ${prefix} is the empty string. This means that CMAKE_INSTALL_BINDIR:PATH and friends end up containing paths starting with many instances of "../", presumably due to os.path.relpath attempting to find its way to the current directory.
Quoted 7 lines
Quoted 5 lines
Let's avoid this by ensuring that the root path always ends in a slash. If it already ends in a slash then adding another one shouldn't cause any problems.
Signed-off-by Mike Crowe <[email protected]>Signed-off-by Otavio Salvador <[email protected]>
Patch ID: 145709
It doesn't look like this change has landed, even on master-next. Has it fallen through the cracks?
Thanks.
Mike.
It was implicated in some build failures. I'll re-add it and try again.
Ross
Quoted 32 lines · Mike Crowe
Quoted 3 lines · Otavio Salvador
Quoted 2 lines · Mike Crowe
With meta-micro, ${prefix} is the empty string. This means that CMAKE_INSTALL_BINDIR:PATH and friends end up containing paths starting
with
Quoted 1 line
Quoted 1 line
many instances of "../", presumably due to os.path.relpath attempting
to
Quoted 3 lines
Quoted 3 lines
find its way to the current directory.
Let's avoid this by ensuring that the root path always ends in a
slash. If
Quoted 6 lines
Quoted 4 lines
it already ends in a slash then adding another one shouldn't cause any problems.
Signed-off-by Mike Crowe <[email protected]>Signed-off-by Otavio Salvador <[email protected]>Patch ID: 145709
It doesn't look like this change has landed, even on master-next. Has it fallen through the cracks?
Thanks.
Mike.
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 1 line · Ross
It was implicated in some build failures. I'll re-add it and try again.
Thanks. Are the new results in? I had a poke about on autobuilder.yocto.io but couldn't work out how to tell which builds this commit was included in. Build 719 did not appear to include it.
Thanks.
Mike.
https://patchwork.openembedded.org/patch/145709/
Quoted 6 lines · Mike Crowe
Quoted 1 line · Ross
It was implicated in some build failures. I'll re-add it and try again.
Thanks. Are the new results in? I had a poke about on autobuilder.yocto.io but couldn't work out how to tell which builds this commit was included in. Build 719 did not appear to include it.
Any more news?
Thanks.
Mike.
Quoted 6 lines · Mike Crowe
https://patchwork.openembedded.org/patch/145709/
Quoted 3 lines · Mike Crowe
Quoted 1 line · Ross
It was implicated in some build failures. I'll re-add it and try again.
Quoted 7 lines
Quoted 3 lines
Thanks. Are the new results in? I had a poke about on autobuilder.yocto.io but couldn't work out how to tell which builds this commit was included in. Build 719 did not appear to include it.
Any more news?
Thanks.
Hi Ross,
It looks like this patch never made it in. It still applies. Please can you try adding it again?
Thanks.
Mike.
From c5b7a0584b6d37ecb28cd2aa3d9a9a80b0178e96 Mon Sep 17 00:00:00 2001
From: Mike Crowe <[email protected]>
Date: Sun, 12 Nov 2017 14:16:20 +0000
Subject: [PATCHv2] cmake: Avoid passing empty prefix to os.path.relpath
With meta-micro, ${prefix} is the empty string. This means that CMAKE_INSTALL_BINDIR:PATH and friends end up containing paths starting with many instances of "../", presumably due to os.path.relpath attempting to find its way to the current directory.
Let's avoid this by ensuring that the root path always ends in a slash. If it already ends in a slash then adding another one shouldn't cause any problems.
--- meta/classes/cmake.bbclass | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
meta/classes/cmake.bbclass +7 -7
@@ -161,15 +161,15 @@ cmake_do_configure() { $oecmake_sitefile \ ${OECMAKE_SOURCEPATH} \ -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ - -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix'))} \ + -DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \ -DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \ - -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix'))} \ + -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix') + '/')} \ -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \ - -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix'))} \ - -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix'))} \ + -DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \ + -DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \ -DCMAKE_INSTALL_SO_NO_EXE=0 \ -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \ -DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
--
2.20.1