plugins/pck-update: autobuildreq: prefer solibs in libdir in case of multiple matches

(e.g. prefer /usr/lib64/libOpenCL.so.1 over /usr/lib64/cuda/libOpenCL.so.1)
This commit is contained in:
Silvan 2024-10-12 20:20:17 +02:00
parent 7f203b27b0
commit c464b753d2

View File

@ -2336,8 +2336,14 @@ build the list of the build requirements""${NORM}"
solibpath_catch=""
# is a shared library
# req="libGL.so.1(libc6)" => /usr/lib/libGL.so
reqpath=$($path_ldconfig -Np | \
reqpaths=$($path_ldconfig -Np | \
sed -n "s, ,,g;/${req/(*)/}/{s,.*=>,,;p}")
reqpath=""
for l in $reqpath; do
[ "${reqpath}" = "" ] && reqpath=$l
# Prefer solib in libdir path in case of multiple choices
[ "`dirname $l`" = "${libdir}" ] && { reqpath=$l; break; }
done
solibpath="${reqpath/\.so\.*/.so}"
notify.debug "\
req=\"$req\" ($reqpath) =?> solibpath=\"$solibpath\""