Soften the 'use version rather than version-string' message. (#1367)
In https://github.com/microsoft/vcpkg/pull/37563#discussion_r1536452701 we have an example of versions which meet the semantic versioning format but don't sort like semantic versions, so the message: ```console PS D:\vcpkg> .\vcpkg.exe x-add-version sqlite-modern-cpp Use the version scheme "version" rather than "version-string" in port "sqlite-modern-cpp". Use --skip-version-format-check to disable this check. ``` is too strong. We need to explain to the user that they should only do that if the versions actually are intended to sort that way.
This commit is contained in:
Родитель
cead04ace7
Коммит
28a4083482
|
@ -76,11 +76,29 @@ DECLARE_MESSAGE(AddVersionPortFilesShaUnchanged,
|
|||
"",
|
||||
"checked-in files for {package_name} are unchanged from version {version}")
|
||||
DECLARE_MESSAGE(AddVersionPortHasImproperFormat, (msg::package_name), "", "{package_name} is not properly formatted")
|
||||
DECLARE_MESSAGE(AddVersionSuggestNewVersionScheme,
|
||||
(msg::new_scheme, msg::old_scheme, msg::package_name, msg::option),
|
||||
"The -- before {option} must be preserved as they're part of the help message for the user.",
|
||||
"Use the version scheme \"{new_scheme}\" rather than \"{old_scheme}\" in port "
|
||||
"\"{package_name}\".\nUse --{option} to disable this check.")
|
||||
DECLARE_MESSAGE(AddVersionSuggestVersionDate,
|
||||
(msg::package_name),
|
||||
"\"version-string\" and \"version-date\" are JSON keys, and --skip-version-format-check is a command "
|
||||
"line switch. They should not be translated",
|
||||
"The version format of \"{package_name}\" uses \"version-string\", but the format is acceptable as a "
|
||||
"\"version-date\". If this format is actually intended to be an ISO 8601 date, change the format to "
|
||||
"\"version-date\", and rerun this command. Otherwise, disable this check by rerunning this command and "
|
||||
"adding --skip-version-format-check .")
|
||||
DECLARE_MESSAGE(
|
||||
AddVersionSuggestVersionRelaxed,
|
||||
(msg::package_name),
|
||||
"\"version-string\" and \"version\" are JSON keys, and --skip-version-format-check is a command line switch. They "
|
||||
"should not be translated",
|
||||
"The version format of \"{package_name}\" uses \"version-string\", but the format is acceptable as a \"version\". "
|
||||
"If the versions for this port are orderable using relaxed-version rules, change the format to \"version\", and "
|
||||
"rerun this command. Relaxed-version rules order versions by each numeric component. Then, versions with dash "
|
||||
"suffixes are sorted lexcographically before. Plus'd build tags are ignored. Examples:\n"
|
||||
"1.0 < 1.1-alpha < 1.1-b < 1.1 < 1.1.1 < 1.2+build = 1.2 < 2.0\n"
|
||||
"Note in particular that dashed suffixes sort *before*, not after. 1.0-anything < 1.0\n"
|
||||
"Note that this sort order is the same as chosen in Semantic Versioning (see https://semver.org), even though the "
|
||||
"actually semantic parts do not apply.\n"
|
||||
"If versions for this port are not ordered by these rules, disable this check by rerunning this command and adding "
|
||||
"--skip-version-format-check .")
|
||||
DECLARE_MESSAGE(AddVersionUnableToParseVersionsFile, (msg::path), "", "unable to parse versions file {path}")
|
||||
DECLARE_MESSAGE(AddVersionUncommittedChanges,
|
||||
(msg::package_name),
|
||||
|
|
|
@ -89,8 +89,10 @@
|
|||
"_AddVersionPortFilesShaUnchanged.comment": "An example of {package_name} is zlib. An example of {version} is 1.3.8.",
|
||||
"AddVersionPortHasImproperFormat": "{package_name} is not properly formatted",
|
||||
"_AddVersionPortHasImproperFormat.comment": "An example of {package_name} is zlib.",
|
||||
"AddVersionSuggestNewVersionScheme": "Use the version scheme \"{new_scheme}\" rather than \"{old_scheme}\" in port \"{package_name}\".\nUse --{option} to disable this check.",
|
||||
"_AddVersionSuggestNewVersionScheme.comment": "The -- before {option} must be preserved as they're part of the help message for the user. An example of {new_scheme} is version. An example of {old_scheme} is version-string. An example of {package_name} is zlib. An example of {option} is editable.",
|
||||
"AddVersionSuggestVersionDate": "The version format of \"{package_name}\" uses \"version-string\", but the format is acceptable as a \"version-date\". If this format is actually intended to be an ISO 8601 date, change the format to \"version-date\", and rerun this command. Otherwise, disable this check by rerunning this command and adding --skip-version-format-check .",
|
||||
"_AddVersionSuggestVersionDate.comment": "\"version-string\" and \"version-date\" are JSON keys, and --skip-version-format-check is a command line switch. They should not be translated An example of {package_name} is zlib.",
|
||||
"AddVersionSuggestVersionRelaxed": "The version format of \"{package_name}\" uses \"version-string\", but the format is acceptable as a \"version\". If the versions for this port are orderable using relaxed-version rules, change the format to \"version\", and rerun this command. Relaxed-version rules order versions by each numeric component. Then, versions with dash suffixes are sorted lexcographically before. Plus'd build tags are ignored. Examples:\n1.0 < 1.1-alpha < 1.1-b < 1.1 < 1.1.1 < 1.2+build = 1.2 < 2.0\nNote in particular that dashed suffixes sort *before*, not after. 1.0-anything < 1.0\nNote that this sort order is the same as chosen in Semantic Versioning (see https://semver.org), even though the actually semantic parts do not apply.\nIf versions for this port are not ordered by these rules, disable this check by rerunning this command and adding --skip-version-format-check .",
|
||||
"_AddVersionSuggestVersionRelaxed.comment": "\"version-string\" and \"version\" are JSON keys, and --skip-version-format-check is a command line switch. They should not be translated An example of {package_name} is zlib.",
|
||||
"AddVersionUnableToParseVersionsFile": "unable to parse versions file {path}",
|
||||
"_AddVersionUnableToParseVersionsFile.comment": "An example of {path} is /foo/bar.",
|
||||
"AddVersionUncommittedChanges": "there are uncommitted changes for {package_name}",
|
||||
|
|
|
@ -62,21 +62,13 @@ namespace
|
|||
{
|
||||
if (DateVersion::try_parse(version.version.text))
|
||||
{
|
||||
Checks::msg_exit_with_message(VCPKG_LINE_INFO,
|
||||
msgAddVersionSuggestNewVersionScheme,
|
||||
msg::new_scheme = JsonIdVersionDate,
|
||||
msg::old_scheme = JsonIdVersionString,
|
||||
msg::package_name = port_name,
|
||||
msg::option = SwitchSkipVersionFormatCheck);
|
||||
Checks::msg_exit_with_message(
|
||||
VCPKG_LINE_INFO, msgAddVersionSuggestVersionDate, msg::package_name = port_name);
|
||||
}
|
||||
if (DotVersion::try_parse_relaxed(version.version.text))
|
||||
{
|
||||
Checks::msg_exit_with_message(VCPKG_LINE_INFO,
|
||||
msgAddVersionSuggestNewVersionScheme,
|
||||
msg::new_scheme = JsonIdVersion,
|
||||
msg::old_scheme = JsonIdVersionString,
|
||||
msg::package_name = port_name,
|
||||
msg::option = SwitchSkipVersionFormatCheck);
|
||||
Checks::msg_exit_with_message(
|
||||
VCPKG_LINE_INFO, msgAddVersionSuggestVersionRelaxed, msg::package_name = port_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче