test: skip missing optional libraries in image install

Not all optional libraries might be available on developers machines,
so log and skip.
Also some pkg-config files are broken (eg: tss2 on Debian Stable) so
skip if the required variables are missing, and improve logs.
This commit is contained in:
Luca Boccassi 2021-01-14 16:48:13 +00:00
parent 5e8deb94c6
commit a9d34376e6

View file

@ -698,14 +698,25 @@ install_missing_libraries() {
# A number of dependencies is now optional via dlopen, so the install
# script will not pick them up, since it looks at linkage.
for lib in libcryptsetup libidn libidn2 pwquality libqrencode tss2-esys tss2-rc tss2-mu libfido2; do
if pkg-config --exists ${lib}; then
path=$(pkg-config --variable=libdir ${lib})
if ! [[ ${lib} =~ ^lib ]]; then
lib="lib${lib}"
fi
inst_libs "${path}/${lib}.so"
inst_library "${path}/${lib}.so"
fi
ddebug "Searching for $lib via pkg-config"
if pkg-config --exists ${lib}; then
path=$(pkg-config --variable=libdir ${lib})
if [ -z "${path}" ]; then
ddebug "$lib.pc does not contain a libdir variable, skipping"
continue
fi
if ! [[ ${lib} =~ ^lib ]]; then
lib="lib${lib}"
fi
# Some pkg-config files are broken and give out the wrong paths
# (eg: libcryptsetup), so just ignore them
inst_libs "${path}/${lib}.so" || true
inst_library "${path}/${lib}.so" || true
else
ddebug "$lib.pc not found, skipping"
continue
fi
done
}