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

Conversation

emptyVoid
Copy link
Contributor

Describe the pull request
Adjusts vcpkg_acquire_msys script to install the new keyring (see MSYS2 News).

@MVoz
Copy link
Contributor

MVoz commented Jul 17, 2020

in my opinion this option is better

rm -r /etc/pacman.d/gnupg/
pacman-key --init
pacman-key --populate

@LilyWangL LilyWangL self-assigned this Jul 20, 2020
@LilyWangL LilyWangL added category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed requires:discussion labels Jul 20, 2020
@elieux
Copy link

elieux commented Jul 20, 2020

in my opinion this option is better

rm -r /etc/pacman.d/gnupg/
pacman-key --init
pacman-key --populate

Better than what? Your commands don't install the new keys (we're starting with a clean 20190524 installation).

@MVoz
Copy link
Contributor

MVoz commented Jul 20, 2020

@elieux https://www.msys2.org/news/#2020-06-29-new-packagers

2020-06-29-new-packagers

If you still see signature errors, resetting your pacman key store might help:

rm -r /etc/pacman.d/gnupg/
pacman-key --init
pacman-key --populate msys2

@elieux 2020-06-29-new-packagers

@elieux
Copy link

elieux commented Jul 20, 2020

Yes, but this makes sense only after the new keyring is installed. It's not either/or, it's "do the first step, then maybe the second one".

@MVoz
Copy link
Contributor

MVoz commented Jul 20, 2020

Yes what? what do you mean in General?
if the distribution is outdated and the keys do not fit and are not updated, then they must be deleted and updated before installing the packages\utilities

@elieux
Copy link

elieux commented Jul 20, 2020

Yes what?

Yes, I wrote those steps. But I don't think you understand when to use them.

they must be deleted and updated before installing the packages\utilities

No need to delete. Update is taken care of by installing the new keyring (which this PR is about). See also https://github.com/msys2/MSYS2-packages/blob/master/msys2-keyring/msys2-keyring.install.

@MVoz
Copy link
Contributor

MVoz commented Jul 20, 2020

But I don't think you understand when to use them.

good luck to you, you are so smart 😂

@elieux
Copy link

elieux commented Jul 20, 2020

@voskrese, it wasn't meant as a conversation stopper. If you have reasons to believe nuking the GPG directory is necessary, please state them.

@LilyWangL, what kind of discussion is expected ("required") here?

@MVoz
Copy link
Contributor

MVoz commented Jul 21, 2020

@elieux

I think you take a lot on yourself, this error occurred only to you, you may have edited the settings files incorrectly

old version work

new version work

vcpkg_acquire_msys

@elieux
Copy link

elieux commented Jul 24, 2020

Just letting you know we have uploaded a new msys-x86_64 database, signed with a new key. mingw databases will probably follow.

@yasamoka
Copy link

yasamoka commented Jul 24, 2020

@elieux
I think you take a lot on yourself, this error occurred only to you, you may have edited the settings files incorrectly
old version work
new version work
vcpkg_acquire_msys

No … this didn't occur only to him …

The exact same error just occurred to me now. Fresh clone of vcpkg, installing packages from scratch.

There is no configuration that I could have messed up as I didn't even do anything beyond bootstrapping and installing some packages.

I would tone down the attitude, read well, and urge to fix this as fast as possible if I were you.

@coryan
Copy link
Contributor

coryan commented Jul 24, 2020

Looking forward to this fix myself, I cannot use vcpkg right now either.

@yasamoka
Copy link

yasamoka commented Jul 25, 2020

Given I am facing this issue and no solution except the following (mentioned here) is working for me:

... you have to convince pacman to not care about those databases for a while, for example like this:

# pacman -U --config <(echo) msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz

With my limited understanding of this sort of work, I have added a workaround here based on this pull request. Feel free to use it if you urgently need to use vcpkg to build packages that rely on MSYS in the meantime.

As usual with these sorts of workarounds, I take no responsibility for any consequences arising out of using this. This is strictly temporary.

@c72578 c72578 mentioned this pull request Jul 25, 2020
@c72578
Copy link
Contributor

c72578 commented Jul 25, 2020

@emptyVoid Could you please check, if this PR still fixes the issue?
I just did some tests under Windows 10 with installed VS2019 and using a clean, up-to-date vcpkg including this PR.
The error below appears, when building bzip2.

git clone https://github.com/microsoft/vcpkg.git
cd .\vcpkg\
git fetch origin pull/12467/head:PR_12467
git checkout PR_12467
git rebase master
Successfully rebased and updated refs/heads/PR_12467.
.\bootstrap-vcpkg.bat
.\vcpkg.exe install bzip2:x64-windows
...
  • Error:
...
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Fixing pkgconfig
-- Acquiring MSYS2...
-- Downloading https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20190524.tar.xz/download...
-- Downloading http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz...
-- Downloading http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig...
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
gpg: Generating pacman keyring master key...
gpg: key 5C587674F90CFE24 marked as ultimately trusted
gpg: directory '/etc/pacman.d/gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/etc/pacman.d/gnupg/openpgp-revocs.d/D3436DA32F8C65745315E2165C587674F90CFE24.rev'
gpg: Done
==> Updating trust database...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Appending keys from msys2.gpg...
==> Locally signing trusted keys in keyring...
  -> Locally signing key D55E7A6D7CE9BA1587C0ACACF40D263ECA25678A...
  -> Locally signing key 123D4D51A1793859C2BE916BBBE514E53E0D0813...
  -> Locally signing key B91BCF3303284BF90CC043CA9F418C233E652008...
  -> Locally signing key 9DD0D4217D75A33B896159E6DA7EF2ABAEEA755C...
