From 544267f0f48000e75c6d405b5584ab487d796939 Mon Sep 17 00:00:00 2001 From: frivard Date: Mon, 30 Nov 2020 15:49:57 -0500 Subject: [PATCH 1/3] Change Nuget pre-release to build metadata --- toolsrc/src/vcpkg-test/binarycaching.cpp | 42 ++++++++++++------------ toolsrc/src/vcpkg/binarycaching.cpp | 6 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp index cb0d7cb99d5d58..de47e14dd971ac 100644 --- a/toolsrc/src/vcpkg-test/binarycaching.cpp +++ b/toolsrc/src/vcpkg-test/binarycaching.cpp @@ -29,28 +29,28 @@ using namespace vcpkg; TEST_CASE ("reformat_version semver-ish", "[reformat_version]") { - REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1-abitag"); - REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0-abitag"); - REQUIRE(reformat_version("1.2", "abitag") == "1.2.0-abitag"); - REQUIRE(reformat_version("v52", "abitag") == "52.0.0-abitag"); - REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2-abitag"); - REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1-abitag"); - REQUIRE(reformat_version("1", "abitag") == "1.0.0-abitag"); + REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0+abitag"); + REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1+abitag"); + REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0+abitag"); + REQUIRE(reformat_version("1.2", "abitag") == "1.2.0+abitag"); + REQUIRE(reformat_version("v52", "abitag") == "52.0.0+abitag"); + REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2+abitag"); + REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1+abitag"); + REQUIRE(reformat_version("1", "abitag") == "1.0.0+abitag"); } TEST_CASE ("reformat_version date", "[reformat_version]") { - REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26-abitag"); - REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26-abitag"); - REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26-abitag"); + REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26+abitag"); + REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0+abitag"); + REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26+abitag"); + REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26+abitag"); } TEST_CASE ("reformat_version generic", "[reformat_version]") { - REQUIRE(reformat_version("apr", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("", "abitag") == "0.0.0-abitag"); + REQUIRE(reformat_version("apr", "abitag") == "0.0.0+abitag"); + REQUIRE(reformat_version("", "abitag") == "0.0.0+abitag"); } TEST_CASE ("generate_nuspec", "[generate_nuspec]") @@ -96,7 +96,7 @@ Build-Depends: bzip NugetReference ref(ipa); - REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0-packageabi.nupkg"); + REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0+packageabi.nupkg"); { auto nuspec = generate_nuspec(paths, ipa, ref, {}); @@ -108,7 +108,7 @@ Build-Depends: bzip std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0+packageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -140,7 +140,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0+packageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -172,7 +172,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0+packageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -267,7 +267,7 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - + )"); @@ -290,8 +290,8 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - - + + )"); } diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 8624cb3d3115fd..e904d276c0f7d4 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -1179,7 +1179,7 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin auto major = trim_leading_zeroes(sm.str(1)); auto minor = sm.size() > 2 && !sm.str(2).empty() ? trim_leading_zeroes(sm.str(2).substr(1)) : "0"; auto patch = sm.size() > 3 && !sm.str(3).empty() ? trim_leading_zeroes(sm.str(3).substr(1)) : "0"; - return Strings::concat(major, '.', minor, '.', patch, "-", abi_tag); + return Strings::concat(major, '.', minor, '.', patch, "+", abi_tag); } static const std::regex date_matcher(R"((\d\d\d\d)-(\d\d)-(\d\d).*)"); @@ -1190,11 +1190,11 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin trim_leading_zeroes(sm.str(2)), '.', trim_leading_zeroes(sm.str(3)), - "-", + "+", abi_tag); } - return Strings::concat("0.0.0-", abi_tag); + return Strings::concat("0.0.0+", abi_tag); } details::NuGetRepoInfo details::get_nuget_repo_info_from_env() From 767e0f5aafe4cdafd02cb39784ae07d22fe4f3b9 Mon Sep 17 00:00:00 2001 From: frivard Date: Mon, 30 Nov 2020 15:49:57 -0500 Subject: [PATCH 2/3] Revert "Change Nuget pre-release to build metadata" This reverts commit 544267f0f48000e75c6d405b5584ab487d796939. --- toolsrc/src/vcpkg-test/binarycaching.cpp | 42 ++++++++++++------------ toolsrc/src/vcpkg/binarycaching.cpp | 6 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp index de47e14dd971ac..cb0d7cb99d5d58 100644 --- a/toolsrc/src/vcpkg-test/binarycaching.cpp +++ b/toolsrc/src/vcpkg-test/binarycaching.cpp @@ -29,28 +29,28 @@ using namespace vcpkg; TEST_CASE ("reformat_version semver-ish", "[reformat_version]") { - REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0+abitag"); - REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1+abitag"); - REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0+abitag"); - REQUIRE(reformat_version("1.2", "abitag") == "1.2.0+abitag"); - REQUIRE(reformat_version("v52", "abitag") == "52.0.0+abitag"); - REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2+abitag"); - REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1+abitag"); - REQUIRE(reformat_version("1", "abitag") == "1.0.0+abitag"); + REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0-abitag"); + REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1-abitag"); + REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0-abitag"); + REQUIRE(reformat_version("1.2", "abitag") == "1.2.0-abitag"); + REQUIRE(reformat_version("v52", "abitag") == "52.0.0-abitag"); + REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2-abitag"); + REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1-abitag"); + REQUIRE(reformat_version("1", "abitag") == "1.0.0-abitag"); } TEST_CASE ("reformat_version date", "[reformat_version]") { - REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26+abitag"); - REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0+abitag"); - REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26+abitag"); - REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26+abitag"); + REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26-abitag"); + REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0-abitag"); + REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26-abitag"); + REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26-abitag"); } TEST_CASE ("reformat_version generic", "[reformat_version]") { - REQUIRE(reformat_version("apr", "abitag") == "0.0.0+abitag"); - REQUIRE(reformat_version("", "abitag") == "0.0.0+abitag"); + REQUIRE(reformat_version("apr", "abitag") == "0.0.0-abitag"); + REQUIRE(reformat_version("", "abitag") == "0.0.0-abitag"); } TEST_CASE ("generate_nuspec", "[generate_nuspec]") @@ -96,7 +96,7 @@ Build-Depends: bzip NugetReference ref(ipa); - REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0+packageabi.nupkg"); + REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0-packageabi.nupkg"); { auto nuspec = generate_nuspec(paths, ipa, ref, {}); @@ -108,7 +108,7 @@ Build-Depends: bzip std::string expected = R"( zlib2_x64-windows - 1.5.0+packageabi + 1.5.0-packageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -140,7 +140,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0+packageabi + 1.5.0-packageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -172,7 +172,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0+packageabi + 1.5.0-packageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -267,7 +267,7 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - + )"); @@ -290,8 +290,8 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - - + + )"); } diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index e904d276c0f7d4..8624cb3d3115fd 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -1179,7 +1179,7 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin auto major = trim_leading_zeroes(sm.str(1)); auto minor = sm.size() > 2 && !sm.str(2).empty() ? trim_leading_zeroes(sm.str(2).substr(1)) : "0"; auto patch = sm.size() > 3 && !sm.str(3).empty() ? trim_leading_zeroes(sm.str(3).substr(1)) : "0"; - return Strings::concat(major, '.', minor, '.', patch, "+", abi_tag); + return Strings::concat(major, '.', minor, '.', patch, "-", abi_tag); } static const std::regex date_matcher(R"((\d\d\d\d)-(\d\d)-(\d\d).*)"); @@ -1190,11 +1190,11 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin trim_leading_zeroes(sm.str(2)), '.', trim_leading_zeroes(sm.str(3)), - "+", + "-", abi_tag); } - return Strings::concat("0.0.0+", abi_tag); + return Strings::concat("0.0.0-", abi_tag); } details::NuGetRepoInfo details::get_nuget_repo_info_from_env() From 1b6ed6f061b279629c64bc1edab008d8bb46e2d7 Mon Sep 17 00:00:00 2001 From: frivard Date: Mon, 30 Nov 2020 16:54:13 -0500 Subject: [PATCH 3/3] Prepend some letters to the pre-release info --- toolsrc/src/vcpkg-test/binarycaching.cpp | 42 ++++++++++++------------ toolsrc/src/vcpkg/binarycaching.cpp | 6 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp index cb0d7cb99d5d58..eefe2a9c1c2bd5 100644 --- a/toolsrc/src/vcpkg-test/binarycaching.cpp +++ b/toolsrc/src/vcpkg-test/binarycaching.cpp @@ -29,28 +29,28 @@ using namespace vcpkg; TEST_CASE ("reformat_version semver-ish", "[reformat_version]") { - REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1-abitag"); - REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0-abitag"); - REQUIRE(reformat_version("1.2", "abitag") == "1.2.0-abitag"); - REQUIRE(reformat_version("v52", "abitag") == "52.0.0-abitag"); - REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2-abitag"); - REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1-abitag"); - REQUIRE(reformat_version("1", "abitag") == "1.0.0-abitag"); + REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0-vcpkgabitag"); + REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1-vcpkgabitag"); + REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0-vcpkgabitag"); + REQUIRE(reformat_version("1.2", "abitag") == "1.2.0-vcpkgabitag"); + REQUIRE(reformat_version("v52", "abitag") == "52.0.0-vcpkgabitag"); + REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2-vcpkgabitag"); + REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1-vcpkgabitag"); + REQUIRE(reformat_version("1", "abitag") == "1.0.0-vcpkgabitag"); } TEST_CASE ("reformat_version date", "[reformat_version]") { - REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26-abitag"); - REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26-abitag"); - REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26-abitag"); + REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26-vcpkgabitag"); + REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0-vcpkgabitag"); + REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26-vcpkgabitag"); + REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26-vcpkgabitag"); } TEST_CASE ("reformat_version generic", "[reformat_version]") { - REQUIRE(reformat_version("apr", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("", "abitag") == "0.0.0-abitag"); + REQUIRE(reformat_version("apr", "abitag") == "0.0.0-vcpkgabitag"); + REQUIRE(reformat_version("", "abitag") == "0.0.0-vcpkgabitag"); } TEST_CASE ("generate_nuspec", "[generate_nuspec]") @@ -96,7 +96,7 @@ Build-Depends: bzip NugetReference ref(ipa); - REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0-packageabi.nupkg"); + REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0-vcpkgpackageabi.nupkg"); { auto nuspec = generate_nuspec(paths, ipa, ref, {}); @@ -108,7 +108,7 @@ Build-Depends: bzip std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0-vcpkgpackageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -140,7 +140,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0-vcpkgpackageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -172,7 +172,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0-vcpkgpackageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -267,7 +267,7 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - + )"); @@ -290,8 +290,8 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - - + + )"); } diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 8624cb3d3115fd..e2570a478397b1 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -1179,7 +1179,7 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin auto major = trim_leading_zeroes(sm.str(1)); auto minor = sm.size() > 2 && !sm.str(2).empty() ? trim_leading_zeroes(sm.str(2).substr(1)) : "0"; auto patch = sm.size() > 3 && !sm.str(3).empty() ? trim_leading_zeroes(sm.str(3).substr(1)) : "0"; - return Strings::concat(major, '.', minor, '.', patch, "-", abi_tag); + return Strings::concat(major, '.', minor, '.', patch, "-vcpkg", abi_tag); } static const std::regex date_matcher(R"((\d\d\d\d)-(\d\d)-(\d\d).*)"); @@ -1190,11 +1190,11 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin trim_leading_zeroes(sm.str(2)), '.', trim_leading_zeroes(sm.str(3)), - "-", + "-vcpkg", abi_tag); } - return Strings::concat("0.0.0-", abi_tag); + return Strings::concat("0.0.0-vcpkg", abi_tag); } details::NuGetRepoInfo details::get_nuget_repo_info_from_env()