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