Skip to contentSkip to conversation

autotools.bbclass: use relative path to run configure script

PATCH In review Robert Yang 4 participants 8 messages Jan 11, 2016 – Jan 12, 2016

lore
Share & tools
lore
#0 lore raw

cover autotools.bbclass: use relative path to run configure script

Hi,

The 2 patches can reduce a lot of QA Issues for buildpaths.

// Robert

The following changes since commit 5661d8cb7849df62358368743134c0aaf523965e:

image: Really remove lockfiles flag (2016-01-07 13:41:47 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/relative
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/relative

Robert Yang (2):
glibc-initial.inc: use relative path to run configure autotools.bbclass: use relative path to run configure script

 meta/classes/autotools.bbclass            |    4 +++-
 meta/recipes-core/glibc/glibc-initial.inc |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 glibc-initial.inc: use relative path to run configure

Avoid potential build path in output files.

[YOCTO #8894]

---
 meta/recipes-core/glibc/glibc-initial.inc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/glibc/glibc-initial.inc +1 -1
index 8e81f09..cb2f8dd 100644
@@ -11,7 +11,7 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
 do_configure () {
 	(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
 	find ${S} -name "configure" | xargs touch
-	${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
+	../git/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
 		--prefix=/usr \
 		--without-cvs --disable-sanity-checks \
 		--with-headers=${STAGING_DIR_TARGET}${includedir} \
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/2] glibc-initial.inc: use relative path to run configure

Quoted 14 lines · Robert Yang

Avoid potential build path in output files.

[YOCTO #8894]

---
 meta/recipes-core/glibc/glibc-initial.inc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/glibc/glibc-initial.inc +0 -0
index 8e81f09..cb2f8dd 100644

meta/recipes-core/glibc/glibc-initial.inc TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}" · line 14

Quoted 5 lines
meta/recipes-core/glibc/glibc-initial.inc +1 -1
@@ -11,7 +11,7 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
 do_configure () {
 	(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
 	find ${S} -name "configure" | xargs touch
-	${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
+	../git/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \

Although I haven't tested it, this _looks_ like it might fail quite readily. I'm sure there are some recipes that play tricks with ${S}, and what about recipes that don't pull their sources from git?

Maybe something like: (cd ${S} && ./configure ...) would be better?

Quoted 3 lines
meta/recipes-core/glibc/glibc-initial.inc +0 -0
 		--prefix=/usr \
 		--without-cvs --disable-sanity-checks \
 		--with-headers=${STAGING_DIR_TARGET}${includedir} \
#3 lore raw

Re: [PATCH 1/2] glibc-initial.inc: use relative path to run configure

Quoted 27 lines · Trevor Woerner
Quoted 14 lines · Robert Yang

Avoid potential build path in output files.

[YOCTO #8894]

---
 meta/recipes-core/glibc/glibc-initial.inc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/glibc/glibc-initial.inc +0 -0
index 8e81f09..cb2f8dd 100644

meta/recipes-core/glibc/glibc-initial.inc TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}" · line 14

Quoted 5 lines
meta/recipes-core/glibc/glibc-initial.inc +1 -1
@@ -11,7 +11,7 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
 do_configure () {
 	(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
 	find ${S} -name "configure" | xargs touch
-	${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
+	../git/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \

Although I haven't tested it, this _looks_ like it might fail quite readily. I'm sure there are some recipes that play tricks with ${S}, and what about recipes that don't pull their sources from git?

Quoted 1 line

Maybe something like: (cd ${S} && ./configure ...) would be better?

That won't work since it'll run configure in the S directory.

IF we need to use relative paths here, we need to calculate the relative path from B to S and use that. It looks like patch 2/2 already does something like this using the python.. we can probably do the same. (I don't know any reason, at least for glibc, that all of the items won't be in the same "WORKDIR". So it would be relative within the WORKDIR, which SHOULD be fine.)

Quoted 4 lines
Quoted 3 lines
meta/recipes-core/glibc/glibc-initial.inc +0 -0
 		--prefix=/usr \
 		--without-cvs --disable-sanity-checks \
 		--with-headers=${STAGING_DIR_TARGET}${includedir} \
#4 lore raw

Re: [PATCH 1/2] glibc-initial.inc: use relative path to run configure

Quoted 35 lines · Mark Hatle
Quoted 5 lines · Trevor Woerner
Quoted 2 lines · Robert Yang

Avoid potential build path in output files.

Quoted 8 lines

Review

Quoted 8 lines

[YOCTO #8894]

---
 meta/recipes-core/glibc/glibc-initial.inc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/recipes-core/glibc/glibc-initial.inc

Quoted 4 lines

meta/recipes-core/glibc/glibc-initial.inc TOOLCHAIN_OPTIONS = "

Quoted 4 lines

index 8e81f09..cb2f8dd 100644

meta/recipes-core/glibc/glibc-initial.inc +0 -0
@@ -11,7 +11,7 @@ TOOLCHAIN_OPTIONS = "

--sysroot=${STAGING_DIR_TCBOOTSTRAP}"

Quoted 2 lines

meta/recipes-core/glibc/glibc-initial.inc TOOLCHAIN_OPTIONS = " · line 12

Quoted 2 lines
meta/recipes-core/glibc/glibc-initial.inc +0 -0
 do_configure () {
     (cd ${S} && gnu-configize) || die "failure in running

gnu-configize"

Quoted 9 lines

meta/recipes-core/glibc/glibc-initial.inc TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}" · line 14

Quoted 3 lines
meta/recipes-core/glibc/glibc-initial.inc +1 -1
     find ${S} -name "configure" | xargs touch
-    ${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
+    ../git/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \

Although I haven't tested it, this _looks_ like it might fail quite readily. I'm sure there are some recipes that play tricks with ${S}, and what about recipes that don't pull their sources from git?

Maybe something like: (cd ${S} && ./configure ...) would be better?

That won't work since it'll run configure in the S directory.

Quoted 9 lines

IF we need to use relative paths here, we need to calculate the relative path
from B to S and use that. It looks like patch 2/2 already does something like
this using the python.. we can probably do the same. (I don't know any reason,
at least for glibc, that all of the items won't be in the same "WORKDIR". So it
would be relative within the WORKDIR, which SHOULD be fine.)

Unless we want to specifically not support externalsrc (and therefore, devtool modify -x) for a particular recipe, we should probably not make the assumption that S and B are relative to WORKDIR :)

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#5 lore raw

Re: [PATCH 1/2] glibc-initial.inc: use relative path to run configure

Quoted 43 lines · Christopher Larson

On Mon, Jan 11, 2016 at 8:06 AM, Mark Hatle <[email protected] <mailto:[email protected]>> wrote:

    On 1/11/16 8:55 AM, Trevor Woerner wrote:
    >
    >
    > On 01/11/16 00:11, Robert Yang wrote:
    >> Avoid potential build path in output files.
    >>
    >> [YOCTO #8894]
    >>
    >> Signed-off-by: Robert Yang <[email protected] <mailto:[email protected]>>
    >> ---
    >>  meta/recipes-core/glibc/glibc-initial.inc |    2 +-
    >>  1 file changed, 1 insertion(+), 1 deletion(-)
    >>
    >> diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
    >> index 8e81f09..cb2f8dd 100644
    >> --- a/meta/recipes-core/glibc/glibc-initial.inc
    >> +++ b/meta/recipes-core/glibc/glibc-initial.inc
    >> @@ -11,7 +11,7 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
    >>  do_configure () {
    >>      (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
    >>      find ${S} -name "configure" | xargs touch
    >> -    ${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
    >> +    ../git/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
    >
    > Although I haven't tested it, this _looks_ like it might fail quite
    > readily. I'm sure there are some recipes that play tricks with ${S}, and
    > what about recipes that don't pull their sources from git?
    >
    > Maybe something like: (cd ${S} && ./configure ...) would be better?

    That won't work since it'll run configure in the S directory.

    IF we need to use relative paths here, we need to calculate the relative path
    from B to S and use that.  It looks like patch 2/2 already does something like
    this using the python..  we can probably do the same.  (I don't know any reason,
    at least for glibc, that all of the items won't be in the same "WORKDIR".  So it
    would be relative within the WORKDIR, which SHOULD be fine.)
Quoted 3 lines

Unless we want to specifically not support externalsrc (and therefore, devtool modify -x) for a particular recipe, we should probably not make the assumption that S and B are relative to WORKDIR :)

There ya go. I didn't realize even with externalsrc and such that the code wasn't copied or otherwise linked into the typical 'S' inside of WORKDIR.

So relative here is still potentially useful, but the problem being solved isn't actually being solved in the end. We're still ended up embedded specific paths that are triggered QA errors because of the split S/B issue.

--Mark

Quoted 6 lines
Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#6 lore raw

PATCH 2/2 autotools.bbclass: use relative path to run configure script

In reply to Robert Yang

The absolute path (/path/to/configure) caused VPATH in Makefile to be an absolute path, and then it will be in elf files, use relative path to run configure can fix the problem.

This will reduce a lot of buildpaths QA issues in a world buld.

[YOCTO #8894]

---
 meta/classes/autotools.bbclass |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/classes/autotools.bbclass +3 -1
index d546a5c..44cb422 100644
@@ -83,7 +83,9 @@ CONFIGURE_SCRIPT ?= "${AUTOTOOLS_SCRIPT_PATH}/configure"
 AUTOTOOLS_AUXDIR ?= "${AUTOTOOLS_SCRIPT_PATH}"
 
 oe_runconf () {
-	cfgscript="${CONFIGURE_SCRIPT}"
+	# Use relative path to avoid buildpaths in files
+	cfgscript_name="`basename ${CONFIGURE_SCRIPT}`"
+	cfgscript=`python -c "import os; print os.path.relpath(os.path.dirname('${CONFIGURE_SCRIPT}'), '.')"`/$cfgscript_name
 	if [ -x "$cfgscript" ] ; then
 		bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
 		set +e
Signature · 1 line
1.7.9.5
#7 lore raw
In reply to Robert Yang

Thanks all, I updated "glibc-initial.inc: use relative path to run configure", now it should work for external source:

git://git.openembedded.org/openembedded-core-contrib rbt/relative

http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/relative

Robert Yang (2):
glibc-initial.inc: use relative path to run configure autotools.bbclass: use relative path to run configure script

meta/recipes-core/glibc/glibc-initial.inc +2 -1
index 8e81f09..7214f71 100644
@@ -11,7 +11,8 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
 do_configure () {
        (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
        find ${S} -name "configure" | xargs touch
-       ${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
+       cfgscript=`python -c "import os; print os.path.relpath('${S}', '.')"`/configure
+       $cfgscript --host=${TARGET_SYS} --build=${BUILD_SYS} \
                --prefix=/usr \
                --without-cvs --disable-sanity-checks \
                --with-headers=${STAGING_DIR_TARGET}${includedir} \

// Robert

Quoted 23 lines · Robert Yang

Hi,

The 2 patches can reduce a lot of QA Issues for buildpaths.

// Robert

The following changes since commit 5661d8cb7849df62358368743134c0aaf523965e:

image: Really remove lockfiles flag (2016-01-07 13:41:47 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/relative
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/relative

Robert Yang (2):
glibc-initial.inc: use relative path to run configure autotools.bbclass: use relative path to run configure script

  meta/classes/autotools.bbclass            |    4 +++-
  meta/recipes-core/glibc/glibc-initial.inc |    2 +-
  2 files changed, 4 insertions(+), 2 deletions(-)