Patchwork [v2,5/6] SDK: relocate symlinks too

login
register
mail settings
Submitter Laurentiu Palcu
Date Sept. 20, 2012, 1:48 p.m.
Message ID <a10d0e1b4dc0667b04f1cfa906378ce9094449ae.1348148406.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/36977/
State Accepted
Commit 6e4923c0c9b218271fd44d78df9987b5cabb1c03
Headers show

Comments

Laurentiu Palcu - Sept. 20, 2012, 1:48 p.m.
The directory usr/libexec/ in the SDK sysroot contains the default
symlinks to the toolchain binaries and these, too, need to point to the
correct toolchain path.

[YOCTO #3090]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/populate_sdk_base.bbclass             |    5 +++++
 .../adt-installer/scripts/adt_installer_internal   |    5 +++++
 2 files changed, 10 insertions(+)
Richard Purdie - Sept. 21, 2012, 10:22 a.m.
On Thu, 2012-09-20 at 16:48 +0300, Laurentiu Palcu wrote:
> The directory usr/libexec/ in the SDK sysroot contains the default
> symlinks to the toolchain binaries and these, too, need to point to the
> correct toolchain path.
> 
> [YOCTO #3090]
> 
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>  meta/classes/populate_sdk_base.bbclass             |    5 +++++
>  .../adt-installer/scripts/adt_installer_internal   |    5 +++++
>  2 files changed, 10 insertions(+)

I've merged this since it definitely improves the situation but I am
left wondering if we shouldn't generate relative symlinks in the first
place for the toolchain...

Cheers,

Richard
Laurentiu Palcu - Sept. 21, 2012, 10:31 a.m.
On 09/21/2012 01:22 PM, Richard Purdie wrote:
> On Thu, 2012-09-20 at 16:48 +0300, Laurentiu Palcu wrote:
>> The directory usr/libexec/ in the SDK sysroot contains the default
>> symlinks to the toolchain binaries and these, too, need to point to the
>> correct toolchain path.
>>
>> [YOCTO #3090]
>>
>> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
>> ---
>>  meta/classes/populate_sdk_base.bbclass             |    5 +++++
>>  .../adt-installer/scripts/adt_installer_internal   |    5 +++++
>>  2 files changed, 10 insertions(+)
> 
> I've merged this since it definitely improves the situation but I am
> left wondering if we shouldn't generate relative symlinks in the first
> place for the toolchain...
I suppose we can do that too and leave this patch as a safety in case
absolute symlinks appear (by mistake) anywhere in the SDK rootfs. It's
up to you.

Thanks,
Laurentiu
> 
> Cheers,
> 
> Richard
> 
> 
>

Patch

diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index f20a6ac..52bae53 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -174,6 +174,11 @@  fi
 # replace ${SDKPATH} with the new prefix in all text files: configs/scripts/etc
 find $native_sysroot -type f -exec file '{}' \;|grep ":.*ASCII.*text"|cut -d':' -f1|xargs sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g"
 
+# change all symlinks pointing to ${SDKPATH}
+for l in $(find $native_sysroot -type l); do
+	ln -sf $(readlink $l|sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l
+done
+
 echo done
 
 # delete the relocating script, so that user is forced to re-run the installer
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
index fbcd2ce..63fcf60 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -215,6 +215,11 @@  $SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g" $env_setup_scr
 find $OECORE_NATIVE_SYSROOT -type f -exec file '{}' \;|grep ":.*ASCII.*text"|cut -d':' -f1|\
     xargs $SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g"
 
+# change all symlinks pointing to /opt/${DISTRO}/${SDK_VERSION}
+for l in $(find $NATIVE_INSTALL_DIR -type l); do
+	ln -sf $(readlink $l|sed -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:") $l
+done
+
 echo_info "\nSuccessfully installed selected native ADT!"
 }