-
Notifications
You must be signed in to change notification settings - Fork 295
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
Fix "build" for already installed ports. #492
Conversation
Resolves microsoft/vcpkg#13933 Rather than attempting to deal with the condition that the plan created thinks the thing we want to build is already installed, this version just "removes" the thing we want to build from the in-memory status database before creating the plan.
Rebuilding a package that's currently installed is insanely suspect, because the headers are very likely to collide with each other and produce weird results if they are different. I think a better approach here is to improve the error message from "Value was null" to "zlib:x64-windows is currently installed. You must remove zlib:x64-windows before building.". |
@@ -3,9 +3,9 @@ Computing installation plan...
The following packages will be built and installed:
vcpkg-hello-world-1[core]:x86-windows -> 0 -- C:\Dev\vcpkg-tool\azure-pipelines\e2e_ports\overlays\vcpkg-hello-world-1
Detecting compiler hash for triplet x86-windows...
-Restored 0 packages from C:\Users\billy\AppData\Local\vcpkg\archives in 119.6 us. Use --debug to see more details.
-Starting package 1/1: vcpkg-hello-world-1:x86-windows
-Building package vcpkg-hello-world-1[core]:x86-windows...
+Restored 0 packages from C:\Users\billy\AppData\Local\vcpkg\archives in 399.2 us. Use --debug to see more details.
+Installing vcpkg-hello-world-1:x86-windows... (1/1)...
+Building vcpkg-hello-world-1[core]:x86-windows...
-- Installing port from location: C:\Dev\vcpkg-tool\azure-pipelines\e2e_ports\overlays\vcpkg-hello-world-1
-- Found external ninja('1.10.2').
-- Configuring x86-windows
@@ -24,15 +24,11 @@ Call Stack (most recent call first):
error: building vcpkg-hello-world-1:x86-windows failed with: BUILD_FAILED
-Please ensure you're using the latest portfiles with `git pull` and `.\vcpkg update`.
+Please ensure you're using the latest port files 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+vcpkg-hello-world-1
+ https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+vcpkg-hello-world-1
You can submit a new issue at:
- https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[vcpkg-hello-world-1]+Build+error
-including:
- package: vcpkg-hello-world-1[core]:x86-windows -> 0
- vcpkg-tool version: 2022-03-30-692785ac944e81417840c6de244fb3e18a4b35eb
+ https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[vcpkg-hello-world-1]+Build+error
+Include '[vcpkg-hello-world-1] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
+ vcpkg-tool version: 2999-12-31-unknownhash-debug
vcpkg-scripts version: d72783cb3 2022-04-07 (28 hours ago)
-
-Additionally, attach any relevant sections from the log files above. |
const auto port_name = spec.package_spec.name(); | ||
const auto* scfl = provider.get_control_file(port_name).get(); | ||
|
||
Checks::check_maybe_upgrade(VCPKG_LINE_INFO, scfl != nullptr, "Error: Couldn't find port '%s'", port_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR is removing this error message, have you checked that the new error message along this path is still reasonable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!fs.exists(buildpath, IgnoreErrors{})) | ||
{ | ||
std::error_code err; | ||
fs.create_directory(buildpath, err); | ||
Checks::check_exit( | ||
VCPKG_LINE_INFO, !err.value(), "Failed to create directory '%s', code: %d", buildpath, err.value()); | ||
fs.create_directory(buildpath, VCPKG_LINE_INFO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual, this TOCTOU-esque pattern is unfortunate. It would be nice to have a simple fs.ensure_directory(buildpath, VCPKG_LINE_INFO)
that does the Right Thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure create_directory
already is that Right Thing (it isn't supposed to fail for existing directories) but doing that debugging seemed out of scope for this change.
Resolves microsoft/vcpkg#13933
Rather than attempting to deal with the condition that the plan created thinks the thing we want to build is already installed, this version just "removes" the thing we want to build from the in-memory status database before creating the plan.