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 <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-05-07 01:11:18 +00:00
parent 43b749fe0b
commit 8024c87832
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 15 additions and 3 deletions

View File

@ -22,10 +22,22 @@ 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)
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()