vcpkg/scripts
Billy O'Neal d816079874
[vcpkg_from_git] Improve diagnostics. (#36539)
While authoring vcpkg_from_git to authenticated servers documentation,
@JavierMatosD and I discovered some failure modes that are not clear in
the output.

Example with REF set to a branch name:

```console
The port under test is:
vcpkg_from_git(
    OUT_SOURCE_PATH out
    URL https://github.com/microsoft/vcpkg
    REF 2024.01.12
)
========== BEFORE ===============
Computing installation plan...
The following packages will be built and installed:
    test-port:x64-windows@1 -- D:\test\test-port
Detecting compiler hash for triplet x64-windows...
Installing 1/1 test-port:x64-windows@1...
Building test-port:x64-windows@1...
-- Installing port from location: D:\test\test-port
-- Fetching https://github.com/microsoft/vcpkg 2024.01.12...
CMake Error at scripts/cmake/vcpkg_from_git.cmake:141 (message):
  unable to rev-parse 2024.01.12 after fetching git repository
Call Stack (most recent call first):
  D:/test/test-port/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:170 (include)

error: building test-port:x64-windows failed with: BUILD_FAILED
Elapsed time to handle test-port:x64-windows: 1.8 s
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+test-port
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[test-port]+Build+error+on+x64-windows&body=Copy+issue+body+from+D%3A%2Fvcpkg2%2Finstalled%2Fvcpkg%2Fissue_body.md

========== AFTER ================
Computing installation plan...
The following packages will be built and installed:
    test-port:x64-windows@1 -- D:\test\test-port
Detecting compiler hash for triplet x64-windows...
Installing 1/1 test-port:x64-windows@1...
Building test-port:x64-windows@1...
-- Installing port from location: D:\test\test-port
-- Fetching https://github.com/microsoft/vcpkg 2024.01.12...
CMake Error at scripts/cmake/vcpkg_from_git.cmake:142 (message):
  After fetching 2024.01.12, the target ref 2024.01.12 appears inaccessible.
  A common cause of this failure is setting REF to a named branch or tag
  rather than a commit SHA.  REF must be a commit SHA.  If the git server
  does not advertise commit SHAs (uploadpack.allowReachableSHA1InWant is
  false), you can set FETCH_REF to a named branch in which the desired commit
  SHA is in the history.  For example, you may be able to fix this error by
  changing "REF 2024.01.12" to "REF a-commit-sha FETCH_REF 2024.01.12".  (git
  rev-parse 2024.01.12 failed)
Call Stack (most recent call first):
  D:/test/test-port/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:170 (include)

error: building test-port:x64-windows failed with: BUILD_FAILED
Elapsed time to handle test-port:x64-windows: 1.9 s
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+test-port
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[test-port]+Build+error+on+x64-windows&body=Copy+issue+body+from+D%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
```

Example with REF ste to a branch name with FETCH_REF set:

```console
PS D:\test> run-test
The following packages are not installed:
    test-port:x64-windows
The following packages are not installed:
    test-port:x64-windows
The port under test is:
vcpkg_from_git(
    OUT_SOURCE_PATH out
    URL https://github.com/microsoft/vcpkg
    REF 2024.01.12
    FETCH_REF master
)
========== BEFORE ===============
Computing installation plan...
The following packages will be built and installed:
    test-port:x64-windows@1 -- D:\test\test-port
Detecting compiler hash for triplet x64-windows...
Installing 1/1 test-port:x64-windows@1...
Building test-port:x64-windows@1...
-- Installing port from location: D:\test\test-port
-- Fetching https://github.com/microsoft/vcpkg master...
CMake Error at scripts/cmake/vcpkg_from_git.cmake:141 (message):
  unable to rev-parse 2024.01.12 after fetching git repository
Call Stack (most recent call first):
  D:/test/test-port/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:170 (include)

error: building test-port:x64-windows failed with: BUILD_FAILED
Elapsed time to handle test-port:x64-windows: 1.6 s
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+test-port
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[test-port]+Build+error+on+x64-windows&body=Copy+issue+body+from+D%3A%2Fvcpkg2%2Finstalled%2Fvcpkg%2Fissue_body.md

========== AFTER ================
Computing installation plan...
The following packages will be built and installed:
    test-port:x64-windows@1 -- D:\test\test-port
Detecting compiler hash for triplet x64-windows...
Installing 1/1 test-port:x64-windows@1...
Building test-port:x64-windows@1...
-- Installing port from location: D:\test\test-port
-- Fetching https://github.com/microsoft/vcpkg master...
CMake Error at scripts/cmake/vcpkg_from_git.cmake:138 (message):
  After fetching master, the target ref 2024.01.12 appears inaccessible.  A
  common cause of this failure is setting REF to a named branch or tag rather
  than a commit SHA.  REF must be a commit SHA.  (git rev-parse 2024.01.12
  failed)
Call Stack (most recent call first):
  D:/test/test-port/portfile.cmake:1 (vcpkg_from_git)
  scripts/ports.cmake:170 (include)

error: building test-port:x64-windows failed with: BUILD_FAILED
Elapsed time to handle test-port:x64-windows: 1.5 s
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+test-port
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[test-port]+Build+error+on+x64-windows&body=Copy+issue+body+from+D%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
```

---------

Co-authored-by: Thomas1664 <46387399+Thomas1664@users.noreply.github.com>
2024-03-06 11:28:35 -08:00
..
angle [angle] Update to chromium/5414, improve build system (and future updates) (#27444) 2023-02-10 11:45:11 -08:00
azure-pipelines Change Android docker hosts to CBL-Mariner (#37130) 2024-03-05 12:35:00 -08:00
boost [boost-modular-build-helper] Support VS2022 17.10 (#36605) 2024-02-06 15:38:09 -08:00
buildsystems Fix typo in vcpkg.cmake (#36158) 2024-01-16 11:04:54 -08:00
cmake [vcpkg_from_git] Improve diagnostics. (#36539) 2024-03-06 11:28:35 -08:00
detect_compiler [vcpkg] update detect compiler to print path (#36398) 2024-02-09 17:17:52 -08:00
get_cmake_vars [glib] Support cross-compiling Objective C code using Meson (#33313) 2023-08-25 12:25:28 -07:00
ifw [vcpkg-export-ifw] Maintenance Tool 2017-10-05 21:24:32 +03:00
posh-vcpkg/0.0.1 [vcpkg-tool] update to 2022-03-30 (#23886) 2022-03-31 19:08:09 -07:00
templates Fix vcpkg create (#33954) 2023-09-25 23:49:57 -07:00
test_ports [vcpkg_from_git] Improve diagnostics. (#36539) 2024-03-06 11:28:35 -08:00
toolchains Fix CMake detection of cross-compilers on arm/arm64 build arch (#35084) 2023-12-04 16:46:19 -08:00
addPoshVcpkgToPowershellProfile.ps1 [vcpkg-tool] update to 2022-03-30 (#23886) 2022-03-31 19:08:09 -07:00
bootstrap.ps1 Disable metrics in bootstrap. (#33350) 2023-08-24 16:20:42 -07:00
bootstrap.sh [bootstrap-vcpkg.sh] restore removed eval call (#37047) 2024-02-29 14:04:29 -08:00
build_info.cmake [scripts] add policy VCPKG_POLICY_SKIP_ABSOLUTE_PATHS_CHECK (#27128) 2022-10-08 21:15:02 -07:00
ci.baseline.txt [dimcli] Update to v7.2.0 (#37038) 2024-03-05 01:53:52 -08:00
file_script.py [vcpkg] Revise the file lists script (#20864) 2021-11-29 16:12:27 -08:00
generateBaseline.py [vcpkg] Rename port_versions to versions (#15784) 2021-01-21 09:53:22 -08:00
generatePortVersionsDb.py [vcpkg] Rename port_versions to versions (#15784) 2021-01-21 09:53:22 -08:00
ports.cmake Refine rpath fixup to inspect already existing rpaths (#36056) 2024-02-28 18:24:48 -08:00
tls12-download-arm64.exe Update vcpkg-tool to 2022-11-10. (#27764) 2022-11-11 12:53:43 -08:00
tls12-download.exe Update vcpkg-tool to 2022-11-10. (#27764) 2022-11-11 12:53:43 -08:00
update-vcpkg-tool-metadata.ps1 Update vcpkg-tool to 2023-08-02 and add update script. (#32885) 2023-08-03 19:09:46 -07:00
vcpkg_completion.bash [autocomplete] Add tab-completion support for bash 2018-12-13 14:02:02 -08:00
vcpkg_completion.fish Fix fish completions (#30050) 2023-03-07 14:55:05 -08:00
vcpkg_completion.zsh [scripts] Add vcpkg_completions.zsh (#18274) 2021-06-30 13:16:51 -07:00
vcpkg-tool-metadata.txt Update vcpkg-tool to 2024-02-07. (#36648) 2024-02-08 16:04:44 -08:00
vcpkgTools.xml [python3] Update to 3.11.8 (#36755) 2024-03-05 01:29:47 -08:00