Improved check_linking script.

* fixed problem with ':' seperated paths
* verbose mode
This commit is contained in:
Christoph Niethammer 2011-03-31 10:47:31 +00:00
parent 062c35e6ed
commit b7c3af9346

View file

@ -9,15 +9,17 @@ declare -r APP_NAME="${0##*/}"
declare -r VERSION="0.1"
declare -r FILES_FILE=1_files.rr
declare -r BROKEN_FILE=2_broken.rr
declare findMask
declare MODULE_NAMES
declare SEARCH_DIRS
declare VERBOSE=0
declare findMask=
declare MODULE_NAMES=
declare SEARCH_DIRS=
# extract path information from module file
find_paths() {
local pathspec=$1
local PATHS=$( module display $MODULE_NAME |& awk "/.*path[[:space:]]+$pathspec[[:space:]]+/{ sub(/.*path[[:space:]]+$pathspec[[:space:]]+/,\"\"); print }" )
local PATHS=$( module display $MODULE_NAME 2>&1 | awk "/.*path[[:space:]]+$pathspec[[:space:]]+/{ sub(/.*path[[:space:]]+$pathspec[[:space:]]+/,\"\"); print }" )
PATHS=$(echo $PATHS | sed -e 's/:/ /g')
for path in $PATHS; do
SEARCH_DIRS+="$path "
done
@ -59,6 +61,9 @@ for arg in $@; do
print_usage
exit 0
;;
--verbose|-v)
VERBOSE=1
;;
*)
MODULE_NAMES+="${IFS}${arg}"
;;
@ -81,7 +86,13 @@ find ${SEARCH_DIRS[@]} $findMask -type f \( -perm -u+x -o -perm -g+x -o -perm -o
files=($(<"$FILES_FILE"))
for target_file in "${files[@]}"; do
if [ $VERBOSE = 1 ] ; then
echo -n "$target_file ..."
fi
if ! file $target_file | grep ELF > /dev/null ; then
if [ $VERBOSE = 1 ] ; then
echo " skipped"
fi
continue
fi
if [[ $target_file != *.la ]]; then
@ -98,8 +109,20 @@ for target_file in "${files[@]}"; do
if [[ $MISSING_LIBS ]]; then
echo "obj $target_file" >> "$BROKEN_FILE"
if [ $VERBOSE = 1 ] ; then
echo " broken (requires $MISSING_LIBS)"
else
echo " broken $target_file (requires $MISSING_LIBS)"
fi
else
if [ $VERBOSE = 1 ] ; then
echo " ok"
fi
fi
else
if [ $VERBOSE = 1 ] ; then
echo " skipped la file."
fi
fi
done