summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-02-12 10:52:06 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-15 13:20:27 +0000
commit0a5bbad5810b69fa09dbd8d886e4f368310a5db9 (patch)
tree84c99fe26c5d2c6deacef9a7a298c5337f2309ce
parentfa7929ed70ed39a202bd2dc935d460dd57e38ffd (diff)
downloadopenembedded-core-0a5bbad5810b69fa09dbd8d886e4f368310a5db9.tar.gz
openembedded-core-0a5bbad5810b69fa09dbd8d886e4f368310a5db9.tar.bz2
openembedded-core-0a5bbad5810b69fa09dbd8d886e4f368310a5db9.zip
icecc-create-env: Allow multiple tool aliases
When files are added to the environment, multiple aliases can be given for the file (by calling add_path multiple times with a second argument). All of these names will end up with a symlink to the original file. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xmeta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env110
1 files changed, 54 insertions, 56 deletions
diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 90d249df9f..537e38a9ba 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -4,7 +4,8 @@
# Copyright (C) 2004 by the Icecream Authors
# GPL
-target_files=
+target_paths=
+target_aliases=
is_dynamic_elf ()
{
@@ -32,15 +33,33 @@ fix_rpath ()
fi
}
-is_contained ()
+add_path ()
{
- case " $target_files " in
- *" $1 "* ) return 0 ;;
- *"=$1 "* ) return 0;;
- * ) return 1 ;;
+ case " $target_paths " in
+ *" $1 "*)
+ return 1
+ ;;
+ *)
+ target_paths="$target_paths $1"
+ return 0
+ ;;
esac
}
+add_alias ()
+{
+ if test "$1" != "$2"; then
+ local alias="$1=$2"
+ case " $target_aliases " in
+ *" $alias "*)
+ ;;
+ *)
+ target_aliases="$target_aliases $alias"
+ ;;
+ esac
+ fi
+}
+
normalize_path ()
{
# Normalizes the path to a file or directory, removing all "." and ".."
@@ -61,20 +80,17 @@ normalize_path ()
add_file ()
{
- local path=`normalize_path $1`
- local name="$path"
- if test -n "$2"; then
- name="$2"
- fi
- test -z "$name" && return
+ local p=`normalize_path $1`
# readlink is required for Yocto, so we can use it
- path=`readlink -f "$path"`
- toadd="$name=$path"
- is_contained "$toadd" && return
- if test -z "$silent"; then
- echo "adding file $toadd"
+ local path=`readlink -f "$p"`
+
+ add_alias "$path" "$p"
+ if test -n "$2"; then
+ add_alias "$path" "$2"
fi
- target_files="$target_files $toadd"
+
+ add_path "$path" || return
+
if test -x "$path"; then
# Only call ldd when it makes sense
if is_dynamic_elf "$path"; then
@@ -208,52 +224,34 @@ link_rel ()
}
tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
-new_target_files=
-for i in $target_files; do
- case $i in
- *=/*)
- target=`echo $i | cut -d= -f1`
- path=`echo $i | cut -d= -f2`
- ;;
- *)
- path=$i
- target=$i
- ;;
- esac
- if test "$target" == "$path"; then
- mkdir -p $tempdir/`dirname $target`
- cp -pH $target $tempdir/$target
-
- if test -f $tempdir/$target -a -x $tempdir/$target; then
- strip -s $tempdir/$target 2>/dev/null
- fi
-
- fix_rpath $tempdir/$target `dirname $target`
- else
- mkdir -p $tempdir/`dirname $path`
- cp -pH $path $tempdir/$path
+target_files=
+for path in $target_paths; do
+ mkdir -p $tempdir/`dirname $path`
+ cp -pH $path $tempdir/$path
- mkdir -p $tempdir/`dirname $target`
- # Relative links are used because the files are checked for being
- # executable outside the chroot
- link_rel $path $target $tempdir
+ if test -f $tempdir/$path -a -x $tempdir/$path; then
+ strip -s $tempdir/$path 2>/dev/null
+ fi
- if test -f $tempdir/$path -a -x $tempdir/$path; then
- strip -s $tempdir/$path 2>/dev/null
- fi
+ fix_rpath $tempdir/$path `dirname $path`
+ target_files="$target_files $path"
+done
- fix_rpath $tempdir/$path `dirname $path`
+for i in $target_aliases; do
+ target=`echo $i | cut -d= -f1`
+ link_name=`echo $i | cut -d= -f2`
- path=`echo $path | cut -b2-`
- new_target_files="$new_target_files $path"
- fi
+ mkdir -p $tempdir/`dirname $link_name`
+ # Relative links are used because the files are checked for being
+ # executable outside the chroot
+ link_rel $target $link_name $tempdir
- target=`echo $target | cut -b2-`
- new_target_files="$new_target_files $target"
+ link_name=`echo $link_name | cut -b2-`
+ target_files="$target_files $link_name"
done
#sort the files
-target_files=`for i in $new_target_files; do echo $i; done | sort`
+target_files=`for i in $target_files; do echo $i; done | sort`
#test if an archive name was supplied
#if not use the md5 of all files as the archive name