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

@ -6,18 +6,20 @@
# #
declare -r APP_NAME="${0##*/}" declare -r APP_NAME="${0##*/}"
declare -r VERSION="0.1" declare -r VERSION="0.1"
declare -r FILES_FILE=1_files.rr declare -r FILES_FILE=1_files.rr
declare -r BROKEN_FILE=2_broken.rr declare -r BROKEN_FILE=2_broken.rr
declare findMask declare VERBOSE=0
declare MODULE_NAMES declare findMask=
declare SEARCH_DIRS declare MODULE_NAMES=
declare SEARCH_DIRS=
# extract path information from module file # extract path information from module file
find_paths() { find_paths() {
local pathspec=$1 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 for path in $PATHS; do
SEARCH_DIRS+="$path " SEARCH_DIRS+="$path "
done done
@ -59,6 +61,9 @@ for arg in $@; do
print_usage print_usage
exit 0 exit 0
;; ;;
--verbose|-v)
VERBOSE=1
;;
*) *)
MODULE_NAMES+="${IFS}${arg}" 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")) files=($(<"$FILES_FILE"))
for target_file in "${files[@]}"; do 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 ! file $target_file | grep ELF > /dev/null ; then
if [ $VERBOSE = 1 ] ; then
echo " skipped"
fi
continue continue
fi fi
if [[ $target_file != *.la ]]; then if [[ $target_file != *.la ]]; then
@ -98,7 +109,19 @@ for target_file in "${files[@]}"; do
if [[ $MISSING_LIBS ]]; then if [[ $MISSING_LIBS ]]; then
echo "obj $target_file" >> "$BROKEN_FILE" echo "obj $target_file" >> "$BROKEN_FILE"
echo " broken $target_file (requires $MISSING_LIBS)" 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
fi fi
done done