package_spec -> PackageSpec

This commit is contained in:
Alexander Karatarakis 2017-04-03 14:45:00 -07:00
parent 1c1423014f
commit d1141e6054
25 changed files with 106 additions and 106 deletions

View File

@ -2,7 +2,7 @@
#include <unordered_map>
#include "SourceParagraph.h"
#include "package_spec.h"
#include "PackageSpec.h"
namespace vcpkg
{
@ -18,7 +18,7 @@ namespace vcpkg
std::string dir() const;
package_spec spec;
PackageSpec spec;
std::string version;
std::string description;
std::string maintainer;

View File

@ -5,11 +5,11 @@
namespace vcpkg
{
struct package_spec
struct PackageSpec
{
static expected<package_spec> from_string(const std::string& spec_as_string, const triplet& default_target_triplet);
static expected<PackageSpec> from_string(const std::string& spec_as_string, const triplet& default_target_triplet);
static expected<package_spec> from_name_and_triplet(const std::string& name, const triplet& target_triplet);
static expected<PackageSpec> from_name_and_triplet(const std::string& name, const triplet& target_triplet);
const std::string& name() const;
@ -26,19 +26,19 @@ namespace vcpkg
triplet m_target_triplet;
};
std::string to_printf_arg(const package_spec& spec);
std::string to_printf_arg(const PackageSpec& spec);
bool operator==(const package_spec& left, const package_spec& right);
bool operator==(const PackageSpec& left, const PackageSpec& right);
std::ostream& operator<<(std::ostream& os, const package_spec& spec);
std::ostream& operator<<(std::ostream& os, const PackageSpec& spec);
} //namespace vcpkg
namespace std
{
template <>
struct hash<vcpkg::package_spec>
struct hash<vcpkg::PackageSpec>
{
size_t operator()(const vcpkg::package_spec& value) const
size_t operator()(const vcpkg::PackageSpec& value) const
{
size_t hash = 17;
hash = hash * 31 + std::hash<std::string>()(value.name());
@ -48,9 +48,9 @@ namespace std
};
template <>
struct equal_to<vcpkg::package_spec>
struct equal_to<vcpkg::PackageSpec>
{
bool operator()(const vcpkg::package_spec& left, const vcpkg::package_spec& right) const
bool operator()(const vcpkg::PackageSpec& left, const vcpkg::PackageSpec& right) const
{
return left == right;
}

View File

@ -18,7 +18,7 @@ namespace vcpkg::Paragraphs
expected<SourceParagraph> try_load_port(const fs::path& control_path);
expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec);
expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const PackageSpec& spec);
std::vector<SourceParagraph> load_all_ports(const fs::path& ports_dir);

View File

@ -1,8 +1,8 @@
#pragma once
#include "package_spec.h"
#include "PackageSpec.h"
#include "vcpkg_paths.h"
namespace vcpkg::PostBuildLint
{
size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths);
size_t perform_all_checks(const PackageSpec& spec, const vcpkg_paths& paths);
}

View File

@ -14,7 +14,7 @@ namespace vcpkg
using iterator = container::reverse_iterator;
using const_iterator = container::const_reverse_iterator;
const_iterator find(const package_spec& spec) const
const_iterator find(const PackageSpec& spec) const
{
return find(spec.name(), spec.target_triplet());
}

View File

@ -26,13 +26,13 @@ namespace vcpkg::Commands
static constexpr std::array<BuildResult, 4> BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES };
const std::string& to_string(const BuildResult build_result);
std::string create_error_message(const BuildResult build_result, const package_spec& spec);
std::string create_user_troubleshooting_message(const package_spec& spec);
std::string create_error_message(const BuildResult build_result, const PackageSpec& spec);
std::string create_user_troubleshooting_message(const PackageSpec& spec);
std::wstring make_build_env_cmd(const triplet& target_triplet, const toolset_t& toolset);
BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db);
void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths);
BuildResult build_package(const SourceParagraph& source_paragraph, const PackageSpec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db);
void perform_and_exit(const PackageSpec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths);
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
@ -63,7 +63,7 @@ namespace vcpkg::Commands
{
static bool compare_by_name(const outdated_package& left, const outdated_package& right);
package_spec spec;
PackageSpec spec;
version_diff_t version_diff;
};

View File

