Skip to content

Commit 1aa6cac

Browse files
committed
PR comments WIP
1 parent bc7816e commit 1aa6cac

File tree

10 files changed

+201
-192
lines changed

10 files changed

+201
-192
lines changed

azure-pipelines/end-to-end-tests-dir/asset-caching.ps1

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,10 @@ if (-not ($actual -match $expected)) {
188188
}
189189

190190
# ... also with multiple authoritative URLs
191-
if ($IsWindows) {
192-
Refresh-TestRoot
193-
$expected = @(
194-
"^Downloading example3\.html, trying https://nonexistent\.example\.com",
195-
"Trying https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
196-
"Successfully downloaded example3\.html",
197-
"$"
198-
) -join "`n"
199-
200-
$actual = Run-VcpkgAndCaptureOutput @commonArgs x-download "$TestDownloadsRoot/example3.html" --sha512 65077997890f66f6041bb3284bb7b88e27631411ccbc253201ca4e00c4bcc58c0d77edffda4975498797cc10772c7fd68fbeb13cc4ac493a3471a9d49e5b6f24 --url https://nonexistent.example.com --url https://raw.githubusercontent.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE.txt
201-
Throw-IfFailed
202-
if (-not ($actual -match $expected)) {
203-
throw "Failure: azurl (no), x-block-origin (no), asset-cache (n/a), download (succeed)"
204-
}
205-
}
206-
207-
# Force curl with --header
208191
Refresh-TestRoot
209192
$expected = @(
210193
"^Downloading example3\.html, trying https://nonexistent\.example\.com",
194+
"error: curl operation failed with error code 6 \(Couldn't resolve host name\)\. This is a non-transient error, won't retry downloading from https://nonexistent\.example\.com",
211195
"Trying https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt"
212196
"Successfully downloaded example3\.html",
213197
"$"

include/vcpkg/base/contractual-constants.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ namespace vcpkg
207207
inline constexpr StringLiteral SwitchDebug = "debug";
208208
inline constexpr StringLiteral SwitchDebugBin = "debug-bin";
209209
inline constexpr StringLiteral SwitchDebugEnv = "debug-env";
210-
inline constexpr StringLiteral SwitchDeleteFileAfterUpload = "delete-file-after-upload";
211210
inline constexpr StringLiteral SwitchDgml = "dgml";
212211
inline constexpr StringLiteral SwitchDisableMetrics = "disable-metrics";
213212
inline constexpr StringLiteral SwitchDot = "dot";

include/vcpkg/base/curl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
#pragma once
12

2-
#ifdef _MSC_VER
3-
#pragma warning(push) // Save current warning state
4-
#pragma warning(disable : 6101) // Disable specific warning (e.g., warning 4996)
5-
#endif
3+
#include <vcpkg/base/pragmas.h>
64

5+
VCPKG_MSVC_WARNING(push)
6+
// note: disable warning triggered by curl headers
7+
// ws2tcpip.h(968): warning C6101: Returning uninitialized memory '*Mtu': A successful path through the function does
8+
// not set the named _Out_ parameter.
9+
VCPKG_MSVC_WARNING(disable : 6101)
710
#include <curl/curl.h>
811
#include <curl/multi.h>
9-
10-
#ifdef _MSC_VER
11-
#pragma warning(pop)
12-
#endif
12+
VCPKG_MSVC_WARNING(pop)
1313

1414
namespace vcpkg
1515
{

include/vcpkg/base/message-data.inc.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,6 @@ DECLARE_MESSAGE(CmdUpdateRegistryAllOrTargets,
863863
(),
864864
"",
865865
"Update registry requires either a list of artifact registry names or URiIs to update, or --all.")
866-
DECLARE_MESSAGE(CmdUploadMetricsDeleteFileAfterUpload, (), "", "Delete metrics payload file after upload")
867866
DECLARE_MESSAGE(CmdUpgradeOptNoDryRun, (), "", "Actually upgrade")
868867
DECLARE_MESSAGE(CmdUpgradeOptNoKeepGoing, (), "", "Stop installing packages on failure")
869868
DECLARE_MESSAGE(CmdUseExample1,
@@ -964,13 +963,17 @@ DECLARE_MESSAGE(CreatingNuGetPackage, (), "", "Creating NuGet package...")
964963
DECLARE_MESSAGE(CreatingZipArchive, (), "", "Creating zip archive...")
965964
DECLARE_MESSAGE(CreationFailed, (msg::path), "", "Creating {path} failed.")
966965
DECLARE_MESSAGE(CurlFailedGeneric,
967-
(msg::exit_code, msg::error_msg),
966+
(msg::exit_code),
968967
"curl is the name of a program, see curl.se.",
969-
"curl operation failed with error code {exit_code} ({error_msg}).")
970-
DECLARE_MESSAGE(CurlFailedGenericWithRetry,
971-
(msg::exit_code, msg::error_msg, msg::count, msg::value),
972-
"curl is the name of a program, see curl.se. {value} is the maximum amount of retries.",
973-
"curl operation failed with error code {exit_code} ({error_msg}) retry {count} of {value}.")
968+
"curl operation failed with error code {exit_code}")
969+
DECLARE_MESSAGE(CurlFailedGenericNoRetryAddendum,
970+
(msg::url),
971+
"curl is the name of a program, see curl.se.",
972+
"This is a non-transient error, won't retry downloading from {url}.")
973+
DECLARE_MESSAGE(CurlFailedTimeoutRetry,
974+
(msg::count, msg::value),
975+
"{count} is the current retry atttempt, {value} is the maximum amount of retries.",
976+
"The operation timed out retry {count} of {value}.")
974977
DECLARE_MESSAGE(CurlFailedHttpResponse,
975978
(msg::exit_code),
976979
"curl is the name of a program, see curl.se.",
@@ -979,10 +982,10 @@ DECLARE_MESSAGE(CurlFailedHttpResponseWithRetry,
979982
(msg::exit_code, msg::count, msg::value),
980983
"curl is the name of a program, see curl.se. {value} is the maximum amount of retries.",
981984
"curl operation failed with HTTP response code {exit_code} retry {count} of {value}.")
982-
DECLARE_MESSAGE(CurlFailedToPutHttp,
983-
(msg::exit_code, msg::error_msg, msg::url, msg::value),
985+
DECLARE_MESSAGE(CurlFailedToPut,
986+
(msg::url, msg::value),
984987
"curl is the name of a program, see curl.se. {value} is an HTTP status code",
985-
"curl failed to put file to {url} with exit code {exit_code} ({error_msg}) and http code {value}.")
988+
"curl failed to PUT file to {url} with response code {value}.")
986989
DECLARE_MESSAGE(CurrentCommitBaseline,
987990
(msg::commit_sha),
988991
"",

include/vcpkg/metrics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,5 @@ namespace vcpkg
198198
extern std::atomic<bool> g_should_send_metrics;
199199

200200
void flush_global_metrics(const Filesystem&);
201-
bool curl_upload_metrics(StringView payload);
201+
bool curl_upload_metrics(const std::string& payload);
202202
}

locales/messages.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@
502502
"CmdUpdateRegistrySynopsis": "Re-downloads an artifact registry",
503503
"CmdUpgradeOptNoDryRun": "Actually upgrade",
504504
"CmdUpgradeOptNoKeepGoing": "Stop installing packages on failure",
505-
"CmdUploadMetricsDeleteFileAfterUpload": "Delete metrics payload file after upload",
506505
"CmdUseExample1": "vcpkg use <artifact name>",
507506
"_CmdUseExample1.comment": "This is a command line, only the <artifact name> part should be localized.",
508507
"CmdUseSynopsis": "Activate a single artifact in this shell",
@@ -561,16 +560,18 @@
561560
"CreatingZipArchive": "Creating zip archive...",
562561
"CreationFailed": "Creating {path} failed.",
563562
"_CreationFailed.comment": "An example of {path} is /foo/bar.",
564-
"CurlFailedGeneric": "curl operation failed with error code {exit_code} ({error_msg}).",
565-
"_CurlFailedGeneric.comment": "curl is the name of a program, see curl.se. An example of {exit_code} is 127. An example of {error_msg} is File Not Found.",
566-
"CurlFailedGenericWithRetry": "curl operation failed with error code {exit_code} ({error_msg}) retry {count} of {value}.",
567-
"_CurlFailedGenericWithRetry.comment": "curl is the name of a program, see curl.se. {value} is the maximum amount of retries. An example of {exit_code} is 127. An example of {error_msg} is File Not Found. An example of {count} is 42.",
563+
"CurlFailedGeneric": "curl operation failed with error code {exit_code}",
564+
"_CurlFailedGeneric.comment": "curl is the name of a program, see curl.se. An example of {exit_code} is 127.",
565+
"CurlFailedGenericNoRetryAddendum": "This is a non-transient error, won't retry downloading from {url}.",
566+
"_CurlFailedGenericNoRetryAddendum.comment": "curl is the name of a program, see curl.se. An example of {url} is https://github.com/microsoft/vcpkg.",
568567
"CurlFailedHttpResponse": "curl operation failed with HTTP response code {exit_code}.",
569568
"_CurlFailedHttpResponse.comment": "curl is the name of a program, see curl.se. An example of {exit_code} is 127.",
570569
"CurlFailedHttpResponseWithRetry": "curl operation failed with HTTP response code {exit_code} retry {count} of {value}.",
571570
"_CurlFailedHttpResponseWithRetry.comment": "curl is the name of a program, see curl.se. {value} is the maximum amount of retries. An example of {exit_code} is 127. An example of {count} is 42.",
572-
"CurlFailedToPutHttp": "curl failed to put file to {url} with exit code {exit_code} ({error_msg}) and http code {value}.",
573-
"_CurlFailedToPutHttp.comment": "curl is the name of a program, see curl.se. {value} is an HTTP status code An example of {exit_code} is 127. An example of {error_msg} is File Not Found. An example of {url} is https://github.com/microsoft/vcpkg.",
571+
"CurlFailedTimeoutRetry": "The operation timed out retry {count} of {value}.",
572+
"_CurlFailedTimeoutRetry.comment": "{count} is the current retry atttempt, {value} is the maximum amount of retries. An example of {count} is 42.",
573+
"CurlFailedToPut": "curl failed to PUT file to {url} with response code {value}.",
574+
"_CurlFailedToPut.comment": "curl is the name of a program, see curl.se. {value} is an HTTP status code An example of {url} is https://github.com/microsoft/vcpkg.",
574575
"CurrentCommitBaseline": "You can use the current commit as a baseline, which is:\n\t\"builtin-baseline\": \"{commit_sha}\"",
575576
"_CurrentCommitBaseline.comment": "An example of {commit_sha} is 7cfad47ae9f68b183983090afd6337cd60fd4949.",
576577
"CycleDetectedDuring": "cycle detected during {spec}:",

src/vcpkg.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,6 @@ namespace
136136

137137
void inner(const Filesystem& fs, const VcpkgCmdArguments& args, const BundleSettings& bundle)
138138
{
139-
// Ensure that we call curl_global_init only once in the program.
140-
if (CURLE_OK != curl_global_init_status())
141-
{
142-
Debug::println("Failed to initialize CURL");
143-
}
144-
145139
// track version on each invocation
146140
get_global_metrics_collector().track_string(StringMetric::VcpkgVersion, vcpkg_executable_version);
147141

0 commit comments

Comments
 (0)