From 6472e83dbf9fc19b8c0f23c1cee87a9922d553ba Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 1 Mar 2014 12:37:55 +0100 Subject: [PATCH] common/hooks/post-pkg: need hook that registers a binpkg into the local repo. --- common/hooks/post-pkg/00-register-pkg.sh | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 common/hooks/post-pkg/00-register-pkg.sh diff --git a/common/hooks/post-pkg/00-register-pkg.sh b/common/hooks/post-pkg/00-register-pkg.sh new file mode 100644 index 00000000000..d02966e9a7c --- /dev/null +++ b/common/hooks/post-pkg/00-register-pkg.sh @@ -0,0 +1,34 @@ +# This hook registers a XBPS binary package into the specified local repository. + +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 -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then + arch=${XBPS_ARCH} + fi + binpkg=$pkgver.$arch.xbps + if [ -n "$nonfree" ]; then + pkgdir=$XBPS_REPOSITORY/nonfree + else + pkgdir=$XBPS_REPOSITORY + fi + + if [ ! -f ${pkgdir}/${binpkg} ]; then + msg_error "Unexistent binary package ${pkgdir}/${binpkg}!\n" + fi + + msg_normal "Registering ${binpkg} into ${pkgdir} ...\n" + + if [ -n "$XBPS_CROSS_BUILD" ]; then + $XBPS_RINDEX_XCMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${pkgdir}/${binpkg} + else + $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${pkgdir}/${binpkg} + fi +}