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
|
|
|
|
|
2018-09-06 08:30:21 +00:00
|
|
|
printf "%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg"
|
2014-03-02 05:30:25 +00:00
|
|
|
}
|
|
|
|
|
2014-03-01 11:37:55 +00:00
|
|
|
hook() {
|
|
|
|
local arch= binpkg= pkgdir=
|
|
|
|
|
2015-12-03 09:04:16 +00:00
|
|
|
if [ "${archs// /}" = "noarch" ]; then
|
2014-03-01 11:37:55 +00:00
|
|
|
arch=noarch
|
|
|
|
elif [ -n "$XBPS_TARGET_MACHINE" ]; then
|
|
|
|
arch=$XBPS_TARGET_MACHINE
|
|
|
|
else
|
|
|
|
arch=$XBPS_MACHINE
|
|
|
|
fi
|
2015-12-03 09:04:16 +00:00
|
|
|
if [ "${archs// /}" != "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
|
|
|
}
|