void-packages/common/hooks/post-pkg/00-register-pkg.sh
Juan RP ea719b3f59 Added multilib, multilib/nonfree and debug repositories by default.
- multilib: to store 32bit packages.
- multilib/nonfree: to store nonfree 32bit packages.
- debug: to store debug packages.
2014-05-05 10:59:33 +02:00

70 lines
1.8 KiB
Bash

# This hook registers a XBPS binary package into the specified local repository.
registerpkg() {
local repo="$1" pkg="$2" arch="$3"
if [ ! -f ${repo}/${pkg} ]; then
msg_error "Unexistent binary package ${repo}/${pkg}!\n"
fi
if [ -n "${arch}" ]; then
export XBPS_TARGET_ARCH=${arch}
fi
msg_normal "Registering ${pkg} into ${repo} ...\n"
if [ -n "$XBPS_CROSS_BUILD" ]; then
$XBPS_RINDEX_XCMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${repo}/${pkg}
else
$XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${repo}/${pkg}
fi
unset XBPS_TARGET_ARCH
}
hook() {
local arch= binpkg= pkgdir=
if [ -n "$noarch" ]; then
arch=noarch
elif [ -n "$XBPS_TARGET_MACHINE" ]; then
arch=$XBPS_TARGET_MACHINE
else
arch=$XBPS_MACHINE
fi
if [ -z "$noarch" -a -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then
arch=${XBPS_ARCH}
fi
if [ -n "$nonfree" ]; then
pkgdir=$XBPS_REPOSITORY/nonfree
else
pkgdir=$XBPS_REPOSITORY
fi
binpkg=${pkgver}.${arch}.xbps
binpkg32=${pkgname}-32bit-${version}_${revision}.x86_64.xbps
binpkg_dbg=${pkgname}-dbg-${version}_${revision}.${arch}.xbps
# Register binpkg.
if [ -f ${pkgdir}/${binpkg} ]; then
registerpkg ${pkgdir} ${binpkg}
fi
# Register -dbg binpkg if it exists.
pkgdir=$XBPS_REPOSITORY/debug
PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}"
if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg_dbg} ]; then
registerpkg ${pkgdir} ${binpkg_dbg}
fi
# Register 32bit binpkg if it exists.
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
return
fi
if [ -n "$nonfree" ]; then
pkgdir=$XBPS_REPOSITORY/multilib/nonfree
else
pkgdir=$XBPS_REPOSITORY/multilib
fi
PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg32} ]; then
registerpkg ${pkgdir} ${binpkg32} x86_64
fi
}