[scripts|world rebuild] Disambiguate saved log files (#26754)

* Disambiguate saved log files

* CI [skip actions]

* CI [skip actions]

* CI [skip actions]

* Use ALIAS keyword instead of auto-numbering

* Update versions
This commit is contained in:
Kai Pastor 2023-01-09 20:13:59 +01:00 committed by GitHub
parent 8f2ffdfbf9
commit 55c29f1dca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 20 deletions

View file

@ -13,7 +13,7 @@ vcpkg_execute_required_process(
[TIMEOUT <seconds>]
[OUTPUT_VARIABLE <var>]
[ERROR_VARIABLE <var>]
[SAVE_LOG_FILES <relative-path> [<relative-path>...]]
[SAVE_LOG_FILES <relative-path> [ALIAS <unique-alias>] [<relative-path>...]]
)
```
## Parameters
@ -45,16 +45,18 @@ This should be a unique name for different triplets so that the logs don't confl
Optional files to be moved from the working directory to `${CURRENT_BUILDTREES_DIR}`.
The files are copied even if the process failed.
The target file names are constructed from the `LOGNAME` parameter and the source filename.
If the target file name doesn't end in `.log`, this suffix is appended.
This helps to collect relevant log files in CI setups.
The target filename is constructed from the `LOGNAME` parameter and the parameter of the `ALIAS` keyword following the source path.
If `ALIAS` is absent, the target filename is constructed from the `LOGNAME` parameter, the source filename,
and the suffix `.log` if the source filename doesn't already end with this suffix.
## Examples
* [boost-build](https://github.com/Microsoft/vcpkg/blob/master/ports/boost-build/portfile.cmake)
* [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake)
* [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)
* [qt5-base](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5-base/cmake/configure_qt.cmake)
* [vcpkg-cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake)
## Source
[scripts/cmake/vcpkg\_execute\_required\_process.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_execute_required_process.cmake)

View file

@ -1,6 +1,6 @@
{
"name": "vcpkg-cmake",
"version-date": "2022-10-30",
"version-date": "2022-11-13",
"documentation": "https://vcpkg.io/en/docs/maintainers/ports/vcpkg-cmake.html",
"license": "MIT"
}

View file

@ -248,7 +248,9 @@ function(vcpkg_cmake_configure)
COMMAND "${NINJA}" -v
WORKING_DIRECTORY "${build_dir_release}/vcpkg-parallel-configure"
LOGNAME "${arg_LOGFILE_BASE}"
SAVE_LOG_FILES ../../${TARGET_TRIPLET}-dbg/CMakeCache.txt ../CMakeCache.txt
SAVE_LOG_FILES
"../../${TARGET_TRIPLET}-dbg/CMakeCache.txt" ALIAS "dbg-CMakeCache.txt.log"
"../CMakeCache.txt" ALIAS "rel-CMakeCache.txt.log"
)
vcpkg_list(APPEND config_logs

View file

@ -312,7 +312,9 @@ function(vcpkg_configure_cmake)
COMMAND "${NINJA}" -v
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure"
LOGNAME "${arg_LOGNAME}"
SAVE_LOG_FILES ../../${TARGET_TRIPLET}-dbg/CMakeCache.txt ../CMakeCache.txt
SAVE_LOG_FILES
"../../${TARGET_TRIPLET}-dbg/CMakeCache.txt" ALIAS "dbg-CMakeCache.txt.log"
"../CMakeCache.txt" ALIAS "rel-CMakeCache.txt.log"
)
vcpkg_list(APPEND config_logs

View file

@ -65,18 +65,34 @@ Halting portfile execution.
${output_variable_param}
${error_variable_param}
)
vcpkg_list(SET logfiles)
vcpkg_list(SET logfile_copies)
set(expect_alias FALSE)
foreach(item IN LISTS arg_SAVE_LOG_FILES)
if(expect_alias)
vcpkg_list(POP_BACK logfile_copies)
vcpkg_list(APPEND logfile_copies "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-${item}")
set(expect_alias FALSE)
elseif(item STREQUAL "ALIAS")
if(NOT logfiles)
message(FATAL_ERROR "ALIAS used without source file")
endif()
set(expect_alias TRUE)
else()
vcpkg_list(APPEND logfiles "${arg_WORKING_DIRECTORY}/${item}")
cmake_path(GET item FILENAME filename)
if(NOT filename MATCHES "[.]log\$")
string(APPEND filename ".log")
endif()
vcpkg_list(APPEND logfile_copies "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-${filename}")
endif()
endforeach()
vcpkg_list(SET saved_logs)
foreach(logfile IN LISTS arg_SAVE_LOG_FILES)
set(filepath "${arg_WORKING_DIRECTORY}/${logfile}")
if(NOT EXISTS "${filepath}")
continue()
foreach(logfile logfile_copy IN ZIP_LISTS logfiles logfile_copies)
if(EXISTS "${logfile}")
configure_file("${logfile}" "${logfile_copy}" COPYONLY)
vcpkg_list(APPEND saved_logs "${logfile_copy}")
endif()
cmake_path(GET filepath FILENAME filename)
if(NOT filename MATCHES "[.]log\$")
string(APPEND filename ".log")
endif()
configure_file("${filepath}" "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-${filename}" COPYONLY)
vcpkg_list(APPEND saved_logs "${CURRENT_BUILDTREES_DIR}/${arg_LOGNAME}-${filename}")
endforeach()
if(NOT error_code EQUAL 0)
set(stringified_logs "")

View file

@ -7897,7 +7897,7 @@
"port-version": 0
},
"vcpkg-cmake": {
"baseline": "2022-10-30",
"baseline": "2022-11-13",
"port-version": 0
},
"vcpkg-cmake-config": {

View file

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3adf8df8d492adfc105a09c6e50b913e662178b6",
"version-date": "2022-11-13",
"port-version": 0
},
{
"git-tree": "063c28b7401ba0090497ba7b0931b2eb09b18a24",
"version-date": "2022-10-30",