From b3200722ef00b388e8bf51b7d029b73ca603ac43 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 2 Mar 2014 06:30:25 +0100 Subject: [PATCH] comon/hooks: update pkg hooks to also create/register -dbg pkgs. --- common/hooks/post-pkg/00-register-pkg.sh | 33 +++++++++++++++++------- common/hooks/pre-pkg/00-gen-pkg.sh | 16 +++++++++++- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/common/hooks/post-pkg/00-register-pkg.sh b/common/hooks/post-pkg/00-register-pkg.sh index d02966e9a7..0553c5a19c 100644 --- a/common/hooks/post-pkg/00-register-pkg.sh +++ b/common/hooks/post-pkg/00-register-pkg.sh @@ -1,5 +1,21 @@ # 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() { local arch= binpkg= pkgdir= @@ -13,22 +29,19 @@ hook() { 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 + binpkg=${pkgver}.${arch}.xbps + binpkg_dbg=${pkgver}-dbg.${arch}.xbps - if [ ! -f ${pkgdir}/${binpkg} ]; then - msg_error "Unexistent binary package ${pkgdir}/${binpkg}!\n" - fi + # Register binpkg. + registerpkg $pkgdir $binpkg - 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} + # Register -dbg binpkg if it exists. + if [ -f ${pkgdir}/${binpkg_dbg} ]; then + registerpkg ${pkgdir} ${binpkg_dbg} fi } diff --git a/common/hooks/pre-pkg/00-gen-pkg.sh b/common/hooks/pre-pkg/00-gen-pkg.sh index c66b297442..eff7be18d7 100644 --- a/common/hooks/pre-pkg/00-gen-pkg.sh +++ b/common/hooks/pre-pkg/00-gen-pkg.sh @@ -1,6 +1,6 @@ # This hook generates a XBPS binary package from an installed package in destdir. -hook() { +genpkg() { local binpkg= pkgdir= arch= _deps= f= if [ ! -d "${PKGDESTDIR}" ]; then @@ -124,3 +124,17 @@ hook() { 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 +}