From d48d065f45953384e11b5119093687cfdb93de85 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Fri, 1 May 2026 10:03:15 -0700 Subject: [PATCH] Regenerate with build/install updates. --- .github/workflows/ci.yml | 72 ++++++++++++++++----------------- builds/cmake/install-cmake.sh | 51 ++++++++++++++++++++--- builds/cmake/install-presets.sh | 51 ++++++++++++++++++++--- builds/gnu/install-gnu.sh | 51 ++++++++++++++++++++--- builds/msvc/build-msvc.cmd | 55 +++++++++++++++++++++++-- 5 files changed, 222 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38675710..27324e06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,40 +197,40 @@ jobs: working-directory: ${{ github.workspace }} run: | if [[ -e "libbitcoin-system/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors" + cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors fi if [[ -e "libbitcoin-system/obj/test-suite.log" ]]; then - cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors" + cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors fi if [[ -e "libbitcoin-system/obj/test.log" ]]; then - cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors" + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors fi if [[ -e "libbitcoin-database/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors" + cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors fi if [[ -e "libbitcoin-database/obj/test-suite.log" ]]; then - cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors" + cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors fi if [[ -e "libbitcoin-database/obj/test.log" ]]; then - cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors" + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors fi if [[ -e "libbitcoin-network/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors" + cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors fi if [[ -e "libbitcoin-network/obj/test-suite.log" ]]; then - cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors" + cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors fi if [[ -e "libbitcoin-network/obj/test.log" ]]; then - cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors" + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors fi if [[ -e "libbitcoin-node/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors" + cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors fi if [[ -e "libbitcoin-node/obj/test-suite.log" ]]; then - cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors" + cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors fi if [[ -e "libbitcoin-node/obj/test.log" ]]; then - cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors" + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors fi - name: Test artifact upload @@ -428,40 +428,40 @@ jobs: working-directory: ${{ github.workspace }} run: | if [[ -e "libbitcoin-system/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors" + cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors fi if [[ -e "libbitcoin-system/obj/test-suite.log" ]]; then - cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors" + cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors fi if [[ -e "libbitcoin-system/obj/test.log" ]]; then - cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors" + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors fi if [[ -e "libbitcoin-database/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors" + cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors fi if [[ -e "libbitcoin-database/obj/test-suite.log" ]]; then - cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors" + cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors fi if [[ -e "libbitcoin-database/obj/test.log" ]]; then - cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors" + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors fi if [[ -e "libbitcoin-network/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors" + cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors fi if [[ -e "libbitcoin-network/obj/test-suite.log" ]]; then - cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors" + cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors fi if [[ -e "libbitcoin-network/obj/test.log" ]]; then - cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors" + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors fi if [[ -e "libbitcoin-node/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors" + cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors fi if [[ -e "libbitcoin-node/obj/test-suite.log" ]]; then - cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors" + cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors fi if [[ -e "libbitcoin-node/obj/test.log" ]]; then - cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors" + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors fi - name: Test artifact upload @@ -618,40 +618,40 @@ jobs: working-directory: ${{ github.workspace }} run: | if [[ -e "libbitcoin-system/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors" + cp "libbitcoin-system/obj/Testing/Temporary/LastTest.log" libbitcoin-system-LastTest.errors fi if [[ -e "libbitcoin-system/obj/test-suite.log" ]]; then - cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors" + cp "libbitcoin-system/obj/test-suite.log" libbitcoin-system-test-suite.errors fi if [[ -e "libbitcoin-system/obj/test.log" ]]; then - cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors" + cp "libbitcoin-system/obj/test.log" libbitcoin-system-test.errors fi if [[ -e "libbitcoin-database/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors" + cp "libbitcoin-database/obj/Testing/Temporary/LastTest.log" libbitcoin-database-LastTest.errors fi if [[ -e "libbitcoin-database/obj/test-suite.log" ]]; then - cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors" + cp "libbitcoin-database/obj/test-suite.log" libbitcoin-database-test-suite.errors fi if [[ -e "libbitcoin-database/obj/test.log" ]]; then - cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors" + cp "libbitcoin-database/obj/test.log" libbitcoin-database-test.errors fi if [[ -e "libbitcoin-network/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors" + cp "libbitcoin-network/obj/Testing/Temporary/LastTest.log" libbitcoin-network-LastTest.errors fi if [[ -e "libbitcoin-network/obj/test-suite.log" ]]; then - cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors" + cp "libbitcoin-network/obj/test-suite.log" libbitcoin-network-test-suite.errors fi if [[ -e "libbitcoin-network/obj/test.log" ]]; then - cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors" + cp "libbitcoin-network/obj/test.log" libbitcoin-network-test.errors fi if [[ -e "libbitcoin-node/obj/Testing/Temporary/LastTest.log" ]]; then - cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors" + cp "libbitcoin-node/obj/Testing/Temporary/LastTest.log" libbitcoin-node-LastTest.errors fi if [[ -e "libbitcoin-node/obj/test-suite.log" ]]; then - cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors" + cp "libbitcoin-node/obj/test-suite.log" libbitcoin-node-test-suite.errors fi if [[ -e "libbitcoin-node/obj/test.log" ]]; then - cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors" + cp "libbitcoin-node/obj/test.log" libbitcoin-node-test.errors fi - name: Test artifact upload diff --git a/builds/cmake/install-cmake.sh b/builds/cmake/install-cmake.sh index 63c17867..7af17888 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -40,6 +40,7 @@ # --build-use-local-src Use existing sources in relevant paths. # --prefix= Installation destination. # Default: /usr/local +# --noninteractive Disable any prompt using default. # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # @@ -115,6 +116,7 @@ main() (--build-parallel=*) PARALLEL="${OPTION#*=}";; (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--prefix=*) PREFIX="${OPTION#*=}";; + (--noninteractive) NONINTERACTIVE="yes";; (--verbose) DISPLAY_VERBOSE="yes";; (--help|-h) DISPLAY_HELP="yes";; (-DCMAKE_PREFIX_PATH=*) CMAKE_PREFIX_PATH="${OPTION#*=}";; @@ -139,6 +141,7 @@ main() CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-parallel=*/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-use-local-src/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--prefix=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--noninteractive/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--help/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/-h/}") @@ -539,8 +542,19 @@ source_archive() fi if [ -d "${PROJECT}" ]; then - msg_warn "Encountered existing '${PROJECT}' directory, removing..." - remove_directory_force "${PROJECT}" + msg_warn "Encountered existing '${PROJECT}' directory..." + if [[ "${NONINTERACTIVE}" == "yes" ]]; then + CONFIRM="N" + else + read -p "Replace '${PROJECT}' directory with intended contents? [y/N] " CONFIRM + fi + + if [[ "${CONFIRM,,}" == "y" ]]; then + remove_directory_force "${PROJECT}" + else + msg_error "Aborted installation." + exit 0 + fi fi msg "Retrieving ${PROJECT}..." @@ -568,6 +582,18 @@ source_archive() msg_success "Completed download and extraction successfully." } +github_repository_status() +{ + local REPOSITORY="$1" + + push_directory "${REPOSITORY}" + local DISCOVERED_COMMIT=$(git rev-parse HEAD) + local DISCOVERED_URL=$(git config --get remote.origin.url) + pop_directory # REPOSITORY + msg_warn " commit : ${DISCOVERED_COMMIT}" + msg_warn " url : ${DISCOVERED_URL}" +} + source_github() { local OWNER="$1" @@ -589,21 +615,33 @@ source_github() if [ -d "${REPOSITORY}" ] && [[ "${BUILD_USE_LOCAL_SRC}" == "yes" ]]; then msg_warn "Reusing existing '${REPOSITORY}'..." + github_repository_status "${REPOSITORY}" pop_directory # BUILD_SRC_DIR return 0 fi if [ -d "${REPOSITORY}" ]; then - msg_warn "Encountered existing '${REPOSITORY}' directory, removing..." - remove_directory_force "${REPOSITORY}" + msg_warn "Encountered existing '${REPOSITORY}' directory..." + if [[ "${NONINTERACTIVE}" == "yes" ]]; then + CONFIRM="N" + else + read -p "Replace '${REPOSITORY}' directory with intended contents? [y/N] " CONFIRM + fi + + if [[ "${CONFIRM,,}" == "y" ]]; then + remove_directory_force "${REPOSITORY}" + else + msg_error "Aborted installation." + exit 0 + fi fi msg "Cloning ${OWNER}/${REPOSITORY}/${TAG}..." ${GIT_CLONE} ${CLONE_OPTIONS} --branch "${TAG}" "https://github.com/${OWNER}/${REPOSITORY}" - # pop BUILD_SRC_DIR - pop_directory + github_repository_status "${REPOSITORY}" + pop_directory # pop BUILD_SRC_DIR } install_make() @@ -952,6 +990,7 @@ help() msg "--build-use-local-src Use existing sources in relevant paths." msg "--prefix= Installation destination." msg " Default: /usr/local" + msg "--noninteractive Disable any prompt using default." msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" diff --git a/builds/cmake/install-presets.sh b/builds/cmake/install-presets.sh index b2a32c3b..3afa4d4e 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -30,6 +30,7 @@ # --build-parallel= Number of jobs to run simultaneously. # Default: supported platforms use nproc/sysctl # --build-use-local-src Use existing sources in relevant paths. +# --noninteractive Disable any prompt using default. # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # @@ -101,6 +102,7 @@ main() (--build-skip-tests) BUILD_SKIP_TESTS="yes";; (--build-parallel=*) PARALLEL="${OPTION#*=}";; (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; + (--noninteractive) NONINTERACTIVE="yes";; (--verbose) DISPLAY_VERBOSE="yes";; (--help|-h) DISPLAY_HELP="yes";; (-DCMAKE_PREFIX_PATH=*) CMAKE_PREFIX_PATH="${OPTION#*=}";; @@ -121,6 +123,7 @@ main() CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-skip-tests/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-parallel=*/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-use-local-src/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--noninteractive/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--help/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/-h/}") @@ -555,8 +558,19 @@ source_archive() fi if [ -d "${PROJECT}" ]; then - msg_warn "Encountered existing '${PROJECT}' directory, removing..." - remove_directory_force "${PROJECT}" + msg_warn "Encountered existing '${PROJECT}' directory..." + if [[ "${NONINTERACTIVE}" == "yes" ]]; then + CONFIRM="N" + else + read -p "Replace '${PROJECT}' directory with intended contents? [y/N] " CONFIRM + fi + + if [[ "${CONFIRM,,}" == "y" ]]; then + remove_directory_force "${PROJECT}" + else + msg_error "Aborted installation." + exit 0 + fi fi msg "Retrieving ${PROJECT}..." @@ -584,6 +598,18 @@ source_archive() msg_success "Completed download and extraction successfully." } +github_repository_status() +{ + local REPOSITORY="$1" + + push_directory "${REPOSITORY}" + local DISCOVERED_COMMIT=$(git rev-parse HEAD) + local DISCOVERED_URL=$(git config --get remote.origin.url) + pop_directory # REPOSITORY + msg_warn " commit : ${DISCOVERED_COMMIT}" + msg_warn " url : ${DISCOVERED_URL}" +} + source_github() { local OWNER="$1" @@ -605,21 +631,33 @@ source_github() if [ -d "${REPOSITORY}" ] && [[ "${BUILD_USE_LOCAL_SRC}" == "yes" ]]; then msg_warn "Reusing existing '${REPOSITORY}'..." + github_repository_status "${REPOSITORY}" pop_directory # BUILD_SRC_DIR return 0 fi if [ -d "${REPOSITORY}" ]; then - msg_warn "Encountered existing '${REPOSITORY}' directory, removing..." - remove_directory_force "${REPOSITORY}" + msg_warn "Encountered existing '${REPOSITORY}' directory..." + if [[ "${NONINTERACTIVE}" == "yes" ]]; then + CONFIRM="N" + else + read -p "Replace '${REPOSITORY}' directory with intended contents? [y/N] " CONFIRM + fi + + if [[ "${CONFIRM,,}" == "y" ]]; then + remove_directory_force "${REPOSITORY}" + else + msg_error "Aborted installation." + exit 0 + fi fi msg "Cloning ${OWNER}/${REPOSITORY}/${TAG}..." ${GIT_CLONE} ${CLONE_OPTIONS} --branch "${TAG}" "https://github.com/${OWNER}/${REPOSITORY}" - # pop BUILD_SRC_DIR - pop_directory + github_repository_status "${REPOSITORY}" + pop_directory # pop BUILD_SRC_DIR } install_make() @@ -1009,6 +1047,7 @@ help() msg "--build-parallel= Number of jobs to run simultaneously." msg " Default: supported platforms use nproc/sysctl" msg "--build-use-local-src Use existing sources in relevant paths." + msg "--noninteractive Disable any prompt using default." msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index bf033206..c8c46d0e 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -40,6 +40,7 @@ # --build-use-local-src Use existing sources in relevant paths. # --prefix= Installation destination. # Default: /usr/local +# --noninteractive Disable any prompt using default. # --verbose Display verbose script output. # --help, -h Display usage, overriding script execution. # @@ -115,6 +116,7 @@ main() (--build-parallel=*) PARALLEL="${OPTION#*=}";; (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--prefix=*) PREFIX="${OPTION#*=}";; + (--noninteractive) NONINTERACTIVE="yes";; (--verbose) DISPLAY_VERBOSE="yes";; (--help|-h) DISPLAY_HELP="yes";; esac @@ -135,6 +137,7 @@ main() CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-parallel=*/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--build-use-local-src/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--prefix=*/}") + CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--noninteractive/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--help/}") CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/-h/}") @@ -528,8 +531,19 @@ source_archive() fi if [ -d "${PROJECT}" ]; then - msg_warn "Encountered existing '${PROJECT}' directory, removing..." - remove_directory_force "${PROJECT}" + msg_warn "Encountered existing '${PROJECT}' directory..." + if [[ "${NONINTERACTIVE}" == "yes" ]]; then + CONFIRM="N" + else + read -p "Replace '${PROJECT}' directory with intended contents? [y/N] " CONFIRM + fi + + if [[ "${CONFIRM,,}" == "y" ]]; then + remove_directory_force "${PROJECT}" + else + msg_error "Aborted installation." + exit 0 + fi fi msg "Retrieving ${PROJECT}..." @@ -557,6 +571,18 @@ source_archive() msg_success "Completed download and extraction successfully." } +github_repository_status() +{ + local REPOSITORY="$1" + + push_directory "${REPOSITORY}" + local DISCOVERED_COMMIT=$(git rev-parse HEAD) + local DISCOVERED_URL=$(git config --get remote.origin.url) + pop_directory # REPOSITORY + msg_warn " commit : ${DISCOVERED_COMMIT}" + msg_warn " url : ${DISCOVERED_URL}" +} + source_github() { local OWNER="$1" @@ -578,21 +604,33 @@ source_github() if [ -d "${REPOSITORY}" ] && [[ "${BUILD_USE_LOCAL_SRC}" == "yes" ]]; then msg_warn "Reusing existing '${REPOSITORY}'..." + github_repository_status "${REPOSITORY}" pop_directory # BUILD_SRC_DIR return 0 fi if [ -d "${REPOSITORY}" ]; then - msg_warn "Encountered existing '${REPOSITORY}' directory, removing..." - remove_directory_force "${REPOSITORY}" + msg_warn "Encountered existing '${REPOSITORY}' directory..." + if [[ "${NONINTERACTIVE}" == "yes" ]]; then + CONFIRM="N" + else + read -p "Replace '${REPOSITORY}' directory with intended contents? [y/N] " CONFIRM + fi + + if [[ "${CONFIRM,,}" == "y" ]]; then + remove_directory_force "${REPOSITORY}" + else + msg_error "Aborted installation." + exit 0 + fi fi msg "Cloning ${OWNER}/${REPOSITORY}/${TAG}..." ${GIT_CLONE} ${CLONE_OPTIONS} --branch "${TAG}" "https://github.com/${OWNER}/${REPOSITORY}" - # pop BUILD_SRC_DIR - pop_directory + github_repository_status "${REPOSITORY}" + pop_directory # pop BUILD_SRC_DIR } install_make() @@ -942,6 +980,7 @@ help() msg "--build-use-local-src Use existing sources in relevant paths." msg "--prefix= Installation destination." msg " Default: /usr/local" + msg "--noninteractive Disable any prompt using default." msg "--verbose Display verbose script output." msg "--help, -h Display usage, overriding script execution." msg "" diff --git a/builds/msvc/build-msvc.cmd b/builds/msvc/build-msvc.cmd index ef2e1663..8c6450b4 100644 --- a/builds/msvc/build-msvc.cmd +++ b/builds/msvc/build-msvc.cmd @@ -25,6 +25,7 @@ REM --build-full-repositories Sync full github repositories. REM Default: git clone --depth 1 --single-branch REM --build-skip-tests Skip test compilation and execution. REM --build-use-local-src Use existing sources in relevant paths. +REM --noninteractive Disable any prompt using default. REM --verbose Display verbose script output. REM --help, -h Display usage, overriding script execution. REM @@ -262,6 +263,8 @@ if "!libbitcoin_node_TAG!" == "" ( set "BUILD_SKIP_TESTS=yes" ) else if "%~1" == "--build-use-local-src" ( set "BUILD_USE_LOCAL_SRC=yes" + ) else if "%~1" == "--noninteractive" ( + set "NONINTERACTIVE=yes" ) else if "%~1" == "--verbose" ( set "DISPLAY_VERBOSE=yes" ) else if "%~1" == "--help" ( @@ -282,6 +285,27 @@ if "!libbitcoin_node_TAG!" == "" ( :end_parse_input exit /b 0 +:github_repository_status + set "REPO=%~1" + call :push_directory "!REPO!" + for /F "tokens=*" %%A in ('git rev-parse HEAD') do ( + set "DISCOVERED_COMMIT=%%A" + ) + if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% + ) + + for /F "tokens=*" %%A in ('git config --get remote.origin.url') do ( + set "DISCOVERED_URL=%%A" + ) + if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% + ) + + call :msg_warn " commit : !DISCOVERED_COMMIT!" + call :msg_warn " url : !DISCOVERED_URL!" + call :pop_directory + exit /b 0 :source_github set "OWNER=%~1" @@ -302,14 +326,32 @@ if "!libbitcoin_node_TAG!" == "" ( if exist "%REPOSITORY%" ( if "!BUILD_USE_LOCAL_SRC!" == "yes" ( call :msg_warn "Reusing existing '%REPOSITORY%'..." + call :github_repository_status "%REPOSITORY%" + if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% + ) call :pop_directory exit /b %ERRORLEVEL% ) - call :msg_warn "Encountered existing '%REPOSITORY%' directory, removing..." - call :remove_directory_force "%REPOSITORY%" - if %ERRORLEVEL% neq 0 ( - exit /b %ERRORLEVEL% + call :msg_warn "Encountered existing '%REPOSITORY%' directory..." + if "!NONINTERACTIVE!" == "yes" ( + set "CONFIRM=N" + ) else ( + set /p "CONFIRM=Replace '%REPOSITORY%' directory with intended contents? [y/N] " + ) + + if /I "%CONFIRM%"=="y" ( + call :remove_directory_force "%REPOSITORY%" + if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% + ) + ) else ( + msg_error "Aborted build." + if not defined CI ( + pause + ) + exit 0 ) ) @@ -321,6 +363,10 @@ if "!libbitcoin_node_TAG!" == "" ( exit /b 1 ) + call :github_repository_status "%REPOSITORY%" + if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% + ) call :pop_directory exit /b %ERRORLEVEL% @@ -450,6 +496,7 @@ if "!libbitcoin_node_TAG!" == "" ( call :msg " Default: git clone --depth 1 --single-branch" call :msg "--build-skip-tests Skip test compilation and execution." call :msg "--build-use-local-src Use existing sources in relevant paths." + call :msg "--noninteractive Disable any prompt using default." call :msg "--verbose Display verbose script output." call :msg "--help, -h Display usage, overriding script execution." exit /b %ERRORLEVEL%