aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ɓukasz P. Michalik <lmi@ift.uni.wroc.pl> 2010-08-10 14:26:43 +0200
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-10 14:10:55 +0100
commitb025b4f6029d444e3feee5c8c0bc2674488059d6 (patch)
tree13c93ed32386d0ec9171df822bbdc98d3dfab90c
parent65e9b54d1955e0a47bed319da77477c5cd6a1b16 (diff)
downloadpaludis-b025b4f6029d444e3feee5c8c0bc2674488059d6.tar.gz
paludis-b025b4f6029d444e3feee5c8c0bc2674488059d6.tar.xz
Mutliple --libraries for cave fix-linkage
-rw-r--r--paludis/broken_linkage_finder.cc17
-rw-r--r--paludis/broken_linkage_finder.hh3
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc22
-rw-r--r--src/clients/reconcilio/fix_linkage.cc4
4 files changed, 26 insertions, 20 deletions
diff --git a/paludis/broken_linkage_finder.cc b/paludis/broken_linkage_finder.cc
index d75eabd..92e48ce 100644
--- a/paludis/broken_linkage_finder.cc
+++ b/paludis/broken_linkage_finder.cc
@@ -67,7 +67,7 @@ namespace paludis
{
const Environment * env;
const BrokenLinkageConfiguration config;
- std::string library;
+ std::shared_ptr<const Sequence<std::string>> libraries;
std::vector<std::shared_ptr<LinkageChecker> > checkers;
std::set<FSEntry> extra_lib_dirs;
@@ -88,10 +88,10 @@ namespace paludis
void add_breakage(const FSEntry &, const std::string &);
void gather_package(const std::shared_ptr<const PackageID> &);
- Imp(const Environment * the_env, const std::string & the_library) :
+ Imp(const Environment * the_env, const std::shared_ptr<const Sequence<std::string>> & the_libraries) :
env(the_env),
config(the_env->root()),
- library(the_library),
+ libraries(the_libraries),
has_files(false)
{
}
@@ -139,15 +139,16 @@ namespace
};
}
-BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::string & library) :
- Pimp<BrokenLinkageFinder>(env, library)
+BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::shared_ptr<const Sequence<std::string>> & libraries) :
+ Pimp<BrokenLinkageFinder>(env, libraries)
{
using namespace std::placeholders;
Context ctx("When checking for broken linkage in '" + stringify(env->root()) + "':");
- _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<ElfLinkageChecker>(env->root(), library)));
- if (library.empty())
+ for (auto i(libraries->begin()), i_end(libraries->end()) ; i != i_end ; ++i)
+ _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<ElfLinkageChecker>(env->root(), *i)));
+ if (libraries->empty())
_imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<LibtoolLinkageChecker>(env->root())));
std::vector<FSEntry> search_dirs_nosyms, search_dirs_pruned;
@@ -293,7 +294,7 @@ Imp<BrokenLinkageFinder>::add_breakage(const FSEntry & file, const std::string &
{
using namespace std::placeholders;
- if (library.empty() && config.lib_is_masked(req))
+ if (libraries->empty() && config.lib_is_masked(req))
return;
if (! has_files)
diff --git a/paludis/broken_linkage_finder.hh b/paludis/broken_linkage_finder.hh
index e2ac1f2..d944b0f 100644
--- a/paludis/broken_linkage_finder.hh
+++ b/paludis/broken_linkage_finder.hh
@@ -23,6 +23,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/pimp.hh>
+#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <paludis/environment-fwd.hh>
@@ -36,7 +37,7 @@ namespace paludis
private paludis::Pimp<BrokenLinkageFinder>
{
public:
- BrokenLinkageFinder(const paludis::Environment *, const std::string &);
+ BrokenLinkageFinder(const paludis::Environment *, const std::shared_ptr<const Sequence<std::string>> &);
~BrokenLinkageFinder();
BrokenLinkageFinder(const BrokenLinkageFinder &) = delete;
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index 9c9f679..3d7334b 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -63,14 +63,14 @@ namespace
args::SwitchArg a_execute;
args::ArgsGroup g_linkage_options;
- args::StringArg a_library;
+ args::StringSetArg a_libraries;
args::SwitchArg a_exact;
FixLinkageCommandLine() :
g_execution_options(main_options_section(), "Execution Options", "Control execution."),
a_execute(&g_execution_options, "execute", 'x', "Execute the suggested actions", true),
g_linkage_options(main_options_section(), "Linkage options", "Options relating to linkage"),
- a_library(&g_linkage_options, "library", 'l', "Only rebuild packages linked against this library, even if it exists"),
+ a_libraries(&g_linkage_options, "library", 'l', "Only rebuild packages linked against this library, even if it exists. May be specified multiple times."),
a_exact(&g_linkage_options, "exact", 'e', "Rebuild the same package version that is currently installed", true)
{
add_usage_line("[ -x|--execute ] [ --library foo.so.1 ] [ -- options for 'cave resolve' ]");
@@ -166,21 +166,23 @@ FixLinkageCommand::run(
if (cmdline.a_execute.specified())
resolve_cmdline.resolution_options.a_execute.set_specified(true);
- std::string library(cmdline.a_library.argument());
+ auto libraries(std::make_shared<Sequence<std::string>>());
+ std::copy(cmdline.a_libraries.begin_args(), cmdline.a_libraries.end_args(),
+ std::back_inserter(*libraries));
std::shared_ptr<BrokenLinkageFinder> finder;
{
DisplayCallback display_callback("Searching: ");
ScopedNotifierCallback display_callback_holder(env.get(),
NotifierCallbackFunction(std::cref(display_callback)));
- finder = std::make_shared<BrokenLinkageFinder>(env.get(), cmdline.a_library.argument());
+ finder = std::make_shared<BrokenLinkageFinder>(env.get(), libraries);
}
if (finder->begin_broken_packages() == finder->end_broken_packages())
{
- if (library.empty())
+ if (libraries->empty())
cout << "No broken packages found" << endl;
else
- cout << "No packages that depend on " << library << " found" << endl;
+ cout << "No packages that depend on " << join(libraries->begin(), libraries->end(), ", ") << " found" << endl;
return EXIT_SUCCESS;
}
@@ -199,7 +201,7 @@ FixLinkageCommand::run(
file_it_end(finder->end_broken_files(*pkg_it)); file_it_end != file_it; ++file_it)
{
cout << " " << *file_it;
- if (library.empty())
+ if (libraries->empty())
{
cout << " (requires "
<< join(finder->begin_missing_requirements(*pkg_it, *file_it),
@@ -227,16 +229,16 @@ FixLinkageCommand::run(
std::shared_ptr<const PackageID> orphans;
if (finder->begin_broken_files(orphans) != finder->end_broken_files(orphans))
{
- if (library.empty())
+ if (libraries->empty())
cout << endl << "The following broken files are not owned by any installed package:" << endl;
else
- cout << endl << "The following files that depend on " << library << " are not owned by any installed package:" << endl;
+ cout << endl << "The following files that depend on " << join(libraries->begin(), libraries->end(), ", ") << " 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)
{
cout << " " << *file_it;
- if (library.empty())
+ if (libraries->empty())
cout << " (requires "
<< join(finder->begin_missing_requirements(orphans, *file_it),
finder->end_missing_requirements(orphans, *file_it),
diff --git a/src/clients/reconcilio/fix_linkage.cc b/src/clients/reconcilio/fix_linkage.cc
index 0114893..ce30bb3 100644
--- a/src/clients/reconcilio/fix_linkage.cc
+++ b/src/clients/reconcilio/fix_linkage.cc
@@ -49,12 +49,14 @@ do_fix_linkage(const std::shared_ptr<Environment> & env)
Context ctx("When performing the Fix Linkage action:");
std::string library(CommandLine::get_instance()->a_library.argument());
+ auto libraries(std::make_shared<Sequence<std::string>>());
+ libraries->push_back(library);
if (library.empty())
std::cout << "Searching for broken packages... " << std::flush;
else
std::cout << "Searching for packages that depend on " << library << "... " << std::flush;
- BrokenLinkageFinder finder(env.get(), library);
+ BrokenLinkageFinder finder(env.get(), libraries);
std::cout << std::endl;
if (finder.begin_broken_packages() == finder.end_broken_packages())