aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2023-08-09 06:19:01 +0000
committerĐoàn Trần Công Danh <sgn.danh@gmail.com>2023-08-30 06:24:12 +0000
commit9ee583c6610d87f6a948bd10075b0a8b1cd44671 (patch)
tree0970aa9b6551b3b162315f31c9ca4c7f29e67417
parent6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9 (diff)
downloadvoid-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.tar
void-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.tar.gz
void-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.tar.bz2
void-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.tar.lz
void-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.tar.xz
void-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.tar.zst
void-packages-9ee583c6610d87f6a948bd10075b0a8b1cd44671.zip
hooks/gen-rt-deps: Look for rt-deps by subpkg first, common/shlibs later
-rw-r--r--common/hooks/pre-pkg/04-generate-runtime-deps.sh80
1 files changed, 29 insertions, 51 deletions
diff --git a/common/hooks/pre-pkg/04-generate-runtime-deps.sh b/common/hooks/pre-pkg/04-generate-runtime-deps.sh
index a291f2ccc87..e2020ce05f7 100644
--- a/common/hooks/pre-pkg/04-generate-runtime-deps.sh
+++ b/common/hooks/pre-pkg/04-generate-runtime-deps.sh
@@ -47,6 +47,7 @@ store_pkgdestdir_rundeps() {
hook() {
local depsftmp f lf j mapshlibs sorequires _curdep elfmagic broken_shlibs verify_deps
+ local _shlib_dir="${XBPS_STATEDIR}/shlib-provides"
# Disable trap on ERR, xbps-uhelper cmd might return error... but not something
# to be worried about because if there are broken shlibs this hook returns
@@ -95,65 +96,42 @@ hook() {
# above, the mapping is done thru the common/shlibs file.
#
for f in ${verify_deps}; do
- unset _f j rdep _rdep rdepcnt soname _pkgname _rdepver found
- _f=$(echo "$f"|sed -E 's|\+|\\+|g')
- rdep="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2)"
- rdepcnt="$(grep -E "^${_f}[[:blank:]]+.*$" $mapshlibs|cut -d ' ' -f2|wc -l)"
- if [ -z "$rdep" ]; then
+ unset _rdep _pkgname _rdepver
+
+ if [ "$(find ${PKGDESTDIR} -name "$f")" ]; then
# Ignore libs by current pkg
- soname=$(find ${PKGDESTDIR} -name "$f")
- if [ -z "$soname" ]; then
+ echo " SONAME: $f <-> $pkgname (ignored)"
+ continue
+ # If this library is provided by a subpkg of sourcepkg, use that subpkg
+ elif _pkgname="$(cd "$_shlib_dir" && grep -F -l -x "$f" *.soname 2>/dev/null)"; then
+ # If that library has SONAME, add it to shlibs-requires, too.
+ _pkgname=${_pkgname%.soname}
+ _sdep="${_pkgname}-${version}_${revision}"
+ sorequires+="${f} "
+ elif _pkgname="$(cd "$_shlib_dir" && grep -F -l -x "$f" *.nosoname 2>/dev/null)"; then
+ _pkgname=${_pkgname%.nosoname}
+ _sdep="${_pkgname}-${version}_${revision}"
+ else
+ _rdep="$(awk -v sl="$f" '$1 == sl { print $2; exit; }' "$mapshlibs")"
+
+ if [ -z "$_rdep" ]; then
msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
broken_shlibs=1
- else
- echo " SONAME: $f <-> $pkgname (ignored)"
- fi
- continue
- elif [ "$rdepcnt" -gt 1 ]; then
- unset j found
- # Check if shlib is provided by multiple pkgs.
- for j in ${rdep}; do
- _pkgname=$($XBPS_UHELPER_CMD getpkgname "$j")
- # if there's a SONAME matching pkgname, use it.
- for x in ${pkgname} ${subpackages}; do
- [[ $_pkgname == $x ]] && found=1 && break
- done
- [[ $found ]] && _rdep=$j && break
- done
- if [ -z "${_rdep}" ]; then
- # otherwise pick up the first one.
- for j in ${rdep}; do
- [ -z "${_rdep}" ] && _rdep=$j
- done
+ continue
fi
- else
- _rdep=$rdep
- fi
- _pkgname=$($XBPS_UHELPER_CMD getpkgname "${_rdep}" 2>/dev/null)
- _rdepver=$($XBPS_UHELPER_CMD getpkgversion "${_rdep}" 2>/dev/null)
- if [ -z "${_pkgname}" -o -z "${_rdepver}" ]; then
- msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
- broken_shlibs=1
- continue
- fi
- # Check if pkg is a subpkg of sourcepkg; if true, ignore version
- # in common/shlibs.
- _sdep="${_pkgname}>=${_rdepver}"
- for _subpkg in ${subpackages}; do
- if [ "${_subpkg}" = "${_pkgname}" ]; then
- _sdep="${_pkgname}-${version}_${revision}"
- break
+ _pkgname=$($XBPS_UHELPER_CMD getpkgname "${_rdep}" 2>/dev/null)
+ _rdepver=$($XBPS_UHELPER_CMD getpkgversion "${_rdep}" 2>/dev/null)
+ if [ -z "${_pkgname}" -o -z "${_rdepver}" ]; then
+ msg_red_nochroot " SONAME: $f <-> UNKNOWN PKG PLEASE FIX!\n"
+ broken_shlibs=1
+ continue
fi
- done
+ _sdep="${_pkgname}>=${_rdepver}"
- if [ "${_pkgname}" != "${pkgname}" ]; then
- echo " SONAME: $f <-> ${_sdep}"
+ # By this point, SONAME can't be found in current pkg
sorequires+="${f} "
- else
- # Ignore libs by current pkg
- echo " SONAME: $f <-> ${_rdep} (ignored)"
- continue
fi
+ echo " SONAME: $f <-> ${_sdep}"
add_rundep "${_sdep}"
done
#