diff options
| author | jgehw <44170764+jgehw@users.noreply.github.com> | 2020-09-09 19:36:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-09 10:36:58 -0700 |
| commit | 8b7e946c55507d491887bbfeb34453ff0c75c751 (patch) | |
| tree | 08bfa65706900acdc50fdb59fb9137ae2b555708 /scripts | |
| parent | bff4dd9c944b9fbad40ec1a36d7c2365287ce0a6 (diff) | |
| download | vcpkg-8b7e946c55507d491887bbfeb34453ff0c75c751.tar.gz vcpkg-8b7e946c55507d491887bbfeb34453ff0c75c751.zip | |
[execute_process] Don't strip embedded semicolons (#12926)
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/cmake/execute_process.cmake | 4 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_apply_patches.cmake | 5 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_download_distfile.cmake | 5 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_execute_in_download_mode.cmake | 59 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_execute_required_process.cmake | 6 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_find_acquire_program.cmake | 9 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_from_git.cmake | 4 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_from_gitlab.cmake | 5 |
8 files changed, 86 insertions, 11 deletions
diff --git a/scripts/cmake/execute_process.cmake b/scripts/cmake/execute_process.cmake index 51f6ad160..97af4eea1 100644 --- a/scripts/cmake/execute_process.cmake +++ b/scripts/cmake/execute_process.cmake @@ -13,8 +13,8 @@ if (NOT DEFINED OVERRIDEN_EXECUTE_PROCESS) message(FATAL_ERROR "This command cannot be executed in Download Mode.\nHalting portfile execution.\n")
endmacro()
else()
- macro(execute_process)
- _execute_process(${ARGV})
+ macro(_execute_process)
+ execute_process(${ARGV})
endmacro()
endif()
endif()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index 9088def1b..8ad54697b 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -29,6 +29,9 @@ ## ## * [libbson](https://github.com/Microsoft/vcpkg/blob/master/ports/libbson/portfile.cmake) ## * [gdal](https://github.com/Microsoft/vcpkg/blob/master/ports/gdal/portfile.cmake) + +include(vcpkg_execute_in_download_mode) + function(vcpkg_apply_patches) cmake_parse_arguments(_ap "QUIET" "SOURCE_PATH" "PATCHES" ${ARGN}) @@ -38,7 +41,7 @@ function(vcpkg_apply_patches) get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}") message(STATUS "Applying patch ${PATCH}") set(LOGNAME patch-${TARGET_TRIPLET}-${PATCHNUM}) - _execute_process( + vcpkg_execute_in_download_mode( COMMAND ${GIT} --work-tree=. --git-dir=.git apply "${ABSOLUTE_PATCH}" --ignore-whitespace --whitespace=nowarn --verbose OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-out.log ERROR_VARIABLE error diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index c04b070aa..b2dd9d42c 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -49,6 +49,9 @@ ## * [apr](https://github.com/Microsoft/vcpkg/blob/master/ports/apr/portfile.cmake) ## * [fontconfig](https://github.com/Microsoft/vcpkg/blob/master/ports/fontconfig/portfile.cmake) ## * [freetype](https://github.com/Microsoft/vcpkg/blob/master/ports/freetype/portfile.cmake) + +include(vcpkg_execute_in_download_mode) + function(vcpkg_download_distfile VAR) set(options SKIP_SHA512 SILENT_EXIT QUIET) set(oneValueArgs FILENAME SHA512) @@ -125,7 +128,7 @@ function(vcpkg_download_distfile VAR) list(APPEND request_headers "--header=${header}") endforeach() endif() - _execute_process( + vcpkg_execute_in_download_mode( COMMAND ${ARIA2} ${vcpkg_download_distfile_URLS} -o temp/${vcpkg_download_distfile_FILENAME} -l download-${vcpkg_download_distfile_FILENAME}-detailed.log diff --git a/scripts/cmake/vcpkg_execute_in_download_mode.cmake b/scripts/cmake/vcpkg_execute_in_download_mode.cmake new file mode 100644 index 000000000..752ef40e2 --- /dev/null +++ b/scripts/cmake/vcpkg_execute_in_download_mode.cmake @@ -0,0 +1,59 @@ +## # vcpkg_execute_in_download_mode +## +## Execute a process even in download mode. +## +## ## Usage +## ```cmake +## vcpkg_execute_in_download_mode( +## COMMAND <cmd> [<arguments>...] +## OUTPUT_QUIET ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE +## WORKING_DIRECTORY <dir> +## TIMEOUT <seconds> +## RESULT_VARIABLE <seconds> +## OUTPUT_VARIABLE <var_out> +## ERROR_VARIABLE <var_err> +## INPUT_FILE <f_in> +## OUTPUT_FILE <f_out> +## ERROR_FILE <f_err> +## ENCODING <enc> +## ) +## ``` +## +## The signature of this function is identical with `execute_process()` except that +## it only accepts one COMMAND argument, i.e., does not support chaining multiple +## commands with pipes. +## +## See `execute_process()` for a detailed description of the parameters. +function(vcpkg_execute_in_download_mode) + # parse parameters such that semicolons in options arguments to COMMAND don't get erased + cmake_parse_arguments(PARSE_ARGV 0 vcpkg_execute_in_download_mode + "OUTPUT_QUIET;ERROR_QUIET;OUTPUT_STRIP_TRAILING_WHITESPACE;ERROR_STRIP_TRAILING_WHITESPACE" + "WORKING_DIRECTORY;TIMEOUT;RESULT_VARIABLE;RESULTS_VARIABLE;OUTPUT_VARIABLE;ERROR_VARIABLE;INPUT_FILE;OUTPUT_FILE;ERROR_FILE;ENCODING" + "COMMAND") + + # collect all other present parameters + set(other_args "") + foreach(arg OUTPUT_QUIET ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) + if(vcpkg_execute_in_download_mode_${arg}) + list(APPEND other_args ${arg}) + endif() + endforeach() + foreach(arg WORKING_DIRECTORY TIMEOUT RESULT_VARIABLE RESULTS_VARIABLE OUTPUT_VARIABLE ERROR_VARIABLE INPUT_FILE OUTPUT_FILE ERROR_FILE ENCODING) + if(vcpkg_execute_in_download_mode_${arg}) + list(APPEND other_args ${arg} ${vcpkg_execute_in_download_mode_${arg}}) + endif() + endforeach() + + if (DEFINED VCPKG_DOWNLOAD_MODE) + _execute_process(COMMAND ${vcpkg_execute_in_download_mode_COMMAND} ${other_args}) + else() + execute_process(COMMAND ${vcpkg_execute_in_download_mode_COMMAND} ${other_args}) + endif() + + # pass output parameters back to caller's scope + foreach(arg RESULT_VARIABLE RESULTS_VARIABLE OUTPUT_VARIABLE ERROR_VARIABLE) + if(vcpkg_execute_in_download_mode_${arg}) + set(${vcpkg_execute_in_download_mode_${arg}} ${${vcpkg_execute_in_download_mode_${arg}}} PARENT_SCOPE) + endif() + endforeach() +endfunction() diff --git a/scripts/cmake/vcpkg_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake index af5ab1e9e..b59675c35 100644 --- a/scripts/cmake/vcpkg_execute_required_process.cmake +++ b/scripts/cmake/vcpkg_execute_required_process.cmake @@ -36,7 +36,10 @@ ## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) ## * [boost](https://github.com/Microsoft/vcpkg/blob/master/ports/boost/portfile.cmake) ## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) + include(vcpkg_prettify_command) +include(vcpkg_execute_in_download_mode) + function(vcpkg_execute_required_process) 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") @@ -48,7 +51,6 @@ function(vcpkg_execute_required_process) 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 [[ @@ -57,7 +59,7 @@ Halting portfile execution. ]]) endif() - _execute_process( + vcpkg_execute_in_download_mode( COMMAND ${vcpkg_execute_required_process_COMMAND} OUTPUT_FILE ${LOG_OUT} ERROR_FILE ${LOG_ERR} diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 0a6158c77..e28cb4f8e 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -44,6 +44,9 @@ ## * [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake) ## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) ## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) + +include(vcpkg_execute_in_download_mode) + function(vcpkg_find_acquire_program VAR) set(EXPANDED_VAR ${${VAR}}) if(EXPANDED_VAR) @@ -563,18 +566,18 @@ function(vcpkg_find_acquire_program VAR) if(ARCHIVE_EXTENSION STREQUAL ".msi") file(TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH) file(TO_NATIVE_PATH "${PROG_PATH_SUBDIR}" DESTINATION_NATIVE_PATH) - _execute_process( + vcpkg_execute_in_download_mode( COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH} WORKING_DIRECTORY ${DOWNLOADS} ) elseif("${ARCHIVE_PATH}" MATCHES ".7z.exe$") vcpkg_find_acquire_program(7Z) - _execute_process( + vcpkg_execute_in_download_mode( COMMAND ${7Z} x "${ARCHIVE_PATH}" "-o${PROG_PATH_SUBDIR}" -y -bso0 -bsp0 WORKING_DIRECTORY ${PROG_PATH_SUBDIR} ) else() - _execute_process( + vcpkg_execute_in_download_mode( COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH} WORKING_DIRECTORY ${PROG_PATH_SUBDIR} ) diff --git a/scripts/cmake/vcpkg_from_git.cmake b/scripts/cmake/vcpkg_from_git.cmake index f114f6fc6..860e314c4 100644 --- a/scripts/cmake/vcpkg_from_git.cmake +++ b/scripts/cmake/vcpkg_from_git.cmake @@ -36,6 +36,8 @@ ## ## * [fdlibm](https://github.com/Microsoft/vcpkg/blob/master/ports/fdlibm/portfile.cmake) +include(vcpkg_execute_in_download_mode) + function(vcpkg_from_git) set(oneValueArgs OUT_SOURCE_PATH URL REF) set(multipleValuesArgs PATCHES) @@ -78,7 +80,7 @@ function(vcpkg_from_git) WORKING_DIRECTORY ${DOWNLOADS}/git-tmp LOGNAME git-fetch-${TARGET_TRIPLET} ) - _execute_process( + vcpkg_execute_in_download_mode( COMMAND ${GIT} rev-parse FETCH_HEAD OUTPUT_VARIABLE REV_PARSE_HEAD ERROR_VARIABLE REV_PARSE_HEAD diff --git a/scripts/cmake/vcpkg_from_gitlab.cmake b/scripts/cmake/vcpkg_from_gitlab.cmake index 44581ac6f..bb908e48a 100644 --- a/scripts/cmake/vcpkg_from_gitlab.cmake +++ b/scripts/cmake/vcpkg_from_gitlab.cmake @@ -61,6 +61,9 @@ ## * [folly](https://github.com/Microsoft/vcpkg/blob/master/ports/folly/portfile.cmake#L15) ## * [z3](https://github.com/Microsoft/vcpkg/blob/master/ports/z3/portfile.cmake#L13) ## + +include(vcpkg_execute_in_download_mode) + function(vcpkg_from_gitlab) set(oneValueArgs OUT_SOURCE_PATH GITLAB_URL USER REPO REF SHA512 HEAD_REF) set(multipleValuesArgs PATCHES) @@ -163,7 +166,7 @@ function(vcpkg_from_gitlab) endif() # There are issues with the Gitlab API project paths being URL-escaped, so we use git here to get the head revision - _execute_process(COMMAND ${GIT} ls-remote + vcpkg_execute_in_download_mode(COMMAND ${GIT} ls-remote "${GITLAB_LINK}.git" "${_vdud_HEAD_REF}" RESULT_VARIABLE _git_result OUTPUT_VARIABLE _git_output |
