Patchwork eglibc-initial: Ensure symlinks point to the correct location when built from sstate cache

login
register
mail settings
Submitter Richard Purdie
Date Nov. 29, 2011, 12:26 p.m.
Message ID <1322569564.3166.1.camel@ted>
Download mbox | patch
Permalink /patch/15591/
State Accepted
Commit ad0baa7d2f33a865011e0c6afe29f22aa1beea32
Headers show

Comments

Richard Purdie - Nov. 29, 2011, 12:26 p.m.
If the sstate files are installed into a sysroot from the sstate cache,
the directory to the main sysroot can change and the symlinks aren't
adjusted to account for this. This is a problem specific to the toolchain
bootstrap process. This patch adds up a function to recreate the
symlinks, hence ensuring they always point at the correct location.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
Martin Jansa - Nov. 29, 2011, 12:30 p.m.
On Tue, Nov 29, 2011 at 12:26:04PM +0000, Richard Purdie wrote:
> If the sstate files are installed into a sysroot from the sstate cache,
> the directory to the main sysroot can change and the symlinks aren't
> adjusted to account for this. This is a problem specific to the toolchain
> bootstrap process. This patch adds up a function to recreate the
> symlinks, hence ensuring they always point at the correct location.

Similar issue is IMHO in python and apr (and probably more)
http://lists.linuxtogo.org/pipermail/openembedded-core/2011-November/012149.html

Cheers,

> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/meta/recipes-core/eglibc/eglibc-initial.inc b/meta/recipes-core/eglibc/eglibc-initial.inc
> index 448f73a..9062516 100644
> --- a/meta/recipes-core/eglibc/eglibc-initial.inc
> +++ b/meta/recipes-core/eglibc/eglibc-initial.inc
> @@ -60,4 +60,16 @@ do_siteconfig () {
>  	:
>  }
>  
> +SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
> +eglibcinitial_sstate_postinst() {
> +	if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
> +	then
> +		# Recreate the symlinks to ensure they point to the correct location
> +		for t in linux asm asm-generic; do
> +			rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
> +			ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
> +		done
> +	fi
> +}
> +
>  do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Richard Purdie - Nov. 29, 2011, 1:02 p.m.
On Tue, 2011-11-29 at 13:30 +0100, Martin Jansa wrote:
> On Tue, Nov 29, 2011 at 12:26:04PM +0000, Richard Purdie wrote:
> > If the sstate files are installed into a sysroot from the sstate cache,
> > the directory to the main sysroot can change and the symlinks aren't
> > adjusted to account for this. This is a problem specific to the toolchain
> > bootstrap process. This patch adds up a function to recreate the
> > symlinks, hence ensuring they always point at the correct location.
> 
> Similar issue is IMHO in python and apr (and probably more)
> http://lists.linuxtogo.org/pipermail/openembedded-core/2011-November/012149.html

Its similar but not that similar. The toolchain sysroots are special in
that the bootstrap one needs to refer to the non-bootstrap one via
symlinks.

The path references you mention above should be detected by the sstate
relocation code and fixed up automatically. It sounds like the search
and replace expressions we're using aren't catching every reference we
need to which is a different problem.

Cheers,

Richard
Richard Purdie - Nov. 29, 2011, 5:30 p.m.
On Tue, 2011-11-29 at 13:02 +0000, Richard Purdie wrote:
> On Tue, 2011-11-29 at 13:30 +0100, Martin Jansa wrote:
> > On Tue, Nov 29, 2011 at 12:26:04PM +0000, Richard Purdie wrote:
> > > If the sstate files are installed into a sysroot from the sstate cache,
> > > the directory to the main sysroot can change and the symlinks aren't
> > > adjusted to account for this. This is a problem specific to the toolchain
> > > bootstrap process. This patch adds up a function to recreate the
> > > symlinks, hence ensuring they always point at the correct location.
> > 
> > Similar issue is IMHO in python and apr (and probably more)
> > http://lists.linuxtogo.org/pipermail/openembedded-core/2011-November/012149.html
> 
> Its similar but not that similar. The toolchain sysroots are special in
> that the bootstrap one needs to refer to the non-bootstrap one via
> symlinks.
> 
> The path references you mention above should be detected by the sstate
> relocation code and fixed up automatically. It sounds like the search
> and replace expressions we're using aren't catching every reference we
> need to which is a different problem.

As a hint, I think:

SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f"

might need "Makefile" adding to that list of files to mangle...

Cheers,

Richard
Khem Raj - Nov. 30, 2011, 10 p.m.
On Tue, Nov 29, 2011 at 4:26 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> If the sstate files are installed into a sysroot from the sstate cache,
> the directory to the main sysroot can change and the symlinks aren't
> adjusted to account for this. This is a problem specific to the toolchain
> bootstrap process. This patch adds up a function to recreate the
> symlinks, hence ensuring they always point at the correct location.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/meta/recipes-core/eglibc/eglibc-initial.inc b/meta/recipes-core/eglibc/eglibc-initial.inc
> index 448f73a..9062516 100644
> --- a/meta/recipes-core/eglibc/eglibc-initial.inc
> +++ b/meta/recipes-core/eglibc/eglibc-initial.inc
> @@ -60,4 +60,16 @@ do_siteconfig () {
>        :
>  }
>
> +SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
> +eglibcinitial_sstate_postinst() {
> +       if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
> +       then
> +               # Recreate the symlinks to ensure they point to the correct location
> +               for t in linux asm asm-generic; do
> +                       rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
> +                       ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
> +               done
> +       fi
> +}
> +

you could do ln -sf here

Patch

diff --git a/meta/recipes-core/eglibc/eglibc-initial.inc b/meta/recipes-core/eglibc/eglibc-initial.inc
index 448f73a..9062516 100644
--- a/meta/recipes-core/eglibc/eglibc-initial.inc
+++ b/meta/recipes-core/eglibc/eglibc-initial.inc
@@ -60,4 +60,16 @@  do_siteconfig () {
 	:
 }
 
+SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
+eglibcinitial_sstate_postinst() {
+	if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
+	then
+		# Recreate the symlinks to ensure they point to the correct location
+		for t in linux asm asm-generic; do
+			rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
+			ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
+		done
+	fi
+}
+
 do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"