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

Re-bootstrap vcpkg in manifest mode if updated #27692

Closed

Conversation

Neumann-A
Copy link
Contributor

@Neumann-A Neumann-A commented Nov 7, 2022

Solves: People being annoyed manually deleting vcpkg${CMAKE_EXECUTABLE_SUFFIX}
Solves: Issues due to vcpkg_minimum_required since you will always use latest vcpkg now!

closes #27635

github-actions[bot]
github-actions bot previously approved these changes Nov 7, 2022
@autoantwort
Copy link
Contributor

We need a way to disable this. Where I worked we had to use a self compiled version of vcpkg because of #25521. If this is merged the version is replaced with the broken version distributed by Microsoft. So an option to disable this automatically update is welcomed.

@Neumann-A
Copy link
Contributor Author

If this is merged the version is replaced with the broken version distributed by Microsoft.

Unless your version is higher than the one from the bootstrap script which you probably always want. If you update vcpkg repo you probably want to recompile your vcpkg-tool and bump the version.

So I also thought about providing an option to disable it but from the cases I thought of it was always like -> requires an update of vcpkg-tool any way.

@Neumann-A
Copy link
Contributor Author

same baseline issue as #27689

@Adela0814 Adela0814 added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Nov 8, 2022
ERROR_VARIABLE Z_VCPKG_MANIFEST_VERSION_LOGTEXT
RESULT_VARIABLE Z_VCPKG_MANIFEST_VERSION_RESULT
)
string(REGEX MATCH "program version ([0-9][0-9][0-9][0-9]-[0-9]?[0-9]-[0-9]?[0-9])" z_vcpkg_ver_bin "${Z_VCPKG_MANIFEST_VERSION_LOGTEXT}")
Copy link
Member

Choose a reason for hiding this comment

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

This won't do the right thing when localized :(

Copy link
Contributor Author

@Neumann-A Neumann-A Nov 8, 2022

Choose a reason for hiding this comment

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

Give me --version-only cli. I never get why ms programs are always so verbose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also: will currently do the correct thing. Localization is in the future and a problem for someone else.

Copy link
Member

Choose a reason for hiding this comment

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

Localization is not "in the future", this is broken with vcpkg-tool@main.

Copy link
Member

@vicroms vicroms Nov 8, 2022

Choose a reason for hiding this comment

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

We could use the semi-standard --x-json:

C:\vcpkg> ./vcpkg version --x-json
{
  "version": "2022-10-17-3247920fbdd47d08f36cbd480addd9890d3c2435"
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that @ras0219-msft has laid out the appropriate course of action. @Neumann-A, please let us know if you would like to continue with @ras0219-ms suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

One problem with --z-require-version to keep in mind is that old versions will simply error out because they don't know the --z-require-version switch. And you can't differentiate this error from a normal installation fails error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JavierMatosD I rather take the --x-json approach than the new cmd line switch stuff. If the process invoke is so a big issue I could use a file(TIMESTAMP <filename> <variable> [<format>] [UTC]) (is available in CMake 3.7.2) of the bootstrap and vcpkg binary and observe changes to these files if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could use the semi-standard --x-json:

C:\vcpkg> ./vcpkg version --x-json
{
  "version": "2022-10-17-3247920fbdd47d08f36cbd480addd9890d3c2435"
}

That doesn't exist?

Copy link
Member

@BillyONeal BillyONeal Feb 2, 2023

Choose a reason for hiding this comment

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

One problem with --z-require-version to keep in mind is that old versions will simply error out because they don't know the --z-require-version switch. And you can't differentiate this error from a normal installation fails error.

We could interpret failing to run that as more-or-less unconditionally too old. (For example with a specific command added for this purpose)

@Adela0814 Adela0814 added the info:reviewed Pull Request changes follow basic guidelines label Nov 28, 2022
@JavierMatosD JavierMatosD added requires:author-response and removed info:reviewed Pull Request changes follow basic guidelines labels Nov 28, 2022
@Neumann-A
Copy link
Contributor Author

@JavierMatosD I disagree #27692 (comment) is not implementable for current users. You can add the mentioned functionallity to vcpkg-tool first and after a year switch the behavior. But currently there is no other way to implement and auto update mechanism.

@Adela0814
Copy link
Contributor

@JavierMatosD Please review this PR again. Thanks.

@quyykk quyykk mentioned this pull request Jan 7, 2023
@Adela0814 Adela0814 added info:reviewed Pull Request changes follow basic guidelines and removed requires:author-response labels Jan 31, 2023
@BillyONeal BillyONeal added requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. and removed info:reviewed Pull Request changes follow basic guidelines labels Jan 31, 2023
@BillyONeal
Copy link
Member

We'll take a look at this one more time but I don't think the read on the situation has changed.

@BillyONeal
Copy link
Member

@ras0219-msft @dan-shaw @JavierMatosD and I discussed this today.

Let's break the problem trying to be solved here apart.

  1. Updating the copy of vcpkg.exe for the user for them by rerunning bootstrap if they have somehow switched to an incompatible version.
  2. Not giving the user an inconsistent installed state because we are running with an old copy of vcpkg that does not know how to provide something.

We observe that solving (2) can already be achieved without building any new tech by bumping the vcpkg_minimum_required in ports.cmake here:

vcpkg_minimum_required(VERSION 2022-10-12)

This does mean that if we actually build something the UX is slightly worse than the solution proposed here because the result will be an error message "please go update vcpkg" rather than updating it for them, which is case (1) above.

Regarding case (1), we have a host of bad tradeoffs:

  • Attempting to inspect anything about stdout in a normal command invocation is going to be vulnerable to localization.
  • Attempting to change the exit code to something different is going to require substantial plumbing inside the tool to change the success case exit code.
  • Running the tool again (as is done here with version) or with some form of version check command adds a minimum ~40ms cost to every cmake configure that uses vcpkg.cmake on Windows.

Speaking personally, I think that leaves us with at least 4 choices:

  1. We don't care about solving problem (1) above; we will just always bump ports.cmake's constraint every time we ship a new tool.
  2. We pay the additional cost for another command (for example vcpkg z-check-that-my-version-is-blah EXPECTEDVERSION) that can do the version check. (It probably shouldn't use the existing version command as proposed here unless we can make absolutely positively sure that that would not be vulnerable to being broken by localization).
  3. We build some other form of back channel and a new switch that activates that back channel, such as "hey vcpkg if your version is OK but there's a failure please touch this file to say the version was OK"
  4. (This came late :P) We could pass the --z-require-version to install as requested above and only try to interrogate the version (as in (2)) on failure to disambiguate between 'failed because version mismatch' and 'failed because installing the dependencies failed'

Stack ranking our preferences:

  • @ras0219-msft (4) (2) (3) (1) (Also, we should do (1) regardless of whether we do (2) or (3))
  • @dan-shaw Same as @ras0219-msft, "I think we need to fix the issue somehow" (opposed to (1))
  • @JavierMatosD (4), no preference between (1) and (2), opposed to (3)
  • @BillyONeal (4), (1), then (2), opposed to (3)

@BillyONeal BillyONeal added requires:author-response and removed requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. labels Feb 2, 2023
@Neumann-A
Copy link
Contributor Author

Stack ranking our preferences:

so you want 4 which requires a tool PR. Got it.

@Neumann-A Neumann-A marked this pull request as draft February 2, 2023 22:31
@Adela0814
Copy link
Contributor

Adela0814 commented May 5, 2023

@Neumann-A If you are ready to review, please active this PR.

@Neumann-A
Copy link
Contributor Author

@Neumann-A If you are ready to review, please active this PR.

As stated in #27692 (comment) the teams wants 4 so unless that has been implemented in the tool there is currently no way forward for this PR which is why this PR stays in Draft mode.

@Adela0814
Copy link
Contributor

Closing this PR since it seems that no progress is being made. Please ping us to reopen if work is still being done.

@Adela0814 Adela0814 closed this Jan 8, 2024
@Neumann-A Neumann-A deleted the rebootstrap_outdated_vcpkg branch November 13, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vcpkg CMake toolchain should update the vcpkg executable automatically
7 participants