From 4098c62ebcb2fcee942f490d77ea276d673840e1 Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 28 Jan 2020 01:06:16 +0100 Subject: [PATCH] xbps-src: prevent builddir/destdir from always being removed The problem here is that newly introduced behavior in commit b2b0409be462aaa90de99791a57d4c7a6ce12e6d 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. --- common/xbps-src/shutils/chroot.sh | 3 ++- xbps-src | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh index c4297bcfa85..228dd2e0399 100644 --- a/common/xbps-src/shutils/chroot.sh +++ b/common/xbps-src/shutils/chroot.sh @@ -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 diff --git a/xbps-src b/xbps-src index 1ba52432707..b6b24e0df65 100755 --- a/xbps-src +++ b/xbps-src @@ -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