common/hooks: fix pkg generation for 32bit and dbg pkgs

17efb6163a had a couple mistakes that were causing issues with the
generated dependencies for -32bit and -dbg packages because they are
~extra special~
This commit is contained in:
classabbyamp 2024-12-12 22:08:47 -05:00
parent 49402e9d2b
commit 46306a0f73
No known key found for this signature in database
GPG Key ID: 6BE0755918A4C7F5
2 changed files with 14 additions and 13 deletions

View File

@ -1,7 +1,7 @@
# This hook generates a XBPS binary package from an installed package in destdir.
genpkg() {
local pkgdir="$1" arch="$2" desc="$3" pkgver="$4" binpkg="$5"
local pkgdir="$1" arch="$2" desc="$3" pkgver="$4" binpkg="$5" suffix="${6:-}"
local _preserve _deps _shprovides _shrequires _gitrevs _provides _conflicts
local _replaces _reverts _mutable_files _conf_files f
local _pkglock="$pkgdir/${binpkg}.lock"
@ -34,14 +34,14 @@ genpkg() {
cd $pkgdir
_preserve=${preserve:+-p}
if [ -s ${XBPS_STATEDIR}/${pkgname}-rdeps ]; then
_deps="$(<${XBPS_STATEDIR}/${pkgname}-rdeps)"
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-rdeps ]; then
_deps="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-rdeps)"
fi
if [ -s ${XBPS_STATEDIR}/${pkgname}-shlib-provides ]; then
_shprovides="$(<${XBPS_STATEDIR}/${pkgname}-shlib-provides)"
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-provides ]; then
_shprovides="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-provides)"
fi
if [ -s ${XBPS_STATEDIR}/${pkgname}-shlib-requires ]; then
_shrequires="$(<${XBPS_STATEDIR}/${pkgname}-shlib-requires)"
if [ -s ${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-requires ]; then
_shrequires="$(<${XBPS_STATEDIR}/${pkgname}${suffix}-shlib-requires)"
fi
if [ -s ${XBPS_STATEDIR}/gitrev ]; then
_gitrevs="$(<${XBPS_STATEDIR}/gitrev)"
@ -142,7 +142,7 @@ hook() {
_desc="${short_desc} (debug files)"
binpkg=${_pkgver}.${arch}.xbps
PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}"
genpkg ${repo} ${arch} "${_desc}" ${_pkgver} ${binpkg}
genpkg ${repo} ${arch} "${_desc}" ${_pkgver} ${binpkg} -dbg
fi
# Generate 32bit pkg.
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
@ -161,6 +161,6 @@ hook() {
PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
[ -n "${_provides}" ] && export provides="${_provides}"
[ -n "${_replaces}" ] && export replaces="${_replaces}"
genpkg ${repo} x86_64 "${_desc}" ${_pkgver} ${binpkg}
genpkg ${repo} x86_64 "${_desc}" ${_pkgver} ${binpkg} -32bit
fi
}

View File

@ -6,7 +6,8 @@ collect_sonames() {
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
local _tmpfile=$(mktemp) || exit 1
local _mainpkg="$2"
local _mainpkg="${2:-}"
local _suffix="${3:-}"
local _shlib_dir="${XBPS_STATEDIR}/shlib-provides"
local _no_soname=$(mktemp) || exit 1
@ -50,8 +51,8 @@ collect_sonames() {
echo "$f" >> ${_tmpfile}
done
if [ -s "${_tmpfile}" ]; then
tr '\n' ' ' < "${_tmpfile}" > "${XBPS_STATEDIR}/${pkgname}-shlib-provides"
echo >> "${XBPS_STATEDIR}/${pkgname}-shlib-provides"
tr '\n' ' ' < "${_tmpfile}" > "${XBPS_STATEDIR}/${pkgname}${_suffix}-shlib-provides"
echo >> "${XBPS_STATEDIR}/${pkgname}${_suffix}-shlib-provides"
if [ "$_mainpkg" ]; then
cp "${_tmpfile}" "${_shlib_dir}/${pkgname}.soname"
fi
@ -84,5 +85,5 @@ hook() {
# native pkg
collect_sonames ${PKGDESTDIR} $_mainpkg
# 32bit pkg
collect_sonames ${_destdir32}
collect_sonames ${_destdir32} "" -32bit
}