@ -1,6 +1,6 @@
#pragma once
#include <vector>
#include "package_spec.h"
#include "PackageSpec.h"
#include "StatusParagraphs.h"
#include "vcpkg_paths.h"
#include "vcpkg_optional.h"
@ -38,9 +38,9 @@ namespace vcpkg::Dependencies
struct package_spec_with_install_plan
{
package_spec_with_install_plan(const package_spec& spec, install_plan_action&& plan);
package_spec_with_install_plan(const PackageSpec& spec, install_plan_action&& plan);
package_spec spec;
PackageSpec spec;
install_plan_action plan;
};
@ -67,13 +67,13 @@ namespace vcpkg::Dependencies
struct package_spec_with_remove_plan
{
package_spec_with_remove_plan(const package_spec& spec, remove_plan_action&& plan);
package_spec_with_remove_plan(const PackageSpec& spec, remove_plan_action&& plan);
package_spec spec;
PackageSpec spec;
remove_plan_action plan;
};
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
}

View File

@ -1,11 +1,11 @@
#pragma once
#include <vector>
#include "package_spec.h"
#include "PackageSpec.h"
#include "vcpkg_paths.h"
namespace vcpkg::Input
{
package_spec check_and_get_package_spec(
PackageSpec check_and_get_package_spec(
const std::string& package_spec_as_string,
const triplet& default_target_triplet,
CStringView example_text);

View File

@ -1,7 +1,7 @@
#pragma once
#include "filesystem_fs.h"
#include "vcpkg_expected.h"
#include "package_spec.h"
#include "PackageSpec.h"
#include "BinaryParagraph.h"
#include "Lazy.h"
@ -18,9 +18,9 @@ namespace vcpkg
{
static expected<vcpkg_paths> create(const fs::path& vcpkg_root_dir);
fs::path package_dir(const package_spec& spec) const;
fs::path port_dir(const package_spec& spec) const;
fs::path build_info_file_path(const package_spec& spec) const;
fs::path package_dir(const PackageSpec& spec) const;
fs::path port_dir(const PackageSpec& spec) const;
fs::path build_info_file_path(const PackageSpec& spec) const;
fs::path listfile_path(const BinaryParagraph& pgh) const;
bool is_valid_triplet(const triplet& t) const;

View File

@ -31,7 +31,7 @@ namespace vcpkg
const std::string architecture = details::remove_required_field(&fields, BinaryParagraphRequiredField::ARCHITECTURE);
const triplet target_triplet = triplet::from_canonical_name(architecture);
this->spec = package_spec::from_name_and_triplet(name, target_triplet).value_or_exit(VCPKG_LINE_INFO);
this->spec = PackageSpec::from_name_and_triplet(name, target_triplet).value_or_exit(VCPKG_LINE_INFO);
this->version = details::remove_required_field(&fields, BinaryParagraphRequiredField::VERSION);
this->description = details::remove_optional_field(&fields, BinaryParagraphOptionalField::DESCRIPTION);
@ -46,7 +46,7 @@ namespace vcpkg
BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet)
{
this->spec = package_spec::from_name_and_triplet(spgh.name, target_triplet).value_or_exit(VCPKG_LINE_INFO);
this->spec = PackageSpec::from_name_and_triplet(spgh.name, target_triplet).value_or_exit(VCPKG_LINE_INFO);
this->version = spgh.version;
this->description = spgh.description;
this->maintainer = spgh.maintainer;

View File

@ -1,5 +1,5 @@
#include "pch.h"
#include "package_spec.h"
#include "PackageSpec.h"
namespace vcpkg
{
@ -8,7 +8,7 @@ namespace vcpkg
return (c == '-') || isdigit(c) || (isalpha(c) && islower(c));
}
expected<package_spec> package_spec::from_string(const std::string& spec_as_string, const triplet& default_target_triplet)
expected<PackageSpec> PackageSpec::from_string(const std::string& spec_as_string, const triplet& default_target_triplet)
{
auto pos = spec_as_string.find(':');
if (pos == std::string::npos)
@ -27,55 +27,55 @@ namespace vcpkg
return from_name_and_triplet(name, target_triplet);
}
expected<package_spec> package_spec::from_name_and_triplet(const std::string& name, const triplet& target_triplet)
expected<PackageSpec> PackageSpec::from_name_and_triplet(const std::string& name, const triplet& target_triplet)
{
if (std::find_if_not(name.cbegin(), name.cend(), is_valid_package_spec_char) != name.end())
{
return std::error_code(package_spec_parse_result::INVALID_CHARACTERS);
}
package_spec p;
PackageSpec p;
p.m_name = name;
p.m_target_triplet = target_triplet;
return p;
}
const std::string& package_spec::name() const
const std::string& PackageSpec::name() const
{
return this->m_name;
}
const triplet& package_spec::target_triplet() const
const triplet& PackageSpec::target_triplet() const
{
return this->m_target_triplet;
}
std::string package_spec::display_name() const
std::string PackageSpec::display_name() const
{
return Strings::format("%s:%s", this->name(), this->target_triplet());
}
std::string package_spec::dir() const
std::string PackageSpec::dir() const
{
return Strings::format("%s_%s", this->m_name, this->m_target_triplet);
}
std::string package_spec::toString() const
std::string PackageSpec::toString() const
{
return this->display_name();
}
std::string to_printf_arg(const package_spec& spec)
std::string to_printf_arg(const PackageSpec& spec)
{
return spec.toString();
}
bool operator==(const package_spec& left, const package_spec& right)
bool operator==(const PackageSpec& left, const PackageSpec& right)
{
return left.name() == right.name() && left.target_triplet() == right.target_triplet();
}
std::ostream& operator<<(std::ostream& os, const package_spec& spec)
std::ostream& operator<<(std::ostream& os, const PackageSpec& spec)
{
return os << spec.toString();
}

View File

@ -222,7 +222,7 @@ namespace vcpkg::Paragraphs
return pghs.error_code();
}
expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec)
expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const PackageSpec& spec)
{
expected<std::unordered_map<std::string, std::string>> pghs = get_single_paragraph(paths.package_dir(spec) / "CONTROL");

View File

@ -1,6 +1,6 @@
#include "pch.h"
#include "vcpkg_paths.h"
#include "package_spec.h"
#include "PackageSpec.h"
#include "vcpkg_Files.h"
#include "vcpkg_System.h"
#include "coff_file_reader.h"
@ -116,7 +116,7 @@ namespace vcpkg::PostBuildLint
return lint_status::SUCCESS;
}
static lint_status check_folder_lib_cmake(const fs::path& package_dir, const package_spec& spec)
static lint_status check_folder_lib_cmake(const fs::path& package_dir, const PackageSpec& spec)
{
const fs::path lib_cmake = package_dir / "lib" / "cmake";
if (fs::exists(lib_cmake))
@ -128,7 +128,7 @@ namespace vcpkg::PostBuildLint
return lint_status::SUCCESS;
}
static lint_status check_for_misplaced_cmake_files(const fs::path& package_dir, const package_spec& spec)
static lint_status check_for_misplaced_cmake_files(const fs::path& package_dir, const PackageSpec& spec)
{
std::vector<fs::path> misplaced_cmake_files;
Files::recursive_find_files_with_extension_in_dir(package_dir / "cmake", ".cmake", &misplaced_cmake_files);
@ -174,7 +174,7 @@ namespace vcpkg::PostBuildLint
return lint_status::SUCCESS;
}
static lint_status check_for_copyright_file(const package_spec& spec, const vcpkg_paths& paths)
static lint_status check_for_copyright_file(const PackageSpec& spec, const vcpkg_paths& paths)
{
const fs::path packages_dir = paths.packages / spec.dir();
const fs::path copyright_file = packages_dir / "share" / spec.name() / "copyright";
@ -619,7 +619,7 @@ namespace vcpkg::PostBuildLint
left += static_cast<size_t>(right);
}
static size_t perform_all_checks_and_return_error_count(const package_spec& spec, const vcpkg_paths& paths)
static size_t perform_all_checks_and_return_error_count(const PackageSpec& spec, const vcpkg_paths& paths)
{
// for dumpbin
const toolset_t& toolset = paths.get_toolset();
@ -709,7 +709,7 @@ namespace vcpkg::PostBuildLint
return error_count;
}
size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths)
size_t perform_all_checks(const PackageSpec& spec, const vcpkg_paths& paths)
{
System::println("-- Performing post-build validation");
const size_t error_count = perform_all_checks_and_return_error_count(spec, paths);

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "PostBuildLint_ConfigurationType.h"
#include "vcpkg_Enums.h"
#include "package_spec.h"
#include "PackageSpec.h"
namespace vcpkg::PostBuildLint::ConfigurationType
{

View File

@ -15,7 +15,7 @@ namespace vcpkg
{
return std::find_if(begin(), end(), [&](const std::unique_ptr<StatusParagraph>& pgh)
{
const package_spec& spec = pgh->package.spec;
const PackageSpec& spec = pgh->package.spec;
return spec.name() == name && spec.target_triplet() == target_triplet;
});
}
@ -24,7 +24,7 @@ namespace vcpkg
{
return std::find_if(begin(), end(), [&](const std::unique_ptr<StatusParagraph>& pgh)
{
const package_spec& spec = pgh->package.spec;
const PackageSpec& spec = pgh->package.spec;
return spec.name() == name && spec.target_triplet() == target_triplet;
});
}
@ -43,7 +43,7 @@ namespace vcpkg
StatusParagraphs::iterator StatusParagraphs::insert(std::unique_ptr<StatusParagraph> pgh)
{
Checks::check_exit(VCPKG_LINE_INFO, pgh != nullptr, "Inserted null paragraph");
const package_spec& spec = pgh->package.spec;
const PackageSpec& spec = pgh->package.spec;
auto ptr = find(spec.name(), spec.target_triplet());
if (ptr == end())
{

View File

@ -32,7 +32,7 @@ namespace vcpkg::Commands::Build
Strings::utf8_to_utf16(target_triplet.architecture()));
}
BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db)
BuildResult build_package(const SourceParagraph& source_paragraph, const PackageSpec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db)
{
Checks::check_exit(VCPKG_LINE_INFO, spec.name() == source_paragraph.name, "inconsistent arguments to build_package()");
@ -111,12 +111,12 @@ namespace vcpkg::Commands::Build
}
}
std::string create_error_message(const BuildResult build_result, const package_spec& spec)
std::string create_error_message(const BuildResult build_result, const PackageSpec& spec)
{
return Strings::format("Error: Building package %s failed with: %s", spec.toString(), Build::to_string(build_result));
}
std::string create_user_troubleshooting_message(const package_spec& spec)
std::string create_user_troubleshooting_message(const PackageSpec& spec)
{
return Strings::format("Please ensure you're using the latest portfiles with `.\\vcpkg update`, then\n"
"submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n"
@ -127,7 +127,7 @@ namespace vcpkg::Commands::Build
, spec.toString(), Version::version());
}
void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths)
void perform_and_exit(const PackageSpec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths)
{
if (options.find(OPTION_CHECKS_ONLY) != options.end())
{
@ -178,7 +178,7 @@ namespace vcpkg::Commands::Build
{
static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows");
args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed
const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
const PackageSpec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
Input::check_triplet(spec.target_triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY });
perform_and_exit(spec, paths.port_dir(spec), options, paths);

View File

@ -9,7 +9,7 @@ namespace vcpkg::Commands::BuildExternal
{
static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
args.check_exact_arg_count(2, example);
const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
const PackageSpec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
Input::check_triplet(spec.target_triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({});

View File

@ -14,13 +14,13 @@ namespace vcpkg::Commands::CI
using Dependencies::install_plan_type;
using Build::BuildResult;
static std::vector<package_spec> load_all_package_specs(const fs::path& ports_directory, const triplet& target_triplet)
static std::vector<PackageSpec> load_all_package_specs(const fs::path& ports_directory, const triplet& target_triplet)
{
std::vector<SourceParagraph> ports = Paragraphs::load_all_ports(ports_directory);
std::vector<package_spec> specs;
std::vector<PackageSpec> specs;
for (const SourceParagraph& p : ports)
{
specs.push_back(package_spec::from_name_and_triplet(p.name, target_triplet).value_or_exit(VCPKG_LINE_INFO));
specs.push_back(PackageSpec::from_name_and_triplet(p.name, target_triplet).value_or_exit(VCPKG_LINE_INFO));
}
return specs;
@ -33,7 +33,7 @@ namespace vcpkg::Commands::CI
const triplet target_triplet = args.command_arguments.size() == 1 ? triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet;
Input::check_triplet(target_triplet, paths);
args.check_and_get_optional_command_arguments({});
const std::vector<package_spec> specs = load_all_package_specs(paths.ports, target_triplet);
const std::vector<PackageSpec> specs = load_all_package_specs(paths.ports, target_triplet);
StatusParagraphs status_db = database_load_check(paths);
const std::vector<package_spec_with_install_plan> install_plan = Dependencies::create_install_plan(paths, specs, status_db);

View File

@ -27,7 +27,7 @@ namespace vcpkg::Commands::Remove
}
}
static void remove_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs* status_db)
static void remove_package(const vcpkg_paths& paths, const PackageSpec& spec, StatusParagraphs* status_db)
{
StatusParagraph& pkg = **status_db->find(spec.name(), spec.target_triplet());

View File

@ -350,7 +350,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse)
{
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib", vcpkg::triplet::X86_WINDOWS);
vcpkg::expected<vcpkg::PackageSpec> spec = vcpkg::PackageSpec::from_string("zlib", vcpkg::triplet::X86_WINDOWS);
Assert::AreEqual(vcpkg::package_spec_parse_result::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual("zlib", spec.get()->name().c_str());
Assert::AreEqual(vcpkg::triplet::X86_WINDOWS.canonical_name(), spec.get()->target_triplet().canonical_name());
@ -358,7 +358,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse_with_arch)
{
vcpkg::expected<vcpkg::package_spec> spec = vcpkg::package_spec::from_string("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS);
vcpkg::expected<vcpkg::PackageSpec> spec = vcpkg::PackageSpec::from_string("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS);
Assert::AreEqual(vcpkg::package_spec_parse_result::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code()));
Assert::AreEqual("zlib", spec.get()->name().c_str());
Assert::AreEqual(vcpkg::triplet::X64_UWP.canonical_name(), spec.get()->target_triplet().canonical_name());
@ -366,7 +366,7 @@ namespace UnitTest1
TEST_METHOD(package_spec_parse_with_multiple_colon)
{
auto ec = vcpkg::package_spec::from_string("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code();
auto ec = vcpkg::PackageSpec::from_string("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code();
Assert::AreEqual(vcpkg::package_spec_parse_result::TOO_MANY_COLONS, vcpkg::to_package_spec_parse_result(ec));
}

View File

@ -2,7 +2,7 @@
#include "vcpkg_Dependencies.h"
#include "vcpkg_Graphs.h"
#include "vcpkg_paths.h"
#include "package_spec.h"
#include "PackageSpec.h"
#include "StatusParagraphs.h"
#include "vcpkg_Files.h"
#include "Paragraphs.h"
@ -18,7 +18,7 @@ namespace vcpkg::Dependencies
{
}
package_spec_with_install_plan::package_spec_with_install_plan(const package_spec& spec, install_plan_action&& plan) : spec(spec), plan(std::move(plan))
package_spec_with_install_plan::package_spec_with_install_plan(const PackageSpec& spec, install_plan_action&& plan) : spec(spec), plan(std::move(plan))
{
}
@ -30,21 +30,21 @@ namespace vcpkg::Dependencies
{
}
package_spec_with_remove_plan::package_spec_with_remove_plan(const package_spec& spec, remove_plan_action&& plan)
package_spec_with_remove_plan::package_spec_with_remove_plan(const PackageSpec& spec, remove_plan_action&& plan)
: spec(spec), plan(std::move(plan))
{
}
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db)
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db)
{
std::unordered_map<package_spec, install_plan_action> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies
Graphs::Graph<package_spec> graph;
std::unordered_map<PackageSpec, install_plan_action> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies
Graphs::Graph<PackageSpec> graph;
graph.add_vertices(specs);
std::vector<package_spec> examine_stack(specs);
std::vector<PackageSpec> examine_stack(specs);
while (!examine_stack.empty())
{
const package_spec spec = examine_stack.back();
const PackageSpec spec = examine_stack.back();
examine_stack.pop_back();
if (was_examined.find(spec) != was_examined.end())
@ -56,7 +56,7 @@ namespace vcpkg::Dependencies
{
for (const std::string& dep_as_string : dependencies_as_string)
{
const package_spec current_dep = package_spec::from_name_and_triplet(dep_as_string, spec.target_triplet()).value_or_exit(VCPKG_LINE_INFO);
const PackageSpec current_dep = PackageSpec::from_name_and_triplet(dep_as_string, spec.target_triplet()).value_or_exit(VCPKG_LINE_INFO);
graph.add_edge(spec, current_dep);
if (was_examined.find(current_dep) == was_examined.end())
{
@ -94,26 +94,26 @@ namespace vcpkg::Dependencies
std::vector<package_spec_with_install_plan> ret;
const std::vector<package_spec> pkgs = graph.find_topological_sort();
for (const package_spec& pkg : pkgs)
const std::vector<PackageSpec> pkgs = graph.find_topological_sort();
for (const PackageSpec& pkg : pkgs)
{
ret.push_back(package_spec_with_install_plan(pkg, std::move(was_examined[pkg])));
}
return ret;
}
std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<package_spec>& specs, const StatusParagraphs& status_db)
std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db)
{
std::unordered_set<package_spec> specs_as_set(specs.cbegin(), specs.cend());
std::unordered_set<PackageSpec> specs_as_set(specs.cbegin(), specs.cend());
std::unordered_map<package_spec, remove_plan_action> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies
Graphs::Graph<package_spec> graph;
std::unordered_map<PackageSpec, remove_plan_action> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies
Graphs::Graph<PackageSpec> graph;
graph.add_vertices(specs);
std::vector<package_spec> examine_stack(specs);
std::vector<PackageSpec> examine_stack(specs);
while (!examine_stack.empty())
{
const package_spec spec = examine_stack.back();
const PackageSpec spec = examine_stack.back();
examine_stack.pop_back();
if (was_examined.find(spec) != was_examined.end())
@ -151,8 +151,8 @@ namespace vcpkg::Dependencies
std::vector<package_spec_with_remove_plan> ret;
const std::vector<package_spec> pkgs = graph.find_topological_sort();
for (const package_spec& pkg : pkgs)
const std::vector<PackageSpec> pkgs = graph.find_topological_sort();
for (const PackageSpec& pkg : pkgs)
{
ret.push_back(package_spec_with_remove_plan(pkg, std::move(was_examined[pkg])));
}

View File

@ -6,10 +6,10 @@
namespace vcpkg::Input
{
package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, CStringView example_text)
PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, CStringView example_text)
{
const std::string as_lowercase = Strings::ascii_to_lowercase(package_spec_as_string);
expected<package_spec> expected_spec = package_spec::from_string(as_lowercase, default_target_triplet);
expected<PackageSpec> expected_spec = PackageSpec::from_string(as_lowercase, default_target_triplet);
if (auto spec = expected_spec.get())
{
return *spec;

View File

@ -3,7 +3,7 @@
#include "vcpkg_paths.h"
#include "metrics.h"
#include "vcpkg_System.h"
#include "package_spec.h"
#include "PackageSpec.h"
#include "vcpkg_Files.h"
#include "vcpkg_Util.h"
@ -191,17 +191,17 @@ namespace vcpkg
return paths;
}
fs::path vcpkg_paths::package_dir(const package_spec& spec) const
fs::path vcpkg_paths::package_dir(const PackageSpec& spec) const
{
return this->packages / spec.dir();
}
fs::path vcpkg_paths::port_dir(const package_spec& spec) const
fs::path vcpkg_paths::port_dir(const PackageSpec& spec) const
{
return this->ports / spec.name();
}
fs::path vcpkg_paths::build_info_file_path(const package_spec& spec) const
fs::path vcpkg_paths::build_info_file_path(const PackageSpec& spec) const
{
return this->package_dir(spec) / "BUILD_INFO";
}

View File

@ -150,7 +150,7 @@
<ClInclude Include="..\include\MachineType.h" />
<ClInclude Include="..\include\metrics.h" />
<ClInclude Include="..\include\OptBool.h" />
<ClInclude Include="..\include\package_spec.h" />
<ClInclude Include="..\include\PackageSpec.h" />
<ClInclude Include="..\include\package_spec_parse_result.h" />
<ClInclude Include="..\include\Paragraphs.h" />
<ClInclude Include="..\include\pch.h" />
@ -225,7 +225,7 @@
<ClCompile Include="..\src\PostBuildLint_BuildType.cpp" />
<ClCompile Include="..\src\vcpkg_Chrono.cpp" />
<ClCompile Include="..\src\vcpkglib.cpp" />
<ClCompile Include="..\src\package_spec.cpp" />
<ClCompile Include="..\src\PackageSpec.cpp" />
<ClCompile Include="..\src\package_spec_parse_result.cpp" />
<ClCompile Include="..\src\Paragraphs.cpp" />
<ClCompile Include="..\src\SourceParagraph.cpp" />

View File

@ -15,9 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\package_spec.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\package_spec_parse_result.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -180,11 +177,11 @@
<ClCompile Include="..\src\OptBool.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\PackageSpec.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\package_spec.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\package_spec_parse_result.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -314,5 +311,8 @@
<ClInclude Include="..\include\OptBool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\PackageSpec.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>