comon/hooks: update pkg hooks to also create/register -dbg pkgs.

This commit is contained in:
Juan RP 2014-03-02 06:30:25 +01:00
parent 0acd78cd00
commit b3200722ef
2 changed files with 38 additions and 11 deletions

View File

@ -1,5 +1,21 @@
# This hook registers a XBPS binary package into the specified local repository. # This hook registers a XBPS binary package into the specified local repository.
registerpkg() {
local repo="$1" pkg="$2"
if [ ! -f ${repo}/${pkg} ]; then
msg_error "Unexistent binary package ${repo}/${pkg}!\n"
fi
msg_normal "Registering ${pkg} into ${repo} ...\n"
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
}
hook() { hook() {
local arch= binpkg= pkgdir= local arch= binpkg= pkgdir=
@ -13,22 +29,19 @@ hook() {
if [ -z "$noarch" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then if [ -z "$noarch" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then
arch=${XBPS_ARCH} arch=${XBPS_ARCH}
fi fi
binpkg=$pkgver.$arch.xbps
if [ -n "$nonfree" ]; then if [ -n "$nonfree" ]; then
pkgdir=$XBPS_REPOSITORY/nonfree pkgdir=$XBPS_REPOSITORY/nonfree
else else
pkgdir=$XBPS_REPOSITORY pkgdir=$XBPS_REPOSITORY
fi fi
binpkg=${pkgver}.${arch}.xbps
binpkg_dbg=${pkgver}-dbg.${arch}.xbps
if [ ! -f ${pkgdir}/${binpkg} ]; then # Register binpkg.
msg_error "Unexistent binary package ${pkgdir}/${binpkg}!\n" registerpkg $pkgdir $binpkg
fi
msg_normal "Registering ${binpkg} into ${pkgdir} ...\n" # Register -dbg binpkg if it exists.
if [ -f ${pkgdir}/${binpkg_dbg} ]; then
if [ -n "$XBPS_CROSS_BUILD" ]; then registerpkg ${pkgdir} ${binpkg_dbg}
$XBPS_RINDEX_XCMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${pkgdir}/${binpkg}
else
$XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${pkgdir}/${binpkg}
fi fi
} }

View File

@ -1,6 +1,6 @@
# This hook generates a XBPS binary package from an installed package in destdir. # This hook generates a XBPS binary package from an installed package in destdir.
hook() { genpkg() {
local binpkg= pkgdir= arch= _deps= f= local binpkg= pkgdir= arch= _deps= f=
if [ ! -d "${PKGDESTDIR}" ]; then if [ ! -d "${PKGDESTDIR}" ]; then
@ -124,3 +124,17 @@ hook() {
msg_normal "Created binary package successfully: ${binpkg}\n" msg_normal "Created binary package successfully: ${binpkg}\n"
} }
hook() {
genpkg
# Generate -dbg pkg.
if [ -d "$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${pkgname}-dbg-${version}" ]; then
reset_subpkg_vars
pkgname="${pkgname}-dbg"
pkgver="${pkgname}-${version}_${revision}"
short_desc+=" (debug files)"
PKGDESTDIR="$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${pkgname}-${version}"
genpkg
fi
}