Remove to_printf_args(PackageSpec)
MODIFY
include/PackageSpec.h
include/PackageSpec.h
@@ -26,8 +26,6 @@ namespace vcpkg
Triplet m_target_triplet;
};
- std::string to_printf_arg(const PackageSpec& spec);
-
bool operator==(const PackageSpec& left, const PackageSpec& right);
std::ostream& operator<<(std::ostream& os, const PackageSpec& spec);

MODIFY
src/PackageSpec.cpp
src/PackageSpec.cpp
@@ -65,11 +65,6 @@ namespace vcpkg
return this->display_name();
}
- std::string to_printf_arg(const PackageSpec& spec)
- {
- return spec.to_string();
- }
-
bool operator==(const PackageSpec& left, const PackageSpec& right)
{
return left.name() == right.name() && left.target_triplet() == right.target_triplet();

MODIFY
src/commands_build.cpp
src/commands_build.cpp
@@ -141,7 +141,7 @@ namespace vcpkg::Commands::Build
}
const Expected<SourceParagraph> maybe_spgh = Paragraphs::try_load_port(port_dir);
- Checks::check_exit(VCPKG_LINE_INFO, !maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message());
+ Checks::check_exit(VCPKG_LINE_INFO, !maybe_spgh.error_code(), "Could not find package named %s: %s", spec.display_name(), maybe_spgh.error_code().message());
const SourceParagraph& spgh = *maybe_spgh.get();
StatusParagraphs status_db = database_load_check(paths);

MODIFY
src/commands_ci.cpp
src/commands_ci.cpp
@@ -48,7 +48,8 @@ namespace vcpkg::Commands::CI
{
const ElapsedTime build_timer = ElapsedTime::create_started();
counter++;
- System::println("Starting package %d/%d: %s", counter, package_count, action.spec.to_string());
+ const std::string display_name = action.spec.display_name();
+ System::println("Starting package %d/%d: %s", counter, package_count, display_name);
timing.push_back(-1);
results.push_back(BuildResult::NULLVALUE);
@@ -58,7 +59,7 @@ namespace vcpkg::Commands::CI
if (action.plan.plan_type == InstallPlanType::ALREADY_INSTALLED)
{
results.back() = BuildResult::SUCCEEDED;
- System::println(System::Color::success, "Package %s is already installed", action.spec);
+ System::println(System::Color::success, "Package %s is already installed", display_name);
}
else if (action.plan.plan_type == InstallPlanType::BUILD_AND_INSTALL)
{
@@ -76,23 +77,23 @@ namespace vcpkg::Commands::CI
}
const BinaryParagraph bpgh = Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO);
Install::install_package(paths, bpgh, &status_db);
- System::println(System::Color::success, "Package %s is installed", action.spec);
+ System::println(System::Color::success, "Package %s is installed", display_name);
}
else if (action.plan.plan_type == InstallPlanType::INSTALL)
{
results.back() = BuildResult::SUCCEEDED;
Install::install_package(paths, action.plan.binary_pgh.value_or_exit(VCPKG_LINE_INFO), &status_db);
- System::println(System::Color::success, "Package %s is installed from cache", action.spec);
+ System::println(System::Color::success, "Package %s is installed from cache", display_name);
}
else
Checks::unreachable(VCPKG_LINE_INFO);
}
catch (const std::exception& e)
{
- System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec, e.what());
+ System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec.display_name(), e.what());
results.back() = BuildResult::NULLVALUE;
}
- System::println("Elapsed time for package %s: %s", action.spec, build_timer.to_string());
+ System::println("Elapsed time for package %s: %s", action.spec.display_name(), build_timer.to_string());
}
System::println("Total time taken: %s", timer.to_string());

MODIFY
src/commands_install.cpp
src/commands_install.cpp
@@ -201,7 +201,7 @@ namespace vcpkg::Commands::Install
const fs::path triplet_install_path = paths.installed / triplet.canonical_name();
System::println(System::Color::error, "The following files are already installed in %s and are in conflict with %s",
triplet_install_path.generic_string(),
- binary_paragraph.spec);
+ binary_paragraph.spec.display_name());
System::print("\n ");
System::println(Strings::join("\n ", intersection));
System::println("");
@@ -281,16 +281,18 @@ namespace vcpkg::Commands::Install
// execute the plan
for (const PackageSpecWithInstallPlan& action : install_plan)
{
+ const std::string display_name = action.spec.display_name();
+
try
{
switch (action.plan.plan_type)
{
case InstallPlanType::ALREADY_INSTALLED:
- System::println(System::Color::success, "Package %s is already installed", action.spec);
+ System::println(System::Color::success, "Package %s is already installed", action.spec.display_name());
break;
case InstallPlanType::BUILD_AND_INSTALL:
{
- System::println("Building package %s... ", action.spec);
+ System::println("Building package %s... ", display_name);
const Build::BuildResult result = Commands::Build::build_package(action.plan.source_pgh.value_or_exit(VCPKG_LINE_INFO),
action.spec,
paths,
@@ -302,18 +304,18 @@ namespace vcpkg::Commands::Install
System::println(Build::create_user_troubleshooting_message(action.spec));
Checks::exit_fail(VCPKG_LINE_INFO);
}
- System::println(System::Color::success, "Building package %s... done", action.spec);
+ System::println(System::Color::success, "Building package %s... done", display_name);
const BinaryParagraph bpgh = Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO);
- System::println("Installing package %s... ", action.spec);
+ System::println("Installing package %s... ", display_name);
install_package(paths, bpgh, &status_db);
- System::println(System::Color::success, "Installing package %s... done", action.spec);
+ System::println(System::Color::success, "Installing package %s... done", display_name);
break;
}
case InstallPlanType::INSTALL:
- System::println("Installing package %s... ", action.spec);
+ System::println("Installing package %s... ", display_name);
install_package(paths, action.plan.binary_pgh.value_or_exit(VCPKG_LINE_INFO), &status_db);
- System::println(System::Color::success, "Installing package %s... done", action.spec);
+ System::println(System::Color::success, "Installing package %s... done", display_name);
break;
case InstallPlanType::UNKNOWN:
default:
@@ -322,7 +324,7 @@ namespace vcpkg::Commands::Install
}
catch (const std::exception& e)
{
- System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec, e.what());
+ System::println(System::Color::error, "Error: Could not install package %s: %s", action.spec.display_name(), e.what());
Checks::exit_fail(VCPKG_LINE_INFO);
}
}

Remove to_printf_args(PackageSpec)