mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 08:22:49 +08:00
[vcpkg] Disable timeout (default 10s) in vcpkg_acquire_msys (#13086)
This commit is contained in:
parent
8054263f15
commit
c278ca585e
@ -4,7 +4,7 @@
|
||||
##
|
||||
## ## Usage
|
||||
## ```cmake
|
||||
## vcpkg_acquire_msys(<MSYS_ROOT_VAR> [PACKAGES <package>...])
|
||||
## vcpkg_acquire_msys(<MSYS_ROOT_VAR> [PACKAGES <package>...] [TIMEOUT <seconds>])
|
||||
## ```
|
||||
##
|
||||
## ## Parameters
|
||||
@ -14,6 +14,9 @@
|
||||
## ### PACKAGES
|
||||
## A list of packages to acquire in msys.
|
||||
##
|
||||
## ### TIMEOUT
|
||||
## Optional timeout to override the default (10 min.) after which installation of PACKAGES is terminated.
|
||||
##
|
||||
## To ensure a package is available: `vcpkg_acquire_msys(MSYS_ROOT PACKAGES make automake1.15)`
|
||||
##
|
||||
## ## Notes
|
||||
@ -38,7 +41,13 @@
|
||||
function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
|
||||
set(TIMESTAMP 20200812)
|
||||
set(TOOLPATH ${DOWNLOADS}/tools/msys2-${TIMESTAMP})
|
||||
cmake_parse_arguments(_am "" "" "PACKAGES" ${ARGN})
|
||||
cmake_parse_arguments(_am "" "TIMEOUT" "PACKAGES" ${ARGN})
|
||||
|
||||
if(_am_TIMEOUT)
|
||||
set(TIMEOUT_PACKAGES "TIMEOUT;${_am_TIMEOUT}")
|
||||
else()
|
||||
set(TIMEOUT_PACKAGES "TIMEOUT;600")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_HOST_WIN32)
|
||||
message(FATAL_ERROR "vcpkg_acquire_msys() can only be used on Windows hosts")
|
||||
@ -128,8 +137,9 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
|
||||
# we need to update pacman before anything else due to pacman transitioning
|
||||
# to using zstd packages, and our pacman is too old to support those
|
||||
_execute_process(
|
||||
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Sy pacman --noconfirm"
|
||||
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Sy pacman --noconfirm --disable-download-timeout"
|
||||
WORKING_DIRECTORY ${TOOLPATH}
|
||||
TIMEOUT 600
|
||||
)
|
||||
# dash relies on specific versions of the base packages, which prevents us
|
||||
# from doing a proper update. However, we don't need it so we remove it
|
||||
@ -138,8 +148,9 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
|
||||
WORKING_DIRECTORY ${TOOLPATH}
|
||||
)
|
||||
_execute_process(
|
||||
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Syu --noconfirm"
|
||||
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Syu --noconfirm --disable-download-timeout"
|
||||
WORKING_DIRECTORY ${TOOLPATH}
|
||||
TIMEOUT 600
|
||||
)
|
||||
file(WRITE "${TOOLPATH}/${STAMP}" "0")
|
||||
message(STATUS "Acquiring MSYS2... OK")
|
||||
@ -153,9 +164,10 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
|
||||
set(ENV{PATH} ${PATH_TO_ROOT}/usr/bin)
|
||||
vcpkg_execute_required_process(
|
||||
ALLOW_IN_DOWNLOAD_MODE
|
||||
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --needed ${_am_PACKAGES}"
|
||||
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --disable-download-timeout --needed ${_am_PACKAGES}"
|
||||
WORKING_DIRECTORY ${TOOLPATH}
|
||||
LOGNAME msys-pacman-${TARGET_TRIPLET}
|
||||
${TIMEOUT_PACKAGES}
|
||||
)
|
||||
set(ENV{PATH} "${_ENV_ORIGINAL}")
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
## COMMAND <${PERL}> [<arguments>...]
|
||||
## WORKING_DIRECTORY <${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg>
|
||||
## LOGNAME <build-${TARGET_TRIPLET}-dbg>
|
||||
## [TIMEOUT <seconds>]
|
||||
## )
|
||||
## ```
|
||||
## ## Parameters
|
||||
@ -24,6 +25,9 @@
|
||||
## ### LOGNAME
|
||||
## The prefix to use for the log files.
|
||||
##
|
||||
## ### TIMEOUT
|
||||
## Optional timeout after which to terminate the command.
|
||||
##
|
||||
## This should be a unique name for different triplets so that the logs don't conflict when building multiple at once.
|
||||
##
|
||||
## ## Examples
|
||||
@ -34,10 +38,16 @@
|
||||
## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake)
|
||||
include(vcpkg_prettify_command)
|
||||
function(vcpkg_execute_required_process)
|
||||
cmake_parse_arguments(vcpkg_execute_required_process "ALLOW_IN_DOWNLOAD_MODE" "WORKING_DIRECTORY;LOGNAME" "COMMAND" ${ARGN})
|
||||
cmake_parse_arguments(vcpkg_execute_required_process "ALLOW_IN_DOWNLOAD_MODE" "WORKING_DIRECTORY;LOGNAME;TIMEOUT" "COMMAND" ${ARGN})
|
||||
set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-out.log")
|
||||
set(LOG_ERR "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-err.log")
|
||||
|
||||
if(vcpkg_execute_required_process_TIMEOUT)
|
||||
set(TIMEOUT_PARAM "TIMEOUT;${vcpkg_execute_required_process_TIMEOUT}")
|
||||
else()
|
||||
set(TIMEOUT_PARAM "")
|
||||
endif()
|
||||
|
||||
set(execute_process_function execute_process)
|
||||
if (DEFINED VCPKG_DOWNLOAD_MODE AND NOT vcpkg_execute_required_process_ALLOW_IN_DOWNLOAD_MODE)
|
||||
message(FATAL_ERROR
|
||||
@ -52,7 +62,8 @@ Halting portfile execution.
|
||||
OUTPUT_FILE ${LOG_OUT}
|
||||
ERROR_FILE ${LOG_ERR}
|
||||
RESULT_VARIABLE error_code
|
||||
WORKING_DIRECTORY ${vcpkg_execute_required_process_WORKING_DIRECTORY})
|
||||
WORKING_DIRECTORY ${vcpkg_execute_required_process_WORKING_DIRECTORY}
|
||||
${TIMEOUT_PARAM})
|
||||
if(error_code)
|
||||
set(LOGS)
|
||||
file(READ "${LOG_OUT}" out_contents)
|
||||
|
Loading…
Reference in New Issue
Block a user