Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: fix get_xx_lib funcs in pack_common.sh #210

Merged
merged 2 commits into from
Nov 7, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions scripts/pack_common.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ function get_stdcpp_lib()
libname=`echo $libname | cut -f1 -d" "`
if [ $1 = "true" ]; then
gcc_path=`which gcc`
echo `dirname $gcc_path`/../lib64/$libname
echo `dirname $gcc_path`/../lib64/$libname #TODO need fix
else
echo `ldconfig -p|grep $libname|awk '{print $NF}'`
libs=(`ldconfig -p|grep $libname|awk '{print $NF}'`)

for lib in ${libs[*]}; do
if [ "`check_bit $lib`" = "true" ]; then
echo "$lib"
return
fi
done;
fi
}

Expand All @@ -28,7 +35,15 @@ function get_system_lib()
{
libname=`ldd ./DSN_ROOT/bin/pegasus_$1/pegasus_$1 2>/dev/null | grep "lib${2}\.so"`
libname=`echo $libname | cut -f1 -d" "`
echo `ldconfig -p|grep $libname|awk '{print $NF}'`
libs=(`ldconfig -p|grep $libname|awk '{print $NF}'`)

bit_mode=`getconf LONG_BIT`
for lib in ${libs[*]}; do
if [ "`check_bit $lib`" = "true" ]; then
echo "$lib"
return
fi
done;
}

#USAGE: copy_file src [src...] dest
Expand All @@ -45,3 +60,23 @@ function copy_file()
fi
}

function check_bit()
{
bit_mode=`getconf LONG_BIT`
lib=$1
check_bit=""
is_softlink=`file $lib | grep "symbolic link"`

if [ -z "$is_softlink" ]; then
check_bit=`file $lib |grep "$bit_mode-bit"`
else
real_lib_name=`ls -l $lib |awk '{print $NF}'`
lib_path=${lib%/*}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里面包含了tab符号?都用空格吧

real_lib=${lib_path}"/"${real_lib_name}
check_bit=`file $real_lib |grep "$bit_mode-bit"`
fi
if [ -n "$check_bit" ]; then
echo "true"
fi
}