==> Importing owner trust values...
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
==> Updating trust database...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   4  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   4  signed:   3  trust: 0-, 0q, 0n, 4m, 0f, 0u
gpg: depth: 2  valid:   3  signed:   0  trust: 3-, 0q, 0n, 0m, 0f, 0u
==> Checking vcpkg/downloads/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig...
gpg: assuming signed data in 'vcpkg/downloads/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz'
gpg: Signature made Mon Jun 29 07:36:14 2020 WEDT
gpg:                using DSA key AD351C50AE085775EB59333B5F92EFC1A47D45A1
gpg: Good signature from "Alexey Pavlov (Alexpux) <alexpux@gmail.com>" [full]
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) msys2-keyring-r21.b39fb11-1

Total Installed Size:  0.05 MiB
Net Upgrade Size:      0.03 MiB

:: Proceed with installation? [Y/n] :: Synchronizing package databases...
downloading mingw32.db...
downloading mingw32.db.sig...
downloading mingw64.db...
downloading mingw64.db.sig...
downloading msys.db...
downloading msys.db.sig...
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update msys (invalid or corrupted database (PGP signature))
error: failed to synchronize all databases
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
checking dependencies...

Packages (2) rebase-4.4.4-1  dash-0.5.10.2-1

Total Removed Size:  1.12 MiB

:: Do you want to remove these packages? [Y/n]
:: Processing package changes...
removing rebase...
removing dash...
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
:: Synchronizing package databases...
 mingw32 is up to date
 mingw64 is up to date
downloading msys.db...
downloading msys.db.sig...
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update msys (invalid or corrupted database (PGP signature))
error: failed to synchronize all databases
-- Acquiring MSYS2... OK
-- Acquiring MSYS Packages...
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
    Command failed: vcpkg/downloads/tools/msys2/msys64/usr/bin/bash.exe --noprofile --norc -c "pacman -S --noconfirm --needed pkg-config"
    Working Directory: vcpkg/downloads/tools/msys2
    Error code: 1
    See logs for more information:
      vcpkg\buildtrees\bzip2\msys-pacman-x64-windows-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_acquire_msys.cmake:149 (vcpkg_execute_required_process)
  scripts/cmake/vcpkg_fixup_pkgconfig.cmake:281 (vcpkg_acquire_msys)
  ports/bzip2/portfile.cmake:51 (vcpkg_fixup_pkgconfig)
  scripts/ports.cmake:79 (include)

msys-pacman-x64-windows-err.log

@@ -91,6 +104,15 @@ 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.

@elieux
Copy link

elieux commented Jul 25, 2020

@c72578, thanks for noticing and reporting this. It didn't occur to me to check for this.

@MVoz
Copy link
Contributor

MVoz commented Jul 26, 2020

@yasamoka
no need to cheat, just because is a new version and not there can be problems with certificates

@emptyVoid
Copy link
Contributor Author

@c72578, should work now, can you check on your side please?

@MVoz
Copy link
Contributor

MVoz commented Jul 26, 2020

and in general it is necessary to MSYS to update and provide all possible variants of errors and fix them in advance in the script

@c72578
Copy link
Contributor

c72578 commented Jul 26, 2020

@c72578, should work now, can you check on your side please?

Thanks for updating the PR. It is OK now.
I just tested it building bzip2:x64-windows as described above.

@JackBoosY JackBoosY added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Jul 27, 2020
@JackBoosY
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@microsoft microsoft deleted a comment from azure-pipelines bot Jul 27, 2020
@microsoft microsoft deleted a comment from azure-pipelines bot Jul 27, 2020
@JackBoosY JackBoosY linked an issue Jul 27, 2020 that may be closed by this pull request
@JackBoosY JackBoosY linked an issue Jul 27, 2020 that may be closed by this pull request
@JackBoosY
Copy link
Contributor

It seems that the pipeline test is completely broken... needs to fix it.

@cenit cenit mentioned this pull request Jul 28, 2020
@angelo-peronio
Copy link

With my limited understanding of this sort of work, I have added a workaround here based on this pull request. Feel free to use it if you urgently need to use vcpkg to build packages that rely on MSYS in the meantime.

@yasamoka You saved my day, thank you! I used your workaround like this:

cd vcpkg
git remote add msys2-hotfix https://github.com/yasamoka/vcpkg.git
git fetch msys2-hotfix
git cherry-pick abc0b6

@yasamoka
Copy link

yasamoka commented Jul 28, 2020

With my limited understanding of this sort of work, I have added a workaround here based on this pull request. Feel free to use it if you urgently need to use vcpkg to build packages that rely on MSYS in the meantime.

@yasamoka You saved my day, thank you! I used your workaround like this:

cd vcpkg
git remote add msys2-hotfix https://github.com/yasamoka/vcpkg.git
git fetch msys2-hotfix
git cherry-pick abc0b6

Glad to have helped! Do note that the latest commits to this PR include the fix, so as soon as the PR gets accepted, we should be good to go.

@strega-nil
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
10 participants