-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept arbitrary version formats in overrides. (#1329)
* Accept arbitrary version formats in overrides. We accidentally implemented the overrides deserializer to reject non-relaxed-versions in "overrides", despite the original intent that overrides are scheme-less. Note how the original schema: #1209 , and original documentation: microsoft/vcpkg-docs#159 said everything should be accepted here. Also fix our example printing when we're asking users to add overrides to ensure it is valid JSON. * Implement preferring putting the port-version into the version text. * Rename GenericVersionDeserializer to BaselineVersionTagDeserializer.
- Loading branch information
1 parent
96bf7ef
commit c05f470
Showing
15 changed files
with
449 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -441,11 +441,11 @@ TEST_CASE ("version string baseline agree", "[versionplan]") | |
TEST_CASE ("version install scheme baseline conflict", "[versionplan]") | ||
{ | ||
MockBaselineProvider bp; | ||
bp.v["a"] = {"2", 0}; | ||
bp.v["a"] = {"2with\"quotes", 0}; | ||
|
||
MockVersionedPortfileProvider vp; | ||
vp.emplace("a", {"1", 0}); | ||
vp.emplace("a", {"2", 0}); | ||
vp.emplace("a", {"2with\"quotes", 0}); | ||
vp.emplace("a", {"3", 0}); | ||
|
||
MockCMakeVarProvider var_provider; | ||
|
@@ -463,16 +463,17 @@ TEST_CASE ("version install scheme baseline conflict", "[versionplan]") | |
REQUIRE(!install_plan.has_value()); | ||
REQUIRE_LINES( | ||
install_plan.error(), | ||
R"(error: version conflict on a:x86-windows: toplevel-spec required 3, which cannot be compared with the baseline version 2. | ||
R"(error: version conflict on a:x86-windows: toplevel-spec required 3, which cannot be compared with the baseline version 2with"quotes. | ||
Both versions have scheme string but different primary text. | ||
This can be resolved by adding an explicit override to the preferred version. For example: | ||
"overrides": [ | ||
{ "name": "a", "version": "2" } | ||
{ | ||
"name": "a", | ||
"version": "2with\"quotes" | ||
} | ||
] | ||
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)"); | ||
} | ||
|
||
|
@@ -1106,11 +1107,12 @@ The versions have incomparable schemes: | |
[email protected] has scheme string | ||
This can be resolved by adding an explicit override to the preferred version. For example: | ||
"overrides": [ | ||
{ "name": "a", "version": "1.0.0" } | ||
{ | ||
"name": "a", | ||
"version": "1.0.0" | ||
} | ||
] | ||
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)"); | ||
} | ||
SECTION ("higher baseline") | ||
|
@@ -1136,11 +1138,12 @@ The versions have incomparable schemes: | |
[email protected] has scheme string | ||
This can be resolved by adding an explicit override to the preferred version. For example: | ||
"overrides": [ | ||
{ "name": "a", "version": "1.0.2" } | ||
{ | ||
"name": "a", | ||
"version": "1.0.2" | ||
} | ||
] | ||
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)"); | ||
} | ||
} | ||
|
@@ -1228,11 +1231,12 @@ The versions have incomparable schemes: | |
b@1#1 has scheme relaxed | ||
This can be resolved by adding an explicit override to the preferred version. For example: | ||
"overrides": [ | ||
{ "name": "b", "version": "1" } | ||
{ | ||
"name": "b", | ||
"version": "1" | ||
} | ||
] | ||
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)"); | ||
} | ||
SECTION ("lower baseline") | ||
|
@@ -1553,8 +1557,8 @@ TEST_CASE ("version install overrides", "[versionplan]") | |
bp.v["b"] = {"2", 0}; | ||
bp.v["c"] = {"2", 0}; | ||
|
||
DependencyOverride bdo{"b", Version{"1", 0}, VersionScheme::String}; | ||
DependencyOverride cdo{"c", Version{"1", 0}, VersionScheme::String}; | ||
DependencyOverride bdo{"b", Version{"1", 0}}; | ||
DependencyOverride cdo{"c", Version{"1", 0}}; | ||
SECTION ("string") | ||
{ | ||
auto install_plan = | ||
|
@@ -1593,8 +1597,8 @@ TEST_CASE ("version install transitive overrides", "[versionplan]") | |
bp.v["b"] = {"2", 0}; | ||
bp.v["c"] = {"2", 1}; | ||
|
||
DependencyOverride bdo{"b", Version{"1", 0}, VersionScheme::String}; | ||
DependencyOverride cdo{"c", Version{"1", 0}, VersionScheme::String}; | ||
DependencyOverride bdo{"b", Version{"1", 0}}; | ||
DependencyOverride cdo{"c", Version{"1", 0}}; | ||
WITH_EXPECTED(install_plan, | ||
create_versioned_install_plan(vp, bp, var_provider, {Dependency{"b"}}, {bdo, cdo}, toplevel_spec())); | ||
|
||
|
@@ -2143,7 +2147,7 @@ TEST_CASE ("version overlay ports", "[versionplan]") | |
Dependency{"a", {}, {}, {VersionConstraintKind::Minimum, Version{"1", 1}}}, | ||
}, | ||
{ | ||
DependencyOverride{"a", Version{"2", 0}, VersionScheme::String}, | ||
DependencyOverride{"a", Version{"2", 0}}, | ||
}, | ||
toplevel_spec()) | ||
.value_or_exit(VCPKG_LINE_INFO); | ||
|
@@ -2153,19 +2157,18 @@ TEST_CASE ("version overlay ports", "[versionplan]") | |
} | ||
SECTION ("override") | ||
{ | ||
auto install_plan = | ||
create_versioned_install_plan(vp, | ||
bp, | ||
oprovider, | ||
var_provider, | ||
{ | ||
Dependency{"a"}, | ||
}, | ||
{ | ||
DependencyOverride{"a", Version{"2", 0}, VersionScheme::String}, | ||
}, | ||
toplevel_spec()) | ||
.value_or_exit(VCPKG_LINE_INFO); | ||
auto install_plan = create_versioned_install_plan(vp, | ||
bp, | ||
oprovider, | ||
var_provider, | ||
{ | ||
Dependency{"a"}, | ||
}, | ||
{ | ||
DependencyOverride{"a", Version{"2", 0}}, | ||
}, | ||
toplevel_spec()) | ||
.value_or_exit(VCPKG_LINE_INFO); | ||
|
||
REQUIRE(install_plan.size() == 1); | ||
check_name_and_version(install_plan.install_actions[0], "a", {"overlay", 0}); | ||
|
@@ -2199,7 +2202,7 @@ TEST_CASE ("respect supports expression", "[versionplan]") | |
oprovider, | ||
var_provider, | ||
{Dependency{"a"}}, | ||
{DependencyOverride{"a", Version{"1", 1}, VersionScheme::String}}, | ||
{DependencyOverride{"a", Version{"1", 1}}}, | ||
toplevel_spec()); | ||
CHECK(install_plan.has_value()); | ||
// override from supported to non supported version | ||
|
@@ -2209,7 +2212,7 @@ TEST_CASE ("respect supports expression", "[versionplan]") | |
oprovider, | ||
var_provider, | ||
{Dependency{"a"}}, | ||
{DependencyOverride{"a", Version{"1", 0}, VersionScheme::String}}, | ||
{DependencyOverride{"a", Version{"1", 0}}}, | ||
toplevel_spec()); | ||
CHECK_FALSE(install_plan.has_value()); | ||
} | ||
|
@@ -2247,7 +2250,7 @@ TEST_CASE ("respect supports expressions of features", "[versionplan]") | |
oprovider, | ||
var_provider, | ||
{Dependency{"a", {{"x"}}}}, | ||
{DependencyOverride{"a", Version{"1", 1}, VersionScheme::String}}, | ||
{DependencyOverride{"a", Version{"1", 1}}}, | ||
toplevel_spec()); | ||
CHECK(install_plan.has_value()); | ||
// override from supported to non supported version | ||
|
@@ -2257,7 +2260,7 @@ TEST_CASE ("respect supports expressions of features", "[versionplan]") | |
oprovider, | ||
var_provider, | ||
{Dependency{"a", {{"x"}}}}, | ||
{DependencyOverride{"a", Version{"1", 0}, VersionScheme::String}}, | ||
{DependencyOverride{"a", Version{"1", 0}}}, | ||
toplevel_spec()); | ||
CHECK_FALSE(install_plan.has_value()); | ||
} | ||
|
Oops, something went wrong.