From 13686ca622bf27faecf87ca951961e544314b932 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Fri, 1 May 2026 10:03:14 -0700 Subject: [PATCH] Regenerate with build/install updates. --- .github/workflows/ci.yml | 36 ++++++++++----------- 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, 204 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7037985e6..76bc7a6a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,22 +181,22 @@ 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 - name: Test artifact upload @@ -378,22 +378,22 @@ 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 - name: Test artifact upload @@ -534,22 +534,22 @@ 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 - name: Test artifact upload diff --git a/builds/cmake/install-cmake.sh b/builds/cmake/install-cmake.sh index c1fa7129a..245773a13 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -38,6 +38,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. # @@ -99,6 +100,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#*=}";; @@ -123,6 +125,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/}") @@ -491,8 +494,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}..." @@ -520,6 +534,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" @@ -541,21 +567,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() @@ -896,6 +934,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 1bc81b284..d66772512 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -28,6 +28,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. # @@ -85,6 +86,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#*=}";; @@ -105,6 +107,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/}") @@ -507,8 +510,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}..." @@ -536,6 +550,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" @@ -557,21 +583,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() @@ -953,6 +991,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 3fceb1568..72f3fcae7 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -38,6 +38,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. # @@ -99,6 +100,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 @@ -119,6 +121,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/}") @@ -477,8 +480,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}..." @@ -506,6 +520,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" @@ -527,21 +553,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() @@ -883,6 +921,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 e84fe756b..86ee27934 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 @@ -229,6 +230,8 @@ if "!libbitcoin_database_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" ( @@ -249,6 +252,27 @@ if "!libbitcoin_database_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" @@ -269,14 +293,32 @@ if "!libbitcoin_database_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 ) ) @@ -288,6 +330,10 @@ if "!libbitcoin_database_TAG!" == "" ( exit /b 1 ) + call :github_repository_status "%REPOSITORY%" + if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% + ) call :pop_directory exit /b %ERRORLEVEL% @@ -413,6 +459,7 @@ if "!libbitcoin_database_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%