2014-03-01 12:37:55 +01:00
|
|
|
# This hook registers a XBPS binary package into the specified local repository.
|
|
|
|
|
2014-03-02 06:30:25 +01:00
|
|
|
registerpkg() {
|
2014-03-02 12:26:24 +01:00
|
|
|
local repo="$1" pkg="$2" arch="$3"
|
2014-03-02 06:30:25 +01:00
|
|
|
|
|
|
|
if [ ! -f ${repo}/${pkg} ]; then
|
|
|
|
msg_error "Unexistent binary package ${repo}/${pkg}!\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
msg_normal "Registering ${pkg} into ${repo} ...\n"
|
2015-02-08 18:12:34 +01:00
|
|
|
if [ -n "${arch}" ]; then
|
|
|
|
XBPS_TARGET_ARCH=${arch} $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${repo}/${pkg}
|
2014-03-02 06:30:25 +01:00
|
|
|
else
|
2015-02-08 18:12:34 +01:00
|
|
|
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
|
2014-03-02 06:30:25 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-01 12:37:55 +01:00
|
|
|
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
|
2014-04-28 15:08:44 +02:00
|
|
|
if [ -z "$noarch" -a -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then
|
2014-03-01 12:37:55 +01:00
|
|
|
arch=${XBPS_ARCH}
|
|
|
|
fi
|
2014-11-01 13:10:22 +01:00
|
|
|
if [ -n "$repository" ]; then
|
|
|
|
pkgdir=$XBPS_REPOSITORY/$repository
|
2014-03-01 12:37:55 +01:00
|
|
|
else
|
|
|
|
pkgdir=$XBPS_REPOSITORY
|
|
|
|
fi
|
2014-03-02 06:30:25 +01:00
|
|
|
binpkg=${pkgver}.${arch}.xbps
|
2014-03-06 21:03:23 +01:00
|
|
|
binpkg32=${pkgname}-32bit-${version}_${revision}.x86_64.xbps
|
2014-03-02 07:07:59 +01:00
|
|
|
binpkg_dbg=${pkgname}-dbg-${version}_${revision}.${arch}.xbps
|
2014-03-01 12:37:55 +01:00
|
|
|
|
2014-03-02 06:30:25 +01:00
|
|
|
# Register binpkg.
|
2014-03-02 07:07:59 +01:00
|
|
|
if [ -f ${pkgdir}/${binpkg} ]; then
|
|
|
|
registerpkg ${pkgdir} ${binpkg}
|
|
|
|
fi
|
2014-03-01 12:37:55 +01:00
|
|
|
|
2014-03-02 06:30:25 +01:00
|
|
|
# Register -dbg binpkg if it exists.
|
2014-05-05 10:59:33 +02:00
|
|
|
pkgdir=$XBPS_REPOSITORY/debug
|
|
|
|
PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}"
|
|
|
|
if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg_dbg} ]; then
|
2014-03-02 06:30:25 +01:00
|
|
|
registerpkg ${pkgdir} ${binpkg_dbg}
|
2014-03-01 12:37:55 +01:00
|
|
|
fi
|
2014-03-02 12:26:24 +01:00
|
|
|
|
|
|
|
# Register 32bit binpkg if it exists.
|
2014-03-07 10:12:20 +01:00
|
|
|
if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
|
|
|
|
return
|
|
|
|
fi
|
2014-11-01 13:10:22 +01:00
|
|
|
if [ -n "$repository" ]; then
|
|
|
|
pkgdir=$XBPS_REPOSITORY/multilib/$repository
|
2014-05-05 10:59:33 +02:00
|
|
|
else
|
|
|
|
pkgdir=$XBPS_REPOSITORY/multilib
|
|
|
|
fi
|
|
|
|
PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
|
|
|
|
if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg32} ]; then
|
2014-03-02 12:26:24 +01:00
|
|
|
registerpkg ${pkgdir} ${binpkg32} x86_64
|
|
|
|
fi
|
2014-03-01 12:37:55 +01:00
|
|
|
}
|