xbps-src: make the 'pkg' target work after 'install'.

- Create state files in $wrksrc for $sourcepkg and $subpackages
to see if the phase needs to be re-run.
This commit is contained in:
Juan RP 2014-12-06 13:45:49 +01:00
parent be6533d7cc
commit 2a7a3209b8
3 changed files with 32 additions and 22 deletions

View file

@ -24,9 +24,9 @@ for f in $XBPS_COMMONDIR/environment/install/*.sh; do
source_file "$f" source_file "$f"
done done
XBPS_INSTALL_DONE="$wrksrc/.xbps_${sourcepkg}_${XBPS_CROSS_BUILD}_install_done" XBPS_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_install_done"
XBPS_PRE_INSTALL_DONE="$wrksrc/.xbps_${sourcepkg}_${XBPS_CROSS_BUILD}_pre_install_done" XBPS_PRE_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_pre_install_done"
XBPS_POST_INSTALL_DONE="$wrksrc/.xbps_${sourcepkg}_${XBPS_CROSS_BUILD}_post_install_done" XBPS_POST_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_post_install_done"
cd $wrksrc || msg_error "$pkgver: cannot access to wrksrc [$wrksrc]\n" cd $wrksrc || msg_error "$pkgver: cannot access to wrksrc [$wrksrc]\n"
if [ -n "$build_wrksrc" ]; then if [ -n "$build_wrksrc" ]; then
@ -76,6 +76,8 @@ fi
# If it's a subpkg execute the pkg_install() function. # If it's a subpkg execute the pkg_install() function.
if [ "$sourcepkg" != "$PKGNAME" ]; then if [ "$sourcepkg" != "$PKGNAME" ]; then
XBPS_SUBPKG_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_${PKGNAME}_install_done"
if [ ! -f $XBPS_SUBPKG_INSTALL_DONE ]; then
# Source all subpkg environment setup snippets. # Source all subpkg environment setup snippets.
for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do for f in ${XBPS_COMMONDIR}/environment/setup-subpkg/*.sh; do
source_file "$f" source_file "$f"
@ -88,9 +90,10 @@ if [ "$sourcepkg" != "$PKGNAME" ]; then
export XBPS_PKGDESTDIR=1 export XBPS_PKGDESTDIR=1
run_func pkg_install run_func pkg_install
fi fi
setup_pkg_depends $pkgname
run_pkg_hooks post-install
touch -f $XBPS_SUBPKG_INSTALL_DONE
fi
fi fi
setup_pkg_depends $pkgname
run_pkg_hooks post-install
exit 0 exit 0

View file

@ -24,6 +24,13 @@ for f in $XBPS_COMMONDIR/environment/install/*.sh; do
source_file "$f" source_file "$f"
done done
XBPS_PREPKG_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_${PKGNAME}_prepkg_done"
if [ -f $XBPS_PREPKG_DONE ]; then
exit 0
fi
# If it's a subpkg execute the pkg_install() function. # If it's a subpkg execute the pkg_install() function.
if [ "$sourcepkg" != "$PKGNAME" ]; then if [ "$sourcepkg" != "$PKGNAME" ]; then
# Source all subpkg environment setup snippets. # Source all subpkg environment setup snippets.
@ -35,7 +42,7 @@ if [ "$sourcepkg" != "$PKGNAME" ]; then
fi fi
setup_pkg_depends $pkgname setup_pkg_depends $pkgname
run_pkg_hooks pre-pkg run_pkg_hooks pre-pkg
touch -f $XBPS_PREPKG_DONE
exit 0 exit 0

View file

@ -177,10 +177,10 @@ remove_pkg() {
msg_normal "$f: removing 32bit files from destdir...\n" msg_normal "$f: removing 32bit files from destdir...\n"
rm -rf ${_destdir}/${f}-32bit-${version} rm -rf ${_destdir}/${f}-32bit-${version}
fi fi
rm -f $wrksrc/.xbps_${f}_${cross}_pre_install_done rm -f $wrksrc/.xbps_${XBPS_CROSS_BUILD}_${f}_install_done
rm -f $wrksrc/.xbps_${f}_${cross}_install_done rm -f $wrksrc/.xbps_${XBPS_CROSS_BUILD}_${f}_prepkg_done
rm -f $wrksrc/.xbps_${f}_${cross}_post_install_done
rm -f $wrksrc/.xbps_${f}_${cross}_pkg_done
rm -f $wrksrc/.xbps_${f}_${cross}_strip_done
done done
rm -f $wrksrc/.xbps_${cross}_install_done
rm -f $wrksrc/.xbps_${cross}_pre_install_done
rm -f $wrksrc/.xbps_${cross}_post_install_done
} }