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

[vcpkg scripts] Simplify vcpkg_download_distfile output handling for Asset Caching #40945

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions scripts/cmake/vcpkg_download_distfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,7 @@ If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.")
"${arg_SHA512}"
"${arg_SKIP_SHA512}"
)

if(NOT vcpkg_download_distfile_QUIET)
message(STATUS "Using cached ${arg_FILENAME}.")
JavierMatosD marked this conversation as resolved.
Show resolved Hide resolved
endif()

# Suppress the "Downloading ${arg_URLS} -> ${arg_FILENAME}..." message
set(vcpkg_download_distfile_QUIET TRUE)
message(STATUS "Using cached ${arg_FILENAME}.")
endif()

# vcpkg_download_distfile_ALWAYS_REDOWNLOAD only triggers when NOT _VCPKG_NO_DOWNLOADS
Expand Down Expand Up @@ -235,9 +229,6 @@ If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.")
foreach(url IN LISTS arg_URLS)
vcpkg_list(APPEND urls_param "--url=${url}")
endforeach()
if(NOT vcpkg_download_distfile_QUIET)
JavierMatosD marked this conversation as resolved.
Show resolved Hide resolved
message(STATUS "Downloading ${arg_URLS} -> ${arg_FILENAME}...")
endif()

vcpkg_list(SET headers_param)
foreach(header IN LISTS arg_HEADERS)
Expand All @@ -257,16 +248,12 @@ If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.")
${sha512_param}
${urls_param}
${headers_param}
--debug
--feature-flags=-manifests # there's a bug in vcpkg x-download when it finds a manifest-root
OUTPUT_VARIABLE output
ERROR_VARIABLE output
RESULT_VARIABLE error_code
WORKING_DIRECTORY "${DOWNLOADS}"
)

if(NOT "${error_code}" EQUAL "0")
message("${output}")
z_vcpkg_download_distfile_show_proxy_and_fail("${error_code}")
Copy link
Member

Choose a reason for hiding this comment

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

Can you confirm that this doesn't repeat error messages?

Copy link
Contributor Author

@JavierMatosD JavierMatosD Sep 16, 2024

Choose a reason for hiding this comment

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

Confirmed it does not repeat the error message. That said, I did find a bug with our asset caching output.

To repro ensure that x-block-origin is not enabled, trigger an error by giving vcpkg_download_distfile a bad URL, and try to install the package.

It will spit out:

error: Missing <pkg> and downloads are blocked by x-block-origin. which is false.

endif()
endif()
Expand Down
Loading