From 2177c6837ad422f778930d39907aa1af874cfb22 Mon Sep 17 00:00:00 2001 From: John Sebastian Peterson Date: Sun, 16 Mar 2025 15:01:02 +1100 Subject: [PATCH] keep build state when running command again flag -f will rerun configure but the source and build folders are never deleted. it is necessary for testing that it behaves like a manual build . usually many runs are required before everything succeed @fornwall can you intervene here. I also speak Swedish and is also a theoretical physicist PhD currently hiking the mountains of Tasmania. @thunder-coding is not as experienced as us but is closing good commits left and right without any understand of how anything works --- scripts/build/configure/termux_step_configure.sh | 2 ++ scripts/build/get_source/termux_git_clone_src.sh | 3 +-- scripts/build/get_source/termux_step_get_source.sh | 1 + scripts/build/termux_step_make.sh | 2 +- scripts/build/termux_step_patch_package.sh | 2 +- scripts/build/termux_step_setup_build_folders.sh | 1 + scripts/build/termux_step_setup_variables.sh | 1 + 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/build/configure/termux_step_configure.sh b/scripts/build/configure/termux_step_configure.sh index c9712678b98aec..a4fcad6f621d8d 100644 --- a/scripts/build/configure/termux_step_configure.sh +++ b/scripts/build/configure/termux_step_configure.sh @@ -1,5 +1,6 @@ termux_step_configure() { [ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return + [ -f "$TERMUX_PKG_CONFIGURE_MARKER" ] && ! $TERMUX_FORCE_BUILD && echo packet already configured run with -f to reconfigure && return # This check should be above autotools check as haskell package too makes use of configure scripts which # should be executed by its own build system. @@ -31,4 +32,5 @@ termux_step_configure() { fi termux_step_configure_meson fi + touch $TERMUX_PKG_CONFIGURE_MARKER } diff --git a/scripts/build/get_source/termux_git_clone_src.sh b/scripts/build/get_source/termux_git_clone_src.sh index 7f310da61b113b..72af7bf815bf3d 100644 --- a/scripts/build/get_source/termux_git_clone_src.sh +++ b/scripts/build/get_source/termux_git_clone_src.sh @@ -38,8 +38,7 @@ termux_git_clone_src() { popd echo "$TERMUX_PKG_VERSION" > $TMP_CHECKOUT_VERSION - fi - rm -rf $TERMUX_PKG_SRCDIR cp -Rf $TMP_CHECKOUT $TERMUX_PKG_SRCDIR + fi } diff --git a/scripts/build/get_source/termux_step_get_source.sh b/scripts/build/get_source/termux_step_get_source.sh index 2c914ed34022a8..0b0cf36b8d1000 100644 --- a/scripts/build/get_source/termux_step_get_source.sh +++ b/scripts/build/get_source/termux_step_get_source.sh @@ -4,6 +4,7 @@ termux_step_get_source() { if [ "${TERMUX_PKG_SRCURL:0:4}" == "git+" ]; then termux_git_clone_src else + [ -d "$TERMUX_PKG_SRCDIR" ] && echo source folder already exists use -f to delete && return if [ -z "${TERMUX_PKG_SRCURL}" ] || [ "${TERMUX_PKG_SKIP_SRC_EXTRACT-false}" = "true" ] || [ "$TERMUX_PKG_METAPACKAGE" = "true" ]; then mkdir -p "$TERMUX_PKG_SRCDIR" return diff --git a/scripts/build/termux_step_make.sh b/scripts/build/termux_step_make.sh index a1a256c21f78b9..e0d4ff79514acd 100644 --- a/scripts/build/termux_step_make.sh +++ b/scripts/build/termux_step_make.sh @@ -7,7 +7,7 @@ termux_step_make() { fi if test -f build.ninja; then - ninja -j $TERMUX_PKG_MAKE_PROCESSES + ninja -j $TERMUX_PKG_MAKE_PROCESSES $TERMUX_PKG_EXTRA_MAKE_ARGS elif ls ./*.cabal &>/dev/null; then cabal build elif ls ./*akefile &>/dev/null || [ ! -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then diff --git a/scripts/build/termux_step_patch_package.sh b/scripts/build/termux_step_patch_package.sh index df1082d445d288..7f6af27d76dfad 100644 --- a/scripts/build/termux_step_patch_package.sh +++ b/scripts/build/termux_step_patch_package.sh @@ -26,7 +26,7 @@ termux_step_patch_package() { -e "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" \ -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" \ -e "s%\@TERMUX_PREFIX_CLASSICAL\@%${TERMUX_PREFIX_CLASSICAL}%g" \ - "$patch" | patch --silent -p1 + "$patch" | patch -f --silent -p1 || [ -f "$TERMUX_PKG_CONFIGURE_MARKER" ] done shopt -u nullglob } diff --git a/scripts/build/termux_step_setup_build_folders.sh b/scripts/build/termux_step_setup_build_folders.sh index 8c11ca9eeb3ac4..517ec4c6b0b913 100644 --- a/scripts/build/termux_step_setup_build_folders.sh +++ b/scripts/build/termux_step_setup_build_folders.sh @@ -1,4 +1,5 @@ termux_step_setup_build_folders() { + [ -f "$TERMUX_PKG_CONFIGURE_MARKER" ] && ! $TERMUX_FORCE_BUILD && echo previous build detected use -f start over && return # Following directories may contain files with read-only # permissions which makes them undeletable. We need to fix # that. diff --git a/scripts/build/termux_step_setup_variables.sh b/scripts/build/termux_step_setup_variables.sh index b63c908f3945a8..1b02a449688355 100644 --- a/scripts/build/termux_step_setup_variables.sh +++ b/scripts/build/termux_step_setup_variables.sh @@ -136,6 +136,7 @@ termux_step_setup_variables() { TERMUX_PKG_BUILD_DEPENDS="" TERMUX_PKG_BUILD_IN_SRC=false TERMUX_PKG_CONFFILES="" + TERMUX_PKG_CONFIGURE_MARKER=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/.configured TERMUX_PKG_CONFLICTS="" # https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts TERMUX_PKG_DEPENDS="" TERMUX_PKG_DESCRIPTION="FIXME:Add description"