Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg-acquire-msys] Install new keyring #12467

Merged
merged 1 commit into from
Jul 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions scripts/cmake/vcpkg_acquire_msys.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
SHA512 ${HASH}
)

# download the new keyring, without it new packages and package updates
# might not install
vcpkg_download_distfile(KEYRING_PATH
URLS http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
FILENAME msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
SHA512 a5023fd17ccf6364bc6e27c5e63aea25f1fc264a5247cbae4008864c828c38c3e0b4de09ded650e28d2e24e319b5fcf7a9c0da0fa3a8ac81679470fc6bd120c9
)
vcpkg_download_distfile(KEYRING_SIG_PATH
URLS http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig
FILENAME msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig
SHA512 c326fefd13f58339afe0d0dc78306aa6ab27cafa8c4d792c2d34aa81fdd1f759d490990ab79daa9664a03a6dfa14ffd2b2ad828bf19a883410112d01f5ed6c4c
)

file(REMOVE_RECURSE ${TOOLPATH}/${TOOLSUBPATH})
file(MAKE_DIRECTORY ${TOOLPATH})
_execute_process(
Expand All @@ -91,6 +104,19 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman-key --init;pacman-key --populate"
WORKING_DIRECTORY ${TOOLPATH}
)
# install the new keyring
_execute_process(
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman-key --verify ${KEYRING_SIG_PATH}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the result somehow verified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it checks the error code -- I assume pacman-key returns some non-zero code if verification fails.

WORKING_DIRECTORY ${TOOLPATH}
RESULT_VARIABLE _vam_error_code
)
if(_vam_error_code)
message(FATAL_ERROR "Cannot verify MSYS2 keyring.")
endif()
_execute_process(
COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -U ${KEYRING_PATH} --noconfirm"
WORKING_DIRECTORY ${TOOLPATH}
)
# we have to kill all GnuPG daemons otherwise bash would potentially not be
# able to start after the core system upgrade, additionally vcpkg would
# likely hang waiting for spawned processes to exit
Expand Down