void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

00-register-pkg.sh (1591B)


      1# This hook registers a XBPS binary package into the specified local repository.
      2
      3registerpkg() {
      4	local repo="$1" pkg="$2" arch="$3"
      5
      6	if [ ! -f ${repo}/${pkg} ]; then
      7		msg_error "Unexistent binary package ${repo}/${pkg}!\n"
      8	fi
      9
     10	printf "%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg"
     11}
     12
     13hook() {
     14	local arch= binpkg= pkgdir=
     15
     16	if [ -n "$XBPS_TARGET_MACHINE" ]; then
     17		arch=$XBPS_TARGET_MACHINE
     18	else
     19		arch=$XBPS_MACHINE
     20	fi
     21	if [ -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then
     22		arch=${XBPS_ARCH}
     23	fi
     24	if [ -n "$repository" ]; then
     25		pkgdir=$XBPS_REPOSITORY/$repository
     26	else
     27		pkgdir=$XBPS_REPOSITORY
     28	fi
     29	binpkg=${pkgver}.${arch}.xbps
     30	binpkg32=${pkgname}-32bit-${version}_${revision}.x86_64.xbps
     31	binpkg_dbg=${pkgname}-dbg-${version}_${revision}.${arch}.xbps
     32
     33	# Register binpkg.
     34	if [ -f ${pkgdir}/${binpkg} ]; then
     35		registerpkg ${pkgdir} ${binpkg}
     36	fi
     37
     38	# Register -dbg binpkg if it exists.
     39	pkgdir=$XBPS_REPOSITORY/debug
     40	PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}"
     41	if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg_dbg} ]; then
     42		registerpkg ${pkgdir} ${binpkg_dbg}
     43	fi
     44
     45	# Register 32bit binpkg if it exists.
     46	if [ "$XBPS_TARGET_MACHINE" != "i686" ]; then
     47		return
     48	fi
     49	if [ -n "$repository" ]; then
     50		pkgdir=$XBPS_REPOSITORY/multilib/$repository
     51	else
     52		pkgdir=$XBPS_REPOSITORY/multilib
     53	fi
     54	PKGDESTDIR="${XBPS_DESTDIR}/${pkgname}-32bit-${version}"
     55	if [ -d ${PKGDESTDIR} -a -f ${pkgdir}/${binpkg32} ]; then
     56		registerpkg ${pkgdir} ${binpkg32} x86_64
     57	fi
     58}