mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 01:39:01 +08:00
add needs_rebuild, should probably be moved to somewhere else
This commit is contained in:
parent
f18ffe9968
commit
d39bd70d53
@ -62,6 +62,8 @@ namespace vcpkg
|
||||
/// <returns>`true` if installed, `false` if not or not found.</returns>
|
||||
bool is_installed(const FeatureSpec& spec) const;
|
||||
|
||||
bool needs_rebuild(const PackageSpec& spec);
|
||||
|
||||
iterator insert(std::unique_ptr<StatusParagraph>);
|
||||
|
||||
friend void serialize(const StatusParagraphs& pgh, std::string& out_str);
|
||||
|
@ -118,6 +118,31 @@ namespace vcpkg
|
||||
return it != end() && (*it)->is_installed();
|
||||
}
|
||||
|
||||
bool vcpkg::StatusParagraphs::needs_rebuild(const PackageSpec& spec)
|
||||
{
|
||||
auto it = find(spec);
|
||||
if (it != end())
|
||||
{
|
||||
for (const std::string& dep : (*it)->package.depends)
|
||||
{
|
||||
PackageSpec dep_spec =
|
||||
PackageSpec::from_name_and_triplet(
|
||||
dep,
|
||||
spec.triplet()).value_or_exit(VCPKG_LINE_INFO);
|
||||
|
||||
if (needs_rebuild(dep_spec))
|
||||
{
|
||||
(*it)->state = InstallState::NEEDS_REBUILD;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return (*it)->needs_rebuild();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
StatusParagraphs::iterator StatusParagraphs::insert(std::unique_ptr<StatusParagraph> pgh)
|
||||
{
|
||||
Checks::check_exit(VCPKG_LINE_INFO, pgh != nullptr, "Inserted null paragraph");
|
||||
|
Loading…
Reference in New Issue
Block a user