common/hooks/*-pkg: misc tweaks for proper -dbg {creat,registrat}ion.

This commit is contained in:
Juan RP 2014-03-02 07:07:59 +01:00
parent b3200722ef
commit 370c2aaf3c
2 changed files with 37 additions and 32 deletions

View file

@ -35,10 +35,12 @@ hook() {
pkgdir=$XBPS_REPOSITORY pkgdir=$XBPS_REPOSITORY
fi fi
binpkg=${pkgver}.${arch}.xbps binpkg=${pkgver}.${arch}.xbps
binpkg_dbg=${pkgver}-dbg.${arch}.xbps binpkg_dbg=${pkgname}-dbg-${version}_${revision}.${arch}.xbps
# Register binpkg. # Register binpkg.
registerpkg $pkgdir $binpkg if [ -f ${pkgdir}/${binpkg} ]; then
registerpkg ${pkgdir} ${binpkg}
fi
# Register -dbg binpkg if it exists. # Register -dbg binpkg if it exists.
if [ -f ${pkgdir}/${binpkg_dbg} ]; then if [ -f ${pkgdir}/${binpkg_dbg} ]; then

View file

@ -1,40 +1,23 @@
# 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.
genpkg() { genpkg() {
local binpkg= pkgdir= arch= _deps= f= local pkgdir="$1" arch="$2" desc="$3" pkgver="$4" binpkg="$5" _deps= f=
if [ ! -d "${PKGDESTDIR}" ]; then if [ ! -d "${PKGDESTDIR}" ]; then
msg_warn "$pkgver: cannot find pkg destdir... skipping!\n" msg_warn "$pkgver: cannot find pkg destdir... skipping!\n"
return 0 return 0
fi fi
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
[ ! -d $pkgdir ] && mkdir -p $pkgdir [ ! -d $pkgdir ] && mkdir -p $pkgdir
while [ -f $pkgdir/${binpkg}.lock ]; do while [ -f $pkgdir/${binpkg}.lock ]; do
msg_warn "$pkgver: binpkg is being created, waiting for 1s...\n" msg_warn "${pkgver}: binpkg is being created, waiting for 1s...\n"
sleep 1 sleep 1
done done
# Don't overwrite existing binpkgs by default, skip them. # Don't overwrite existing binpkgs by default, skip them.
if [ -f $pkgdir/$binpkg -a -z "$XBPS_BUILD_FORCEMODE" ]; then if [ -f $pkgdir/$binpkg -a -z "$XBPS_BUILD_FORCEMODE" ]; then
msg_normal "$pkgver: skipping existing $binpkg pkg...\n" msg_normal "${pkgver}: skipping existing $binpkg pkg...\n"
return 0 return 0
fi fi
@ -89,7 +72,7 @@ genpkg() {
done done
fi fi
msg_normal "$pkgver: creating $binpkg for repository $pkgdir ...\n" msg_normal "$sourcepkg: creating $binpkg for repository $pkgdir ...\n"
# #
# Create the XBPS binary package. # Create the XBPS binary package.
@ -105,7 +88,7 @@ genpkg() {
--homepage "${homepage}" \ --homepage "${homepage}" \
--license "${license}" \ --license "${license}" \
--maintainer "${maintainer}" \ --maintainer "${maintainer}" \
--long-desc "${long_desc}" --desc "${short_desc}" \ --desc "${desc}" \
--built-with "xbps-src-${XBPS_SRC_VERSION}" \ --built-with "xbps-src-${XBPS_SRC_VERSION}" \
--build-options "${PKG_BUILD_OPTIONS}" \ --build-options "${PKG_BUILD_OPTIONS}" \
--pkgver "${pkgver}" --quiet \ --pkgver "${pkgver}" --quiet \
@ -126,15 +109,35 @@ genpkg() {
} }
hook() { hook() {
genpkg local arch= binpkg= repo= _pkgver= _desc=
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
repo=$XBPS_REPOSITORY/nonfree
else
repo=$XBPS_REPOSITORY
fi
genpkg ${repo} ${arch} "${short_desc}" ${pkgver} ${binpkg}
# Generate -dbg pkg. # Generate -dbg pkg.
if [ -d "$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${pkgname}-dbg-${version}" ]; then if [ -d "${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}" ]; then
reset_subpkg_vars _pkgver=${pkgname}-dbg-${version}_${revision}
pkgname="${pkgname}-dbg" _desc="${short_desc} (debug files)"
pkgver="${pkgname}-${version}_${revision}" binpkg=${_pkgver}.${arch}.xbps
short_desc+=" (debug files)" PKGDESTDIR="${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-dbg-${version}"
PKGDESTDIR="$XBPS_DESTDIR/$XBPS_CROSS_TRIPLET/${pkgname}-${version}" genpkg ${repo} ${arch} "${_desc}" ${_pkgver} ${binpkg}
genpkg
fi fi
} }