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

Install successful installs even with --only-downloads. #901

Merged
merged 5 commits into from
Mar 7, 2023

Conversation

BillyONeal
Copy link
Member

Drive-by: Make set-installed accept --only-downloads.

"Download only" mode works by marking execute_process and friends to fail instantly when a port is run, and we just hope the vcpkg_from_Xxx is reached before that failure happens. Then, we didn't install the result, even if it "succeeded".

This failed for ports which put their "get" operation into a helper port, since the helper cmake script dependent ports were expecting to use was unavailable.

Before:

PS C:\Dev\vcpkg> .\vcpkg.exe install ignition-math4 --only-downloads
Computing installation plan...
The following packages will be built and installed:
  * ignition-cmake0[core]:x86-windows -> 0.6.2#4
    ignition-math4[core]:x86-windows -> 4.0.0#3
  * ignition-modularscripts[core]:x64-windows -> 2022-05-11#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Installing 1/3 ignition-modularscripts:x64-windows...
Building ignition-modularscripts[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/ignition-modularscripts_x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake
Downloaded sources for ignition-modularscripts[core]:x64-windows
Elapsed time to handle ignition-modularscripts:x64-windows: 51.88 ms
Installing 2/3 ignition-cmake0:x86-windows...
Building ignition-cmake0[core]:x86-windows...
CMake Error at ports/ignition-cmake0/portfile.cmake:3 (ignition_modular_library):
  Unknown CMake command "ignition_modular_library".
Call Stack (most recent call first):
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-cmake0[core]:x86-windows
Elapsed time to handle ignition-cmake0:x86-windows: 43.37 ms
Installing 3/3 ignition-math4:x86-windows...
Building ignition-math4[core]:x86-windows...
CMake Error at ports/ignition-math4/portfile.cmake:1 (ignition_modular_library):
  Unknown CMake command "ignition_modular_library".
Call Stack (most recent call first):
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-math4[core]:x86-windows
Elapsed time to handle ignition-math4:x86-windows: 43.78 ms
Total install time: 4.206 s
RESULTS
    ignition-modularscripts:x64-windows: DOWNLOADED: 51.88 ms
    ignition-cmake0:x86-windows: DOWNLOADED: 43.37 ms
    ignition-math4:x86-windows: DOWNLOADED: 43.78 ms

SUMMARY FOR x64-windows
    DOWNLOADED: 1
SUMMARY FOR x86-windows
    DOWNLOADED: 2
PS C:\Dev\vcpkg>

After:

PS C:\Dev\vcpkg> C:\Dev\vcpkg-tool\out\build\x64-Debug\vcpkg.exe install ignition-math4 --only-downloads
Computing installation plan...
The following packages will be built and installed:
  * ignition-cmake0[core]:x86-windows -> 0.6.2#4
    ignition-math4[core]:x86-windows -> 4.0.0#3
  * ignition-modularscripts[core]:x64-windows -> 2022-05-11#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Installing 1/3 ignition-modularscripts:x64-windows...
Building ignition-modularscripts[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/ignition-modularscripts_x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake
-- Performing post-build validation
Elapsed time to handle ignition-modularscripts:x64-windows: 63.08 ms
Installing 2/3 ignition-cmake0:x86-windows...
Building ignition-cmake0[core]:x86-windows...
-- Downloading https://github.com/ignitionrobotics/ign-cmake/archive/ignition-cmake_0.6.1.tar.gz -> ignitionrobotics-ign-cmake-ignition-cmake_0.6.1-1.tar.gz...
-- Extracting source C:/Dev/vcpkg/downloads/ignitionrobotics-ign-cmake-ignition-cmake_0.6.1-1.tar.gz
-- Applying patch do-not-compile-gtest.patch
-- Applying patch support-arm64.patch
-- Applying patch uuid-do-not-require-pkg-config.patch
-- Applying patch fix-find-ign-curl.patch
-- Using source at C:/Dev/vcpkg/buildtrees/ignition-cmake0/src/make_0.6.1-6417790457.clean
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/Dev/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Found external ninja('1.11.0').
-- Configuring x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:23 (message):
  This command cannot be executed in Download Mode.

  Halting portfile execution.

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:326 (vcpkg_execute_required_process)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:8 (vcpkg_configure_cmake)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:160 (ignition_modular_build_library)
  ports/ignition-cmake0/portfile.cmake:3 (ignition_modular_library)
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-cmake0[core]:x86-windows
Elapsed time to handle ignition-cmake0:x86-windows: 1.004 s
Installing 3/3 ignition-math4:x86-windows...
Building ignition-math4[core]:x86-windows...
-- Downloading https://github.com/ignitionrobotics/ign-math/archive/ignition-math4_4.0.0.tar.gz -> ignitionrobotics-ign-math-ignition-math4_4.0.0-1.tar.gz...
-- Extracting source C:/Dev/vcpkg/downloads/ignitionrobotics-ign-math-ignition-math4_4.0.0-1.tar.gz
-- Using source at C:/Dev/vcpkg/buildtrees/ignition-math4/src/ath4_4.0.0-89bdbdf369.clean
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/Dev/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Found external ninja('1.11.0').
-- Configuring x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:23 (message):
  This command cannot be executed in Download Mode.

  Halting portfile execution.

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:326 (vcpkg_execute_required_process)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:8 (vcpkg_configure_cmake)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:160 (ignition_modular_build_library)
  ports/ignition-math4/portfile.cmake:1 (ignition_modular_library)
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-math4[core]:x86-windows
Elapsed time to handle ignition-math4:x86-windows: 965.5 ms
Total install time: 5.452 s
RESULTS
    ignition-modularscripts:x64-windows: SUCCEEDED: 63.08 ms
    ignition-cmake0:x86-windows: DOWNLOADED: 1.004 s
    ignition-math4:x86-windows: DOWNLOADED: 965.5 ms

SUMMARY FOR x64-windows
    SUCCEEDED: 1
SUMMARY FOR x86-windows
    DOWNLOADED: 2
PS C:\Dev\vcpkg>

Observe that in the before we failed to download the sources of ignition-cmake0 and ignition-math4.

Drive-by: Make set-installed accept --only-downloads.

"Download only" mode works by marking execute_process and friends to fail instantly when a port is run, and we just hope the `vcpkg_from_Xxx` is reached before that failure happens. Then, we didn't install the result, even if it "succeeded".

This failed for ports which put their "get" operation into a helper port, since the helper cmake script dependent ports were expecting to use was unavailable.

Before:

```
PS C:\Dev\vcpkg> .\vcpkg.exe install ignition-math4 --only-downloads
Computing installation plan...
The following packages will be built and installed:
  * ignition-cmake0[core]:x86-windows -> 0.6.2#4
    ignition-math4[core]:x86-windows -> 4.0.0#3
  * ignition-modularscripts[core]:x64-windows -> 2022-05-11#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Installing 1/3 ignition-modularscripts:x64-windows...
Building ignition-modularscripts[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/ignition-modularscripts_x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake
Downloaded sources for ignition-modularscripts[core]:x64-windows
Elapsed time to handle ignition-modularscripts:x64-windows: 51.88 ms
Installing 2/3 ignition-cmake0:x86-windows...
Building ignition-cmake0[core]:x86-windows...
CMake Error at ports/ignition-cmake0/portfile.cmake:3 (ignition_modular_library):
  Unknown CMake command "ignition_modular_library".
Call Stack (most recent call first):
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-cmake0[core]:x86-windows
Elapsed time to handle ignition-cmake0:x86-windows: 43.37 ms
Installing 3/3 ignition-math4:x86-windows...
Building ignition-math4[core]:x86-windows...
CMake Error at ports/ignition-math4/portfile.cmake:1 (ignition_modular_library):
  Unknown CMake command "ignition_modular_library".
Call Stack (most recent call first):
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-math4[core]:x86-windows
Elapsed time to handle ignition-math4:x86-windows: 43.78 ms
Total install time: 4.206 s
RESULTS
    ignition-modularscripts:x64-windows: DOWNLOADED: 51.88 ms
    ignition-cmake0:x86-windows: DOWNLOADED: 43.37 ms
    ignition-math4:x86-windows: DOWNLOADED: 43.78 ms

SUMMARY FOR x64-windows
    DOWNLOADED: 1
SUMMARY FOR x86-windows
    DOWNLOADED: 2
PS C:\Dev\vcpkg>
```

After:
```
PS C:\Dev\vcpkg> C:\Dev\vcpkg-tool\out\build\x64-Debug\vcpkg.exe install ignition-math4 --only-downloads
Computing installation plan...
The following packages will be built and installed:
  * ignition-cmake0[core]:x86-windows -> 0.6.2#4
    ignition-math4[core]:x86-windows -> 4.0.0#3
  * ignition-modularscripts[core]:x64-windows -> 2022-05-11#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Installing 1/3 ignition-modularscripts:x64-windows...
Building ignition-modularscripts[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/ignition-modularscripts_x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake
-- Performing post-build validation
Elapsed time to handle ignition-modularscripts:x64-windows: 63.08 ms
Installing 2/3 ignition-cmake0:x86-windows...
Building ignition-cmake0[core]:x86-windows...
-- Downloading https://github.com/ignitionrobotics/ign-cmake/archive/ignition-cmake_0.6.1.tar.gz -> ignitionrobotics-ign-cmake-ignition-cmake_0.6.1-1.tar.gz...
-- Extracting source C:/Dev/vcpkg/downloads/ignitionrobotics-ign-cmake-ignition-cmake_0.6.1-1.tar.gz
-- Applying patch do-not-compile-gtest.patch
-- Applying patch support-arm64.patch
-- Applying patch uuid-do-not-require-pkg-config.patch
-- Applying patch fix-find-ign-curl.patch
-- Using source at C:/Dev/vcpkg/buildtrees/ignition-cmake0/src/make_0.6.1-6417790457.clean
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/Dev/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Found external ninja('1.11.0').
-- Configuring x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:23 (message):
  This command cannot be executed in Download Mode.

  Halting portfile execution.

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:326 (vcpkg_execute_required_process)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:8 (vcpkg_configure_cmake)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:160 (ignition_modular_build_library)
  ports/ignition-cmake0/portfile.cmake:3 (ignition_modular_library)
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-cmake0[core]:x86-windows
Elapsed time to handle ignition-cmake0:x86-windows: 1.004 s
Installing 3/3 ignition-math4:x86-windows...
Building ignition-math4[core]:x86-windows...
-- Downloading https://github.com/ignitionrobotics/ign-math/archive/ignition-math4_4.0.0.tar.gz -> ignitionrobotics-ign-math-ignition-math4_4.0.0-1.tar.gz...
-- Extracting source C:/Dev/vcpkg/downloads/ignitionrobotics-ign-math-ignition-math4_4.0.0-1.tar.gz
-- Using source at C:/Dev/vcpkg/buildtrees/ignition-math4/src/ath4_4.0.0-89bdbdf369.clean
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/Dev/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Found external ninja('1.11.0').
-- Configuring x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:23 (message):
  This command cannot be executed in Download Mode.

  Halting portfile execution.

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:326 (vcpkg_execute_required_process)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:8 (vcpkg_configure_cmake)
  installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:160 (ignition_modular_build_library)
  ports/ignition-math4/portfile.cmake:1 (ignition_modular_library)
  scripts/ports.cmake:147 (include)

Downloaded sources for ignition-math4[core]:x86-windows
Elapsed time to handle ignition-math4:x86-windows: 965.5 ms
Total install time: 5.452 s
RESULTS
    ignition-modularscripts:x64-windows: SUCCEEDED: 63.08 ms
    ignition-cmake0:x86-windows: DOWNLOADED: 1.004 s
    ignition-math4:x86-windows: DOWNLOADED: 965.5 ms

SUMMARY FOR x64-windows
    SUCCEEDED: 1
SUMMARY FOR x86-windows
    DOWNLOADED: 2
PS C:\Dev\vcpkg>
```

Observe that in the before we failed to download the sources of ignition-cmake0 and ignition-math4.
@BillyONeal
Copy link
Member Author

This also affects the qt family but we need port changes to suck out the build support bits from qtbase et al.

Copy link
Contributor

@ras0219-msft ras0219-msft left a comment

Choose a reason for hiding this comment

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

I think we may also need to ensure that we don't install anything with missing dependencies, otherwise the current installed set would violate invariants (if X is installed, all its dependencies are satisfied).

The "problem" case would be something like:

A (requires a build)
B (doesn't require a build) -> A
C (requires a build) -> B

User runs --only-downloads, which results in an installed set of {B} (and not A). Then, they use classic mode vcpkg install C which will only verify direct dependencies (B) and not A. C will be "sucessfully" installed, but A will still be missing.

A concrete cases of this would be "aliasing" ports, such as catch -> catch2

# Conflicts:
#	include/vcpkg/base/messages.h
#	locales/messages.json
@BillyONeal
Copy link
Member Author

@ras0219-msft Fixed!

@BillyONeal
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

src/vcpkg/build.cpp Outdated Show resolved Hide resolved
src/vcpkg/build.cpp Show resolved Hide resolved
@BillyONeal BillyONeal merged commit dbc4a34 into microsoft:main Mar 7, 2023
@BillyONeal BillyONeal deleted the only-downloads-install branch March 7, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants