From 55c29f1dca42705f60355c5bcb694cfa79999cce Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 9 Jan 2023 20:13:59 +0100 Subject: [PATCH] [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 --- .../vcpkg_execute_required_process.md | 14 ++++---- ports/vcpkg-cmake/vcpkg.json | 2 +- ports/vcpkg-cmake/vcpkg_cmake_configure.cmake | 4 ++- scripts/cmake/vcpkg_configure_cmake.cmake | 4 ++- .../vcpkg_execute_required_process.cmake | 36 +++++++++++++------ versions/baseline.json | 2 +- versions/v-/vcpkg-cmake.json | 5 +++ 7 files changed, 47 insertions(+), 20 deletions(-) diff --git a/docs/maintainers/vcpkg_execute_required_process.md b/docs/maintainers/vcpkg_execute_required_process.md index 7aaf5c45da..ee4390eeae 100644 --- a/docs/maintainers/vcpkg_execute_required_process.md +++ b/docs/maintainers/vcpkg_execute_required_process.md @@ -13,7 +13,7 @@ vcpkg_execute_required_process( [TIMEOUT ] [OUTPUT_VARIABLE ] [ERROR_VARIABLE ] - [SAVE_LOG_FILES [...]] + [SAVE_LOG_FILES [ALIAS ] [...]] ) ``` ## 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) diff --git a/ports/vcpkg-cmake/vcpkg.json b/ports/vcpkg-cmake/vcpkg.json index 9436382347..7481d9c26f 100644 --- a/ports/vcpkg-cmake/vcpkg.json +++ b/ports/vcpkg-cmake/vcpkg.json @@ -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" } diff --git a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake index 832bbf7007..5621300b36 100644 --- a/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake +++ b/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake @@ -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 diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 0f5d5e1d1e..77457f8288 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -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 diff --git a/scripts/cmake/vcpkg_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake index 0147b36437..830aa409fd 100644 --- a/scripts/cmake/vcpkg_execute_required_process.cmake +++ b/scripts/cmake/vcpkg_execute_required_process.cmake @@ -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 "") diff --git a/versions/baseline.json b/versions/baseline.json index cb4a3996d1..f967384487 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7897,7 +7897,7 @@ "port-version": 0 }, "vcpkg-cmake": { - "baseline": "2022-10-30", + "baseline": "2022-11-13", "port-version": 0 }, "vcpkg-cmake-config": { diff --git a/versions/v-/vcpkg-cmake.json b/versions/v-/vcpkg-cmake.json index c4e9e87bd6..196fdad368 100644 --- a/versions/v-/vcpkg-cmake.json +++ b/versions/v-/vcpkg-cmake.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3adf8df8d492adfc105a09c6e50b913e662178b6", + "version-date": "2022-11-13", + "port-version": 0 + }, { "git-tree": "063c28b7401ba0090497ba7b0931b2eb09b18a24", "version-date": "2022-10-30",