From 8024c8783200c2c5cc897e30ca01b06a8f88f2b0 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 7 May 2020 01:11:18 +0000 Subject: [PATCH] Fix vcpkg upgrades. We upgrade only the first listed package to upgrade for vcpkg to not overrun the CI time limit. Sometimes these packages are up-to-date but are listed for rebuild due to depending on other packages that would be upgraded. Find the first package in the upgrade list that is not up-to-date and use that as the package to upgrade. Signed-off-by: Rafael Kitover --- cmake/Set-Toolchain-vcpkg.cmake | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index 2e257175..1e5800c4 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -22,9 +22,21 @@ function(vcpkg_get_first_upgrade vcpkg_exe) foreach(line ${upgrade_lines}) if(line MATCHES "^ [* ] ") - string(REGEX REPLACE "^ [* ] " "" first_upgrade ${line}) - set(first_upgrade ${first_upgrade} PARENT_SCOPE) - return() + string(REGEX REPLACE "^ [* ] " "" pkg ${line}) + + # Check if package is up-to-date, but would be rebuilt due to other dependencies. + execute_process( + COMMAND ${vcpkg_exe} upgrade ${pkg} + OUTPUT_VARIABLE pkg_upgrade + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + WORKING_DIRECTORY ${VCPKG_ROOT} + ) + + if(NOT pkg_upgrade MATCHES up-to-date) + set(first_upgrade ${pkg} PARENT_SCOPE) + return() + endif() endif() endforeach() endfunction()