aboutsummaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-12-07 08:24:59 -0800
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-12-07 08:27:24 -0800
commitdc5c9bb30f29e402e3d4b2a9e0251ab64ec98eda (patch)
tree6a8b2005eca1c561484f3a9d69f29cfb85bb061c /src/clients
parent8f321d9a3dd1701fcec489362bbc74f37e102fb4 (diff)
downloadpaludis-dc5c9bb30f29e402e3d4b2a9e0251ab64ec98eda.tar.gz
paludis-dc5c9bb30f29e402e3d4b2a9e0251ab64ec98eda.tar.xz
introduce and use an iterator range in BrokenLinkageFinder
Add some convenience helpers for iteration to BrokenLinkageFinder. This allows us to use range based for loops in cave fix-linkage.
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc40
1 files changed, 15 insertions, 25 deletions
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index 1bc925102..f070225a5 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -195,36 +195,30 @@ FixLinkageCommand::run(const std::shared_ptr<Environment> & env,
std::shared_ptr<Sequence<std::pair<std::string, std::string>>> targets(std::make_shared<Sequence<std::pair<std::string, std::string>>>());
- for (BrokenLinkageFinder::BrokenPackageConstIterator pkg_it(finder->begin_broken_packages()),
- pkg_it_end(finder->end_broken_packages()); pkg_it_end != pkg_it; ++pkg_it)
+ for (const auto & package : finder->broken_packages())
{
cout << endl;
- cout << "* " << **pkg_it << endl;
+ cout << "* " << *package << endl;
std::set<FSPath, FSPathComparator> broken_files;
- for (BrokenLinkageFinder::BrokenFileConstIterator file_it(finder->begin_broken_files(*pkg_it)),
- file_it_end(finder->end_broken_files(*pkg_it)); file_it_end != file_it; ++file_it)
+ for (const auto & file : finder->broken_files(package))
{
- cout << " " << *file_it;
- cout << " (requires "
- << join(finder->begin_missing_requirements(*pkg_it, *file_it),
- finder->end_missing_requirements(*pkg_it, *file_it),
- " ") << ")";
- std::copy(finder->begin_missing_requirements(*pkg_it, *file_it), finder->end_missing_requirements(*pkg_it, *file_it),
- create_inserter<FSPath>(std::inserter(broken_files, broken_files.end())));
+ cout << " " << file;
+ cout << " (requires " << join(finder->begin_missing_requirements(package, file), finder->end_missing_requirements(package, file), " ") << ")";
+ std::copy(finder->begin_missing_requirements(package, file), finder->end_missing_requirements(package, file),
+ create_inserter<FSPath>(std::inserter(broken_files, broken_files.end())));
cout << endl;
}
PartiallyMadePackageDepSpec part_spec({ });
- part_spec.package((*pkg_it)->name());
- if ((*pkg_it)->slot_key())
- part_spec.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>((*pkg_it)->slot_key()->parse_value().parallel_value()));
+ part_spec.package(package->name());
+ if (package->slot_key())
+ part_spec.slot_requirement(std::make_shared<UserSlotExactPartialRequirement>(package->slot_key()->parse_value().parallel_value()));
if (cmdline.a_exact.specified())
- part_spec.version_requirement(make_named_values<VersionRequirement>(
- n::version_operator() = vo_equal,
- n::version_spec() = (*pkg_it)->version()));
+ part_spec.version_requirement(make_named_values<VersionRequirement>(n::version_operator() = vo_equal,
+ n::version_spec() = package->version()));
targets->push_back(std::make_pair(stringify(PackageDepSpec(part_spec)), join(broken_files.begin(), broken_files.end(), ", ")));
}
@@ -237,14 +231,10 @@ FixLinkageCommand::run(const std::shared_ptr<Environment> & env,
else
cout << endl << "The following files that depend on the specified library(ies) are not owned by any installed package:" << endl;
- for (BrokenLinkageFinder::BrokenFileConstIterator file_it(finder->begin_broken_files(orphans)),
- file_it_end(finder->end_broken_files(orphans)); file_it_end != file_it; ++file_it)
+ for (const auto & file : finder->broken_files(orphans))
{
- cout << " " << *file_it;
- cout << " (requires "
- << join(finder->begin_missing_requirements(orphans, *file_it),
- finder->end_missing_requirements(orphans, *file_it),
- " ") << ")";
+ cout << " " << file;
+ cout << " (requires " << join(finder->begin_missing_requirements(orphans, file), finder->end_missing_requirements(orphans, file), " ") << ")";
cout << endl;
}
}