make/check_so_deps: Drop replace_defined_variables()
This function was recursively greping through the .mk file to map all ref variables $(...) to values they are set to. This was including plenty of duplicate entries which then had to be sorted|uniqed. Instead, and to avoid recurssion, import the entire .mk file into Bash's environment. The mapping would look like so: JSON_LIBS := json jsonrpc rpc DEPDIRS-event_vmd := event vmd conf $(JSON_LIBS) log thread | v JSON_LIBS="json jsonrpc rpc" JSON_LIBS() { echo $JSON_LIBS ; } event_vmd="event vmd conf $(JSON_LIBS) log thread" | v event_vmd="event vmd conf json jsonrpc rpc log thread" Change-Id: Ibfcd52438403cd7638e01d2d5642c08822f85106 Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4629 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
7deb562547
commit
4c859a6da5
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
if [ "$(uname -s)" = "FreeBSD" ]; then
|
if [ "$(uname -s)" = "FreeBSD" ]; then
|
||||||
echo "Not testing for shared object dependencies on FreeBSD."
|
echo "Not testing for shared object dependencies on FreeBSD."
|
||||||
@ -162,27 +163,21 @@ EOF
|
|||||||
echo "Processed $processed_so objects."
|
echo "Processed $processed_so objects."
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function is needed to properly evaluate the Make variables into actual dependencies.
|
function import_libs_deps_mk() {
|
||||||
function replace_defined_variables() {
|
local var_mk val_mk dep_mk fun_mk
|
||||||
local arr=("$@")
|
while read -r var_mk _ val_mk; do
|
||||||
local bad_values=()
|
if [[ $var_mk == "#"* || ! $var_mk =~ (DEPDIRS-|_DEPS|_LIBS) ]]; then
|
||||||
local good_values=()
|
continue
|
||||||
local new_values
|
|
||||||
for dep in "${arr[@]}"; do
|
|
||||||
if [[ $dep == *'$'* ]]; then
|
|
||||||
raw_dep=${dep/$\(/}
|
|
||||||
raw_dep=${raw_dep/\)/ }
|
|
||||||
bad_values+=("$raw_dep")
|
|
||||||
else
|
|
||||||
good_values+=("$dep")
|
|
||||||
fi
|
fi
|
||||||
done
|
var_mk=${var_mk#*-}
|
||||||
for dep in "${bad_values[@]}"; do
|
for dep_mk in $val_mk; do
|
||||||
dep_def_arr=($(grep -v "#" $libdeps_file | grep "${dep}" | cut -d "=" -f 2 | xargs))
|
fun_mk=${dep_mk//@('$('|')')/}
|
||||||
new_values=($(replace_defined_variables "${dep_def_arr[@]}"))
|
if [[ $fun_mk != "$dep_mk" ]]; then
|
||||||
good_values=("${good_values[@]}" "${new_values[@]}")
|
eval "${fun_mk}() { echo \$$fun_mk ; }"
|
||||||
done
|
fi
|
||||||
echo ${good_values[*]}
|
eval "$var_mk=\${$var_mk:+\$$var_mk }$dep_mk"
|
||||||
|
done
|
||||||
|
done < "$libdeps_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirm_deps() {
|
function confirm_deps() {
|
||||||
@ -191,10 +186,8 @@ function confirm_deps() {
|
|||||||
dep_names=()
|
dep_names=()
|
||||||
found_symbol_lib=""
|
found_symbol_lib=""
|
||||||
|
|
||||||
#keep the space here to differentiate bdev and bdev_*
|
lib_shortname=$(basename "$lib" | sed 's,libspdk_,,g' | sed 's,\.so,,g')
|
||||||
lib_shortname=$(basename $lib | sed 's,libspdk_,,g' | sed 's,\.so, ,g')
|
lib_make_deps=(${!lib_shortname})
|
||||||
lib_make_deps=($(grep "DEPDIRS-${lib_shortname}" $libdeps_file | cut -d "=" -f 2 | xargs))
|
|
||||||
lib_make_deps=($(replace_defined_variables "${lib_make_deps[@]}"))
|
|
||||||
|
|
||||||
for ign_dep in "${IGNORED_LIBS[@]}"; do
|
for ign_dep in "${IGNORED_LIBS[@]}"; do
|
||||||
for i in "${!lib_make_deps[@]}"; do
|
for i in "${!lib_make_deps[@]}"; do
|
||||||
@ -278,6 +271,7 @@ if grep -q 'CONFIG_RDMA?=n' $rootdir/mk/config.mk; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
|
import_libs_deps_mk
|
||||||
for lib in $SPDK_LIBS; do confirm_deps $lib & done
|
for lib in $SPDK_LIBS; do confirm_deps $lib & done
|
||||||
wait
|
wait
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user