Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions azure-pipelines/e2e-ports/a-conflict/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "license text")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/conflict-a-header-only-lowercase.h" "// header only port")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/CONFLICT-A-HEADER-ONLY-CAPS.h" "// header only port")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/CONFLICT-a-header-ONLY-mixed.h" "// header only port")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/CONFLICT-a-header-ONLY-mixed2.h" "// header only port")
4 changes: 4 additions & 0 deletions azure-pipelines/e2e-ports/a-conflict/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "a-conflict",
"version": "0"
}
7 changes: 7 additions & 0 deletions azure-pipelines/e2e-ports/b-conflict/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "license text")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/include")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/conflict-b-header-only-lowercase.h" "// header only port")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/CONFLICT-B-HEADER-ONLY-CAPS.h" "// header only port")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/conflict-a-HEADER-only-MIXED.h" "// header only port")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/CONFLICT-a-header-ONLY-mixed2.h" "// header only port")
4 changes: 4 additions & 0 deletions azure-pipelines/e2e-ports/b-conflict/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "b-conflict",
"version": "0"
}
14 changes: 14 additions & 0 deletions azure-pipelines/end-to-end-tests-dir/post-build-checks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -990,3 +990,17 @@ foreach ($bad_dir in @('build-dir', 'downloads', 'installed-root', 'package-dir'

Run-Vcpkg @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" 'vcpkg-policy-absolute-paths[build-dir,downloads,installed-root,package-dir,pkgconfig,policy]' --no-binarycaching --enforce-port-checks
Throw-IfFailed

# Conflicting files. Note that the test ports here don't actually conflict due to different CaSe on Linux but do on Windows and macOS
# Also note that the case chosen is the case from a-conflict not b-conflict, since we are claiming 'installed by a-conflict'
Refresh-TestRoot
$buildOutput = Run-VcpkgAndCaptureOutput @commonArgs install --overlay-ports="$PSScriptRoot/../e2e-ports" a-conflict b-conflict --no-binarycaching --enforce-port-checks
Throw-IfNotFailed
$forwardInstalled = $installRoot.Replace('\', '/')
$expected = @"
error: The following files are already installed in $($forwardInstalled)/$($Triplet) and are in conflict with b-conflict:$($Triplet)
Installed by a-conflict:$($Triplet):
include/CONFLICT-a-header-ONLY-mixed.h
include/CONFLICT-a-header-ONLY-mixed2.h
"@
Throw-IfNonContains -Expected $expected -Actual $buildOutput
12 changes: 6 additions & 6 deletions include/vcpkg/base/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ namespace vcpkg::msg
template<VCPKG_DECL_MSG_TEMPLATE>
void println_error(VCPKG_DECL_MSG_ARGS)
{
auto s = error_prefix();
msg::format_to(s, VCPKG_EXPAND_MSG_ARGS);
println(Color::error, s);
msg::write_unlocalized_text(Color::error, "error");
msg::write_unlocalized_text(Color::none, ": ");
msg::write_unlocalized_text(Color::none, msg::format(VCPKG_EXPAND_MSG_ARGS).append_raw('\n'));
}

[[nodiscard]] LocalizedString format_warning(const LocalizedString& s);
Expand All @@ -231,9 +231,9 @@ namespace vcpkg::msg
template<VCPKG_DECL_MSG_TEMPLATE>
void println_warning(VCPKG_DECL_MSG_ARGS)
{
auto s = LocalizedString::from_raw(WarningPrefix);
msg::format_to(s, VCPKG_EXPAND_MSG_ARGS);
println(Color::warning, s);
msg::write_unlocalized_text(Color::warning, "warning");
msg::write_unlocalized_text(Color::none, ": ");
msg::write_unlocalized_text(Color::none, msg::format(VCPKG_EXPAND_MSG_ARGS).append_raw('\n'));
}

template<VCPKG_DECL_MSG_TEMPLATE>
Expand Down
6 changes: 3 additions & 3 deletions include/vcpkg/base/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ namespace vcpkg::Strings
std::string to_utf8(const std::wstring& ws);
#endif

const char* case_insensitive_ascii_search(StringView s, StringView pattern);
bool case_insensitive_ascii_contains(StringView s, StringView pattern);
const char* case_insensitive_ascii_search(StringView s, StringView pattern) noexcept;
bool case_insensitive_ascii_contains(StringView s, StringView pattern) noexcept;
bool case_insensitive_ascii_equals(StringView left, StringView right) noexcept;
bool case_insensitive_ascii_less(StringView left, StringView right);
bool case_insensitive_ascii_less(StringView left, StringView right) noexcept;

void inplace_ascii_to_lowercase(char* first, char* last);
void inplace_ascii_to_lowercase(std::string& s);
Expand Down
4 changes: 1 addition & 3 deletions include/vcpkg/vcpkglib.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <vcpkg/fwd/installedpaths.h>
#include <vcpkg/fwd/statusparagraphs.h>

#include <vcpkg/base/sortedvector.h>

#include <vcpkg/statusparagraph.h>

#include <string>
Expand All @@ -24,7 +22,7 @@ namespace vcpkg
struct StatusParagraphAndAssociatedFiles
{
StatusParagraph pgh;
SortedVector<std::string> files;
std::vector<std::string> files;
};

std::vector<InstalledPackageView> get_installed_ports(const StatusParagraphs& status_db);
Expand Down
18 changes: 8 additions & 10 deletions src/vcpkg-test/update.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <vcpkg-test/util.h>

#include <vcpkg/base/sortedvector.h>
#include <vcpkg/base/util.h>

#include <vcpkg/commands.update.h>
#include <vcpkg/portfileprovider.h>
Expand All @@ -24,8 +24,8 @@ TEST_CASE ("find outdated packages basic", "[update]")
map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""});
MapPortFileProvider provider(map);

auto pkgs = SortedVector<OutdatedPackage, decltype(&OutdatedPackage::compare_by_name)>(
find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name);
auto pkgs = find_outdated_packages(provider, status_db);
Util::sort(pkgs, &OutdatedPackage::compare_by_name);

REQUIRE(pkgs.size() == 1);
REQUIRE(pkgs[0].version_diff.left.to_string() == "2");
Expand All @@ -48,8 +48,8 @@ TEST_CASE ("find outdated packages features", "[update]")
map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""});
MapPortFileProvider provider(map);

auto pkgs = SortedVector<OutdatedPackage, decltype(&OutdatedPackage::compare_by_name)>(
find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name);
auto pkgs = find_outdated_packages(provider, status_db);
Util::sort(pkgs, &OutdatedPackage::compare_by_name);

REQUIRE(pkgs.size() == 1);
REQUIRE(pkgs[0].version_diff.left.to_string() == "2");
Expand All @@ -73,8 +73,8 @@ TEST_CASE ("find outdated packages features 2", "[update]")
map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""});
MapPortFileProvider provider(map);

auto pkgs = SortedVector<OutdatedPackage, decltype(&OutdatedPackage::compare_by_name)>(
find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name);
auto pkgs = find_outdated_packages(provider, status_db);
Util::sort(pkgs, &OutdatedPackage::compare_by_name);

REQUIRE(pkgs.size() == 1);
REQUIRE(pkgs[0].version_diff.left.to_string() == "2");
Expand All @@ -94,8 +94,6 @@ TEST_CASE ("find outdated packages none", "[update]")
map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""});
MapPortFileProvider provider(map);

auto pkgs = SortedVector<OutdatedPackage, decltype(&OutdatedPackage::compare_by_name)>(
find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name);

auto pkgs = find_outdated_packages(provider, status_db);
REQUIRE(pkgs.size() == 0);
}
6 changes: 3 additions & 3 deletions src/vcpkg/base/strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ void Strings::to_utf8(std::string& output, const wchar_t* w, size_t size_in_char
std::string Strings::to_utf8(const std::wstring& ws) { return to_utf8(ws.data(), ws.size()); }
#endif

const char* Strings::case_insensitive_ascii_search(StringView s, StringView pattern)
const char* Strings::case_insensitive_ascii_search(StringView s, StringView pattern) noexcept
{
return std::search(s.begin(), s.end(), pattern.begin(), pattern.end(), icase_eq);
}

bool Strings::case_insensitive_ascii_contains(StringView s, StringView pattern)
bool Strings::case_insensitive_ascii_contains(StringView s, StringView pattern) noexcept
{
return case_insensitive_ascii_search(s, pattern) != s.end();
}
Expand All @@ -187,7 +187,7 @@ bool Strings::case_insensitive_ascii_equals(StringView left, StringView right) n
return std::equal(left.begin(), left.end(), right.begin(), right.end(), icase_eq);
}

bool Strings::case_insensitive_ascii_less(StringView left, StringView right)
bool Strings::case_insensitive_ascii_less(StringView left, StringView right) noexcept
{
return std::lexicographical_compare(left.begin(), left.end(), right.begin(), right.end(), icase_less);
}
Expand Down
Loading
Loading