Skip to contentSkip to conversation

adt-installer: fix sdk relocation issues

PATCH New Hongxu Jia 1 participant 4 messages Jun 26, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover adt-installer: fix sdk relocation issues

Some of them have already been fixed in toolchain:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=aeb53bd78991af9fbb60d64176ec864cfc2ddbb9
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=5ce8c7fe9ebb8dca0a0b091bda9c58141da26216

//Hongxu

The following changes since commit 8e9501ffa8726d69412d669580d787ffedb88d34:

populate_sdk_base, adt_installer: abort install if path contains spaces (2013-06-25 17:59:17 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-adt
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-adt

Hongxu Jia (3):
adt_installer_internal: fix perl modules relocated failed on older
distributions
adt_installer_internal:fix perl lib version mismatch adt_installer_internal:add sudo when permission deny on installation
directory

 .../adt-installer/scripts/adt_installer_internal          | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/3 adt_installer_internal: fix perl modules relocated failed on older distributions

The perl module for automake has an embedded path in it, this needs to be relocated.

Older versions of 'file' do not return the "ASCII" text in the output for a perl module file. Hence, the regex pattern didn't match perl module and they were not getting relocated at all on older distributions.

1) On CentOS release 6.4, the version of file is 5.04

$ file /usr/lib/perl5/Config_heavy.pl
$ /usr/lib/perl5/Config_heavy.pl: Perl5 module source text

2) On Ubuntu 13.04, the version of file is 5.11

$ file /usr/lib/perl/5.14/Config_heavy.pl
$ /usr/lib/perl/5.14/Config_heavy.pl: C source, ASCII text, with very long lines

[YOCTO #4550]

---
 .../installer/adt-installer/scripts/adt_installer_internal            | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +2 -2
index 4322964..25c955a 100755
@@ -212,8 +212,8 @@ check_result
 env_setup_script=$(find $NATIVE_INSTALL_DIR/ -name "environment-setup-*")
 $SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g" $env_setup_script
 
-find $OECORE_NATIVE_SYSROOT -type f -exec file '{}' \;|grep ":.*\(ASCII\|script\).*text"|cut -d':' -f1|\
-    xargs $SUDO sed -i -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:g"
+find $OECORE_NATIVE_SYSROOT -type f -exec file '{}' \; | grep ":.*\(ASCII\|script\|source\).*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
Signature · 1 line
1.8.1.2
author
#2 lore raw

PATCH 2/3 adt_installer_internal:fix perl lib version mismatch

In reply to Hongxu Jia

When run "autoreconf" in toolchain, there is an error if the host's perl's version is not the same as the one in the SDK, the error says that the executable perl mismatches the perl lib's version.

This is because most of the autotools' scripts use the "#!/usr/bin/perl -w" which is host perl, but the gnu-configize uses "#! /usr/bin/env perl" which invokes the perl wrapper in the SDK, and the wrapper will set the PERL5LIB to the SDK which causes the mismatch. We can make all the perl scripts to use the host perl or the SDK perl to fix this problem.

[YOCTO #4758]

---
 .../installer/adt-installer/scripts/adt_installer_internal         | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +7 -0
index 25c955a..16677e7 100755
@@ -220,6 +220,13 @@ for l in $(find $NATIVE_INSTALL_DIR -type l); do
     $SUDO ln -sfn $(readlink $l|sed -e "s:$DEFAULT_INSTALL_FOLDER:$NATIVE_INSTALL_DIR:") $l
 done
 
+# find out all perl scripts in $OECORE_NATIVE_SYSROOT and modify them
+# replacing the host perl with SDK perl.
+for perl_script in $($SUDO grep -m 1 "^#!.*perl" -rl $OECORE_NATIVE_SYSROOT); do
+    $SUDO sed -i -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" -e \
+        "s: /usr/bin/perl: /usr/bin/env perl:g" $perl_script
+done
+
 echo_info "\nSuccessfully installed selected native ADT!"
 }
 
Signature · 1 line
1.8.1.2
author
#3 lore raw

PATCH 3/3 adt_installer_internal:add sudo when permission deny on installation directory

In reply to Hongxu Jia

When the user doesn't have rights to access the installation directory, the sdk installation will fail, add sudo to fix this.

[YOCTO #4760]

---
 .../installer/adt-installer/scripts/adt_installer_internal            | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +2 -2
index 16677e7..175d285 100755
@@ -199,7 +199,7 @@ escaped_sdkpath=$(echo $DEFAULT_INSTALL_FOLDER |sed -e "s:[\+\.]:\\\\\\\\\0:g")
 
 # We don't change the script in-place since we may want the user to re-run
 # adt-installer script
-$SUDO sed -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" scripts/relocate_sdk.py > scripts/relocate_sdk_tmp.py
+$SUDO sh -c "sed -e '"s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:"' scripts/relocate_sdk.py > scripts/relocate_sdk_tmp.py"
 $SUDO chmod +x scripts/relocate_sdk_tmp.py
 
 dl_path=$(find $OECORE_NATIVE_SYSROOT/lib -name "ld-linux*")
@@ -258,7 +258,7 @@ qemu_type=`echo "$1" | sed -e 's/x86_64/x86-64/'`
 sysroot_image_name="core-image-$target_sysroot_image-qemu$qemu_type.tar.bz2"
     #echo_info "Extracting rootfs: $sysroot_image_name, using pseudo..."
 
-scripts/extract_rootfs $sysroot_image_name $target_sysroot $OECORE_NATIVE_SYSROOT $user_inst_type
+$SUDO scripts/extract_rootfs $sysroot_image_name $target_sysroot $OECORE_NATIVE_SYSROOT $user_inst_type
 check_result
 
 echo_info "Updating environment script with target sysroot location."
Signature · 1 line
1.8.1.2