mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 15:49:32 +02:00
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. (From OE-Core rev: 0a5bbad5810b69fa09dbd8d886e4f368310a5db9) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
15f78b0ff3
commit
f51f28b7b9
@@ -4,7 +4,8 @@
|
|||||||
# Copyright (C) 2004 by the Icecream Authors
|
# Copyright (C) 2004 by the Icecream Authors
|
||||||
# GPL
|
# GPL
|
||||||
|
|
||||||
target_files=
|
target_paths=
|
||||||
|
target_aliases=
|
||||||
|
|
||||||
is_dynamic_elf ()
|
is_dynamic_elf ()
|
||||||
{
|
{
|
||||||
@@ -32,15 +33,33 @@ fix_rpath ()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
is_contained ()
|
add_path ()
|
||||||
{
|
{
|
||||||
case " $target_files " in
|
case " $target_paths " in
|
||||||
*" $1 "* ) return 0 ;;
|
*" $1 "*)
|
||||||
*"=$1 "* ) return 0;;
|
return 1
|
||||||
* ) return 1 ;;
|
;;
|
||||||
|
*)
|
||||||
|
target_paths="$target_paths $1"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
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 ()
|
normalize_path ()
|
||||||
{
|
{
|
||||||
# Normalizes the path to a file or directory, removing all "." and ".."
|
# Normalizes the path to a file or directory, removing all "." and ".."
|
||||||
@@ -61,20 +80,17 @@ normalize_path ()
|
|||||||
|
|
||||||
add_file ()
|
add_file ()
|
||||||
{
|
{
|
||||||
local path=`normalize_path $1`
|
local p=`normalize_path $1`
|
||||||
local name="$path"
|
|
||||||
if test -n "$2"; then
|
|
||||||
name="$2"
|
|
||||||
fi
|
|
||||||
test -z "$name" && return
|
|
||||||
# readlink is required for Yocto, so we can use it
|
# readlink is required for Yocto, so we can use it
|
||||||
path=`readlink -f "$path"`
|
local path=`readlink -f "$p"`
|
||||||
toadd="$name=$path"
|
|
||||||
is_contained "$toadd" && return
|
add_alias "$path" "$p"
|
||||||
if test -z "$silent"; then
|
if test -n "$2"; then
|
||||||
echo "adding file $toadd"
|
add_alias "$path" "$2"
|
||||||
fi
|
fi
|
||||||
target_files="$target_files $toadd"
|
|
||||||
|
add_path "$path" || return
|
||||||
|
|
||||||
if test -x "$path"; then
|
if test -x "$path"; then
|
||||||
# Only call ldd when it makes sense
|
# Only call ldd when it makes sense
|
||||||
if is_dynamic_elf "$path"; then
|
if is_dynamic_elf "$path"; then
|
||||||
@@ -208,52 +224,34 @@ link_rel ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
|
tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
|
||||||
new_target_files=
|
target_files=
|
||||||
for i in $target_files; do
|
for path in $target_paths; do
|
||||||
case $i in
|
mkdir -p $tempdir/`dirname $path`
|
||||||
*=/*)
|
cp -pH $path $tempdir/$path
|
||||||
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
|
if test -f $tempdir/$path -a -x $tempdir/$path; then
|
||||||
strip -s $tempdir/$target 2>/dev/null
|
strip -s $tempdir/$path 2>/dev/null
|
||||||
fi
|
|
||||||
|
|
||||||
fix_rpath $tempdir/$target `dirname $target`
|
|
||||||
else
|
|
||||||
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
|
|
||||||
|
|
||||||
fix_rpath $tempdir/$path `dirname $path`
|
|
||||||
|
|
||||||
path=`echo $path | cut -b2-`
|
|
||||||
new_target_files="$new_target_files $path"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
target=`echo $target | cut -b2-`
|
fix_rpath $tempdir/$path `dirname $path`
|
||||||
new_target_files="$new_target_files $target"
|
target_files="$target_files $path"
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $target_aliases; do
|
||||||
|
target=`echo $i | cut -d= -f1`
|
||||||
|
link_name=`echo $i | cut -d= -f2`
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
link_name=`echo $link_name | cut -b2-`
|
||||||
|
target_files="$target_files $link_name"
|
||||||
done
|
done
|
||||||
|
|
||||||
#sort the files
|
#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
|
#test if an archive name was supplied
|
||||||
#if not use the md5 of all files as the archive name
|
#if not use the md5 of all files as the archive name
|
||||||
|
|||||||
Reference in New Issue
Block a user