rio: update to 0.2.0
[void-pkg.git] / common / hooks / post-pkg / 00-register-pkg.sh
blobb5392d8182f5c9f4ddc2683c096d9c6899d887ca
1 # This hook registers a XBPS binary package into the specified local repository.
3 registerpkg() {
4 local repo="$1" pkg="$2" arch="$3"
6 if [ ! -f ${repo}/${pkg} ]; then
7 msg_error "Nonexistent binary package ${repo}/${pkg}!\n"
8 fi
10 printf "%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg"
13 hook() {
14 local arch= binpkg= pkgdir=
16 if [ -n "$repository" ]; then
17 pkgdir=$XBPS_REPOSITORY/$repository
18 else
19 pkgdir=$XBPS_REPOSITORY
21 arch=$XBPS_TARGET_MACHINE
22 binpkg=${pkgver}.${arch}.xbps
23 binpkg32=${pkgname}-32bit-${version}_${revision}.x86_64.xbps
24 binpkg_dbg=${pkgname}-dbg-${version}_${revision}.${arch}.xbps
26 # Register binpkg.
27 if [ -f ${pkgdir}/${binpkg} ]; then
28 registerpkg ${pkgdir} ${binpkg}
31 # Register -dbg binpkg if it exists.
32 pkgdir=$XBPS_REPOSITORY/debug
33 PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}"
34 if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg_dbg} ]; then
35 registerpkg ${pkgdir} ${binpkg_dbg}
38 # Register 32bit binpkg if it exists.
39 if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
40 return
42 if [ -n "$repository" ]; then
43 pkgdir=$XBPS_REPOSITORY/multilib/$repository
44 else
45 pkgdir=$XBPS_REPOSITORY/multilib
47 PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
48 if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg32} ]; then
49 registerpkg ${pkgdir} ${binpkg32} x86_64