Skip to contentSkip to conversation

SDK and adt_installer fixes

PATCH Superseded Laurentiu Palcu 2 participants 7 messages Sep 18, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover SDK and adt_installer fixes

Hi,

This patchset contains some SDK/adt-installer fixes.

Thanks,
Laurentiu

The following changes since commit 913944d904266bf90af0cad94b4f0fb3652bd29d:

upstream_tracking: update lsb and ltp (2012-09-14 17:12:52 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib lpalcu/adt_sdk_fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lpalcu/adt_sdk_fixes

Laurentiu Palcu (4):
adt-installer: fix package installation issue
SDK: fix installation into symlinked directories
adt-installer: ensure directory exists before copying/removing
SDK: remove references to Poky distro from tarball installer

 meta/classes/populate_sdk_base.bbclass             |   12 +++--
 .../installer/adt-installer/adt_installer          |    6 ++-
 .../adt-installer/scripts/adt_installer_internal   |   56 ++++++++++----------
 3 files changed, 42 insertions(+), 32 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 adt-installer: fix package installation issue

When the cross canadian toolchains are installed, for different architectures, they might contain common files. This leads to installation failures since the opkg, by default, does not overwrite files. This issue happens, for example, for binutils packages (that contain the same locale files) or gdb (which installs some syscalls xml files). The locale files could be removed from the binutils cross-canadian package but we cannot do the same for the syscalls GDB files which are used by GDB to display user friendly names for the syscall numbers. Hence, the best solution is to force opkg to overwrite these files.

[YOCTO #3109]

---
 .../adt-installer/scripts/adt_installer_internal   |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +1 -1
index 78ea6d0..f113aa4 100755
@@ -112,7 +112,7 @@ check_result
 
 #install below must sdk-host packages
 OPKG_INSTALL_CMD="$OPKG_CMD "
-OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD  -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install"
+OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD  --force-overwrite -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install"
 
 BASE_HOSTSDK_PKGNAMES="pseudo opkg pkgconfig libtool autoconf automake"
 for pkg in $BASE_HOSTSDK_PKGNAMES; do
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/4] adt-installer: fix package installation issue

Hi Laurentiu,

Why this is only an issue for installation to a directory other than the default e.g. /opt/poky ?

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Laurentiu Palcu
Sent: Tuesday, September 18, 2012 2:22 AM
To: [email protected]
Subject: [OE-core] [PATCH 1/4] adt-installer: fix package installation issue

When the cross canadian toolchains are installed, for different architectures, they might contain common files. This leads to installation failures since the opkg, by default, does not overwrite files. This issue happens, for example, for binutils packages (that contain the same locale files) or gdb (which installs some syscalls xml files). The locale files could be removed from the binutils cross-canadian package but we cannot do the same for the syscalls GDB files which are used by GDB to display user friendly names for the syscall numbers. Hence, the best solution is to force opkg to overwrite these files.

[YOCTO #3109]

---
 .../adt-installer/scripts/adt_installer_internal   |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installe renamed from meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +0 -0
index 78ea6d0..f113aa4 100755

+++ r_internal
@@ -112,7 +112,7 @@ check_result

#install below must sdk-host packages
OPKG_INSTALL_CMD="$OPKG_CMD "
-OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install" +OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD --force-overwrite -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install"

BASE_HOSTSDK_PKGNAMES="pseudo opkg pkgconfig libtool autoconf automake" for pkg in $BASE_HOSTSDK_PKGNAMES; do
--
1.7.9.5

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#3 lore raw

Re: [PATCH 1/4] adt-installer: fix package installation issue

Quoted 3 lines · Jessica

Hi Laurentiu,

Why this is only an issue for installation to a directory other than the default e.g. /opt/poky ?

Because of the internal opkg logic. Opkg keeps an internal database of all packages installed and the files that each package provides. By default all packages were built to install to /opt/poky/1.2+snapshot (I took this path as an example). When we provide an offline root directory (with -o option), let's assume it's /opt/poky/1.2+snapshot, all packages will be installed to /opt/poky/1.2+snapshot/opt/poky/1.2+snapshot. However, opkg will detect that the offline root matches the beginning of the files paths and will record the files without the first part: that is /opt/poky/1.2+snapshot/file instead of /opt/poky/1.2+snapshot/opt/poky/1.2+snapshot/file.

When another package is installed, opkg will look into its database and will try to see if the file to be installed in /opt/poky/1.2+snapshot/opt/poky/1.2+snapshot will overwrite any files in /opt/poky/1.2+snapshot. The answer is, of course, NO (since the paths are different) and the installation will go on.

On the other hand, if we choose another offline directory(different from the default one), let's say /my/test, the files in it's internal database will contain the entire paths: that is /my/test/opt/poky/1.2+snapshot.

When another package is installed to the same /my/test directory, opkg will now look into its database and see if the files to be installed in /my/test/opt/poky/1.2+snapshot overwrites any files in the same path. Since paths are now the same, installing two packages providing the same files will, of course, be detected and installation stopped.

I hope this answers your question,
Laurentiu

Quoted 42 lines

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Laurentiu Palcu
Sent: Tuesday, September 18, 2012 2:22 AM
To: [email protected]
Subject: [OE-core] [PATCH 1/4] adt-installer: fix package installation issue

When the cross canadian toolchains are installed, for different architectures, they might contain common files. This leads to installation failures since the opkg, by default, does not overwrite files. This issue happens, for example, for binutils packages (that contain the same locale files) or gdb (which installs some syscalls xml files). The locale files could be removed from the binutils cross-canadian package but we cannot do the same for the syscalls GDB files which are used by GDB to display user friendly names for the syscall numbers. Hence, the best solution is to force opkg to overwrite these files.

[YOCTO #3109]

---
 .../adt-installer/scripts/adt_installer_internal   |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installe renamed from meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +2 -2
index 78ea6d0..f113aa4 100755
+++ r_internal
@@ -112,7 +112,7 @@ check_result
 
 #install below must sdk-host packages
 OPKG_INSTALL_CMD="$OPKG_CMD "
-OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD  -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install"
+OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD  --force-overwrite -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install"
 
 BASE_HOSTSDK_PKGNAMES="pseudo opkg pkgconfig libtool autoconf automake"
 for pkg in $BASE_HOSTSDK_PKGNAMES; do
--

1.7.9.5

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#4 lore raw

PATCH 2/4 SDK: fix installation into symlinked directories

In reply to Laurentiu Palcu

The SDK installation scripts should not canonicalize symlinked directories because the entire relocation would be done to the directory to which the symlink points. Instead, if the installation is a symlink, use that path to relocate the binaries.

For example, if we have the following symlink: /opt/sdk -> ~/my/test/sdk the binaries will be relocated to /opt/sdk not ~/my/test/sdk as it is done now.

[YOCTO #3102]

---
 meta/classes/populate_sdk_base.bbclass             |    8 ++++++--
 .../installer/adt-installer/adt_installer          |    6 +++++-
 .../adt-installer/scripts/adt_installer_internal   |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)
meta/classes/populate_sdk_base.bbclass +6 -2
index 1c151d7..78669cf 100644
@@ -126,7 +126,11 @@ if [ "$target_sdk_dir" = "" ]; then
 fi
 
 eval target_sdk_dir=$target_sdk_dir
-target_sdk_dir=$(readlink -m $target_sdk_dir)
+if [ -d $target_sdk_dir ]; then
+	target_sdk_dir=$(cd $target_sdk_dir; pwd)
+else
+	target_sdk_dir=$(readlink -m $target_sdk_dir)
+fi
 
 echo -n "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
 read answer
@@ -154,7 +158,7 @@ echo "done"
 
 echo -n "Setting it up..."
 # fix environment paths
-env_setup_script=$(find $target_sdk_dir -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}")
+env_setup_script=$(find $target_sdk_dir/ -name "environment-setup-${REAL_MULTIMACH_TARGET_SYS}")
 sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i $env_setup_script
 
 # fix dynamic loader paths in all ELF SDK binaries
meta/recipes-devtools/installer/adt-installer/adt_installer +5 -1
index 2d252b7..0be5a1d 100755
@@ -340,7 +340,11 @@ if [ "$INSTALL_FOLDER" = "" ]; then
 fi
 
 eval INSTALL_FOLDER=$INSTALL_FOLDER
-export INSTALL_FOLDER=$(readlink -m $INSTALL_FOLDER)
+if [ -d $INSTALL_FOLDER ]; then
+	export INSTALL_FOLDER=$(cd $INSTALL_FOLDER; pwd)
+else
+	export INSTALL_FOLDER=$(readlink -m $INSTALL_FOLDER)
+fi
 
 clear
 
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +1 -1
index f113aa4..76acaa7 100755
@@ -207,7 +207,7 @@ $SUDO scripts/relocate_sdk_tmp.py $INSTALL_FOLDER $dl_path $executable_files
 check_result
 
 # replace /opt/${DISTRO}/${SDK_VERSION} with the install folder in all configs
-env_setup_script=$(find $NATIVE_INSTALL_DIR -name "environment-setup-*")
+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.*text"|cut -d':' -f1|\
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 3/4 adt-installer: ensure directory exists before copying/removing

In reply to Laurentiu Palcu

If the installation is done in a directory which already contains a valid installation, opkg will not install anything and the moving the contents of /install/dir/opt/poky/1.2 (for example) to /install/dir will throw some errors. However, the install directory will not be affected. This patch will ensure that the /install/dir/opt/poky/1.2 exists.

---
 .../adt-installer/scripts/adt_installer_internal   |   52 ++++++++++----------
 1 file changed, 27 insertions(+), 25 deletions(-)
meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal +27 -25
index 76acaa7..fbcd2ce 100755
@@ -158,31 +158,33 @@ fi
 # the entire directory structure. We could patch opkg to do that but it's far
 # simpler to do that here and achieve the same result.
 # This is done in two steps:
-# Step 1: copy ./opt/${DISTRO}/${SDK_VERSION} contents to $NATIVE_INSTALL_DIR.
-# We cannot use move if $NATIVE_INSTALL_DIR is not empty (for example: contains
-# another SDK)
-$SUDO cp -r $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/* $NATIVE_INSTALL_DIR
-
-# delete the source directory now
-$SUDO rm -rf $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/*
-
-# Step 2: Delete the ./opt/${DISTRO}/${SDK_VERSION} directories too, they should be empty
-dir=$NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER
-while [ "$dir" != "$NATIVE_INSTALL_DIR" ]; do
-    # if the user chose / as the install folder, then we should leave /opt in place
-    if [ "$dir" = "/opt" ]; then
-        break
-    fi
-
-    # try to delete the directory, only if it's empty
-    $SUDO rmdir $dir
-    if [ $? -ne 0 ]; then
-        break
-    fi
-
-    # go to the next directory
-    dir=$(dirname $dir)
-done
+if [ -d $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER ]; then
+    # Step 1: copy ./opt/${DISTRO}/${SDK_VERSION} contents to $NATIVE_INSTALL_DIR.
+    # We cannot use move if $NATIVE_INSTALL_DIR is not empty (for example: contains
+    # another SDK)
+    $SUDO cp -r $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/* $NATIVE_INSTALL_DIR
+
+    # delete the source directory now
+    $SUDO rm -rf $NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER/*
+
+    # Step 2: Delete the ./opt/${DISTRO}/${SDK_VERSION} directories too, they should be empty
+    dir=$NATIVE_INSTALL_DIR/$DEFAULT_INSTALL_FOLDER
+    while [ "$dir" != "$NATIVE_INSTALL_DIR" ]; do
+        # if the user chose / as the install folder, then we should leave /opt in place
+        if [ "$dir" = "/opt" ]; then
+            break
+        fi
+
+        # try to delete the directory, only if it's empty
+        $SUDO rmdir $dir
+        if [ $? -ne 0 ]; then
+            break
+        fi
+
+        # go to the next directory
+        dir=$(dirname $dir)
+    done
+fi
 
 # Link the ld.so.cache file into the hosts filesystem
 if [ ! -f "$OECORE_NATIVE_SYSROOT/etc/ld.so.cache" ]; then
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/4 SDK: remove references to Poky distro from tarball installer

In reply to Laurentiu Palcu

The installer should be generic.

---
 meta/classes/populate_sdk_base.bbclass |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/populate_sdk_base.bbclass +2 -2
index 78669cf..f20a6ac 100644
@@ -118,7 +118,7 @@ fakeroot create_shar() {
 
 DEFAULT_INSTALL_DIR="${SDKPATH}"
 
-echo -n "Enter target directory for Poky SDK (default: $DEFAULT_INSTALL_DIR): "
+echo -n "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): "
 read target_sdk_dir
 
 if [ "$target_sdk_dir" = "" ]; then
@@ -132,7 +132,7 @@ else
 	target_sdk_dir=$(readlink -m $target_sdk_dir)
 fi
 
-echo -n "You are about to install Poky SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
+echo -n "You are about to install the SDK to \"$target_sdk_dir\". Proceed[Y/n]?"
 read answer
 
 if [ "$answer" = "" ]; then
Signature · 1 line
1.7.9.5