From c464b753d20798da8bd4df5f166c715c01429d08 Mon Sep 17 00:00:00 2001 From: Silvan Date: Sat, 12 Oct 2024 20:20:17 +0200 Subject: [PATCH] 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) --- plugins/pck-update.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 9a3c505..29c2e88 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -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\""