xbps-src: prevent builddir/destdir from always being removed

The problem here is that newly introduced behavior in commit
b2b0409be4 resulted in builddir and
destdir *always* being removed when starting a build, as a part of
masterdir auto-update. We don't want this as we may want to resume
a previous build (e.g. by running stages individually or by resuming
a failed build from where it stopped).

Therefore, explicitly override the removal to restore previous behavior.
This commit is contained in:
q66 2020-01-28 01:06:16 +01:00
parent 368e0b8e88
commit 4098c62ebc
2 changed files with 4 additions and 2 deletions

View File

@ -44,6 +44,7 @@ reconfigure_base_chroot() {
}
update_base_chroot() {
local keep_all_force=$1
[ -z "$CHROOT_READY" ] && return
msg_normal "xbps-src: updating software in $XBPS_MASTERDIR masterdir...\n"
# no need to sync repodata, chroot_sync_repodata() does it for us.
@ -53,7 +54,7 @@ update_base_chroot() {
${XBPS_INSTALL_CMD} ${XBPS_INSTALL_ARGS} -yu || msg_error "xbps-src: failed to update base-chroot!\n"
msg_normal "xbps-src: cleaning up $XBPS_MASTERDIR masterdir...\n"
[ -z "$XBPS_KEEP_ALL" -a -z "$XBPS_SKIP_DEPS" ] && remove_pkg_autodeps
[ -z "$XBPS_KEEP_ALL" ] && rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
[ -z "$XBPS_KEEP_ALL" -a -z "$keep_all_force" ] && rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir
}
# FIXME: $XBPS_FFLAGS is not set when chroot_init() is run

View File

@ -712,7 +712,8 @@ case "$XBPS_TARGET" in
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG
else
chroot_sync_repodata
update_base_chroot
# prevent update_base_chroot from removing the builddir/destdir
update_base_chroot keep-all-force
$XBPS_LIBEXECDIR/build.sh $XBPS_TARGET_PKG $XBPS_TARGET_PKG \
$XBPS_TARGET $XBPS_CROSS_BUILD || exit $?
fi