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

Warn on classic mode build failure if version constraints weren't met #494

Merged

Conversation

ras0219-msft
Copy link
Contributor

@ras0219-msft ras0219-msft commented Apr 8, 2022

This PR adds tracking for version constraints in classic mode so that they can be displayed to the user in case of a build failure. While it is by design that classic mode does not force users to rebuild dependencies that are out-of-date, knowing the version constraints is a big help for debugging.

The output could be rough in certain circumstances; it will display every non-identical broken constraint and won't deduplicate 'similar' ones. For example, if the immediate dependencies list contains 3 references to curl with constraints >= 2, >= 2, and >= 3, on build failure this would display two messages (one for >= 2 and one for >= 3). This more complex deduplication is challenging to prove correct because we don't have schema information for installed packages. That said, it seems reasonably pathologic to have multiple non-identical constraints in the same package manifest.

Finally, this only displays for install commands -- it does not display for any other command (e.g. build, ci, x-set-installed).

Diff from e2e test:

 [end-to-end-tests.ps1] [1/1] Running suite /workspaces/vcpkg-tool/azure-pipelines/end-to-end-tests-dir/classic-versions.ps1
 /workspaces/vcpkg-tool-build/vcpkg --triplet x64-linux --x-buildtrees-root=/workspaces/vcpkg-tool/testing/testing/buildtrees --x-install-root=/workspaces/vcpkg-tool/testing/testing/installed --x-packages-root=/workspaces/vcpkg-tool/testing/testing/packages --overlay-ports=/workspaces/vcpkg-tool/azure-pipelines/e2e_ports/overlays --overlay-triplets=/workspaces/vcpkg-tool/azure-pipelines/e2e_ports/triplets install classic-versions-b
 Computing installation plan...
 found constraint violation: warning: dependency classic-versions-a:x64-linux was expected to be at least version 2, but is currently 1.
 The following packages will be built and installed:
   * classic-versions-a[core]:x64-linux -> 1 -- /workspaces/vcpkg-tool/azure-pipelines/e2e_ports/overlays/classic-versions-a
     classic-versions-b[core]:x64-linux -> 1 -- /workspaces/vcpkg-tool/azure-pipelines/e2e_ports/overlays/classic-versions-b
 Additional packages (*) will be modified to complete this operation.
 Detecting compiler hash for triplet x64-linux...
 Restored 1 packages from /workspaces/.cache/vcpkg in 1.506 ms. Use --debug to see more details.
 Installing classic-versions-a:x64-linux... (1/2)...
 Elapsed time to handle classic-versions-a:x64-linux: 547.1 us
 Installing classic-versions-b:x64-linux... (2/2)...
 Building classic-versions-b[core]:x64-linux...
 -- Installing port from location: /workspaces/vcpkg-tool/azure-pipelines/e2e_ports/overlays/classic-versions-b
 CMake Error at /workspaces/vcpkg-tool/azure-pipelines/e2e_ports/overlays/classic-versions-b/portfile.cmake:1 (message):
   FATAL_ERROR
 Call Stack (most recent call first):
   scripts/ports.cmake:145 (include)
 
 
+warning: dependency classic-versions-a:x64-linux was expected to be at least version 2, but is currently 1.
 error: building classic-versions-b:x64-linux failed with: BUILD_FAILED
 Please ensure you're using the latest portfiles with `git pull` and `./vcpkg update`.
 Then check for known issues at:
   https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+classic-versions-b
 You can submit a new issue at:
   https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[classic-versions-b]+Build+error
 including:
   package: classic-versions-b[core]:x64-linux -> 1
     vcpkg-tool version: 2999-12-31-unknownhash-debug
     vcpkg-scripts version: 9e46bb072 2022-03-02 (5 weeks ago)
 
 Additionally, attach any relevant sections from the log files above.

While implementing this, I identified a regression introduced in #322 where VersionScheme::String's were being compared lexographically. I've reverted this to the intended behavior (either eq or unk) and added tests covering this case.

@ras0219-msft ras0219-msft merged commit 8b994b1 into microsoft:main Apr 8, 2022
@ras0219-msft ras0219-msft deleted the dev/roschuma/classic-versions branch April 8, 2022 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants