aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-10 12:51:23 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-10 12:51:23 +0100
commit9bdf137a640f671c42a5c4e0998382cc03504a5b (patch)
tree6d1b96f95be7c6bda992fab2f7c2a94177639a3d
parent0316b5a84ed09e910ea388517d87385475fc1ae8 (diff)
downloadpaludis-9bdf137a640f671c42a5c4e0998382cc03504a5b.tar.gz
paludis-9bdf137a640f671c42a5c4e0998382cc03504a5b.tar.xz
Better reasons for fix-linkage
Fixes: ticket:861
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc10
-rw-r--r--src/clients/cave/cmd_import.cc9
-rw-r--r--src/clients/cave/cmd_resolve.cc4
-rw-r--r--src/clients/cave/cmd_uninstall.cc5
-rw-r--r--src/clients/cave/resolve_common.cc44
-rw-r--r--src/clients/cave/resolve_common.hh2
6 files changed, 45 insertions, 29 deletions
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index 565523b..82aafca 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -38,6 +38,7 @@
#include <paludis/version_requirements.hh>
#include <iostream>
+#include <set>
#include <cstdlib>
using namespace paludis;
@@ -183,7 +184,7 @@ FixLinkageCommand::run(
return EXIT_SUCCESS;
}
- std::tr1::shared_ptr<Sequence<std::string> > targets(new Sequence<std::string>);
+ std::tr1::shared_ptr<Sequence<std::pair<std::string, std::string> > > targets(new 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)
@@ -192,15 +193,20 @@ FixLinkageCommand::run(
cout << "* " << **pkg_it << endl;
+ std::set<FSEntry> 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)
{
cout << " " << *file_it;
if (library.empty())
+ {
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),
+ std::inserter(broken_files, broken_files.end()));
+ }
cout << endl;
}
@@ -214,7 +220,7 @@ FixLinkageCommand::run(
n::version_operator() = vo_equal,
n::version_spec() = (*pkg_it)->version()));
- targets->push_back(stringify(PackageDepSpec(part_spec)));
+ targets->push_back(std::make_pair(stringify(PackageDepSpec(part_spec)), join(broken_files.begin(), broken_files.end(), ", ")));
}
std::tr1::shared_ptr<const PackageID> orphans;
diff --git a/src/clients/cave/cmd_import.cc b/src/clients/cave/cmd_import.cc
index 98bddac..4dd7a0d 100644
--- a/src/clients/cave/cmd_import.cc
+++ b/src/clients/cave/cmd_import.cc
@@ -272,15 +272,18 @@ ImportCommand::run(
if (cmdline.a_execute.specified())
resolve_cmdline.resolution_options.a_execute.set_specified(true);
- std::tr1::shared_ptr<Sequence<std::string> > targets(new Sequence<std::string>);
- targets->push_back(stringify((*ids->begin())->name()));
+ std::tr1::shared_ptr<Sequence<std::pair<std::string, std::string> > > targets(new Sequence<std::pair<std::string, std::string> >);
+ targets->push_back(std::make_pair(stringify((*ids->begin())->name()), ""));
+
+ std::tr1::shared_ptr<Sequence<std::string> > world_specs(new Sequence<std::string>);
+ world_specs->push_back(stringify((*ids->begin())->name()));
return resolve_common(env,
resolve_cmdline.resolution_options,
resolve_cmdline.execution_options,
resolve_cmdline.display_options,
resolve_cmdline.program_options,
- keys, targets, targets, false);
+ keys, targets, world_specs, false);
}
std::tr1::shared_ptr<args::ArgsHandler>
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index 1b057a6..8a6a5ed 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -97,10 +97,10 @@ ResolveCommand::run(
cmdline.resolution_options.apply_shortcuts();
cmdline.resolution_options.verify(env);
- std::tr1::shared_ptr<Sequence<std::string> > targets(new Sequence<std::string>);
+ std::tr1::shared_ptr<Sequence<std::pair<std::string, std::string> > > targets(new Sequence<std::pair<std::string, std::string> >);
for (ResolveCommandLine::ParametersConstIterator p(cmdline.begin_parameters()), p_end(cmdline.end_parameters()) ;
p != p_end ; ++p)
- targets->push_back(*p);
+ targets->push_back(std::make_pair(*p, ""));
return resolve_common(env, cmdline.resolution_options, cmdline.execution_options, cmdline.display_options,
cmdline.program_options, make_null_shared_ptr(), targets, make_null_shared_ptr(), false);
diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc
index bf20839..fac1603 100644
--- a/src/clients/cave/cmd_uninstall.cc
+++ b/src/clients/cave/cmd_uninstall.cc
@@ -111,7 +111,8 @@ UninstallCommand::run(
cmdline.resolution_options->apply_shortcuts();
cmdline.resolution_options->verify(env);
- std::tr1::shared_ptr<Sequence<std::string> > targets(new Sequence<std::string>), targets_cleaned_up(new Sequence<std::string>);
+ std::tr1::shared_ptr<Sequence<std::pair<std::string, std::string> > > targets(new Sequence<std::pair<std::string, std::string> >);
+ std::tr1::shared_ptr<Sequence<std::string> > targets_cleaned_up(new Sequence<std::string>);
for (UninstallCommandLine::ParametersConstIterator p(cmdline.begin_parameters()), p_end(cmdline.end_parameters()) ;
p != p_end ; ++p)
{
@@ -130,7 +131,7 @@ UninstallCommand::run(
std::string target("!" + stringify((*i)->name()));
if ((*i)->slot_key())
target.append(":" + stringify((*i)->slot_key()->value()));
- targets->push_back(target);
+ targets->push_back(std::make_pair(target, ""));
}
targets_cleaned_up->push_back("!" + stringify((*ids->begin())->name()));
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 03bdf7b..ed4ca91 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -40,6 +40,8 @@
#include <paludis/util/map.hh>
#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/args/do_help.hh>
#include <paludis/args/escape.hh>
#include <paludis/resolver/resolver.hh>
@@ -250,7 +252,7 @@ namespace
const std::tr1::shared_ptr<Environment> & env,
const std::tr1::shared_ptr<Resolver> & resolver,
const ResolveCommandLineResolutionOptions &,
- const std::tr1::shared_ptr<const Sequence<std::string> > & targets,
+ const std::tr1::shared_ptr<const Sequence<std::pair<std::string, std::string> > > & targets,
bool & is_set)
{
Context context("When adding targets from commandline:");
@@ -260,28 +262,28 @@ namespace
const std::tr1::shared_ptr<Sequence<std::string> > result(new Sequence<std::string>);
bool seen_sets(false), seen_packages(false);
- for (Sequence<std::string>::ConstIterator p(targets->begin()), p_end(targets->end()) ;
+ for (Sequence<std::pair<std::string, std::string> >::ConstIterator p(targets->begin()), p_end(targets->end()) ;
p != p_end ; ++p)
{
- if (p->empty())
+ if (p->first.empty())
continue;
try
{
- if ('!' == p->at(0))
+ if ('!' == p->first.at(0))
{
seen_packages = true;
- PackageDepSpec s(parse_user_package_dep_spec(p->substr(1), env.get(), UserPackageDepSpecOptions()));
+ PackageDepSpec s(parse_user_package_dep_spec(p->first.substr(1), env.get(), UserPackageDepSpecOptions()));
BlockDepSpec bs("!" + stringify(s), s, false);
result->push_back(stringify(bs));
- resolver->add_target(bs, "");
+ resolver->add_target(bs, p->second);
}
else
{
- PackageDepSpec s(parse_user_package_dep_spec(*p, env.get(),
+ PackageDepSpec s(parse_user_package_dep_spec(p->first, env.get(),
UserPackageDepSpecOptions() + updso_throw_if_set));
result->push_back(stringify(s));
- resolver->add_target(s, "");
+ resolver->add_target(s, p->second);
seen_packages = true;
}
}
@@ -290,8 +292,8 @@ namespace
if (seen_sets)
throw args::DoHelp("Cannot specify multiple set targets");
- resolver->add_target(SetName(*p), "");
- result->push_back(*p);
+ resolver->add_target(SetName(p->first), p->second);
+ result->push_back(p->first);
seen_sets = true;
}
}
@@ -1312,7 +1314,7 @@ namespace
const ResolveCommandLineDisplayOptions & display_options,
const ResolveCommandLineProgramOptions & program_options,
const std::tr1::shared_ptr<const Map<std::string, std::string> > & keys_if_import,
- const std::tr1::shared_ptr<const Sequence<std::string> > & targets)
+ const std::tr1::shared_ptr<const Sequence<std::pair<std::string, std::string> > > & targets)
{
Context context("When displaying chosen resolution:");
@@ -1335,9 +1337,9 @@ namespace
}
}
- for (Sequence<std::string>::ConstIterator p(targets->begin()), p_end(targets->end()) ;
+ for (Sequence<std::pair<std::string, std::string> >::ConstIterator p(targets->begin()), p_end(targets->end()) ;
p != p_end ; ++p)
- args->push_back(*p);
+ args->push_back(p->first);
if (program_options.a_display_resolution_program.specified())
{
@@ -1380,7 +1382,7 @@ namespace
const ResolveCommandLineExecutionOptions & execution_options,
const ResolveCommandLineProgramOptions & program_options,
const std::tr1::shared_ptr<const Map<std::string, std::string> > & keys_if_import,
- const std::tr1::shared_ptr<const Sequence<std::string> > & targets,
+ const std::tr1::shared_ptr<const Sequence<std::pair<std::string, std::string> > > & targets,
const std::tr1::shared_ptr<const Sequence<std::string> > & world_specs,
const bool is_set)
{
@@ -1425,9 +1427,9 @@ namespace
args->push_back(*p);
}
- for (Sequence<std::string>::ConstIterator p(targets->begin()), p_end(targets->end()) ;
+ for (Sequence<std::pair<std::string, std::string> >::ConstIterator p(targets->begin()), p_end(targets->end()) ;
p != p_end ; ++p)
- args->push_back(*p);
+ args->push_back(p->first);
if (program_options.a_execute_resolution_program.specified() || resolution_options.a_execute.specified())
{
@@ -1600,7 +1602,7 @@ paludis::cave::resolve_common(
const ResolveCommandLineDisplayOptions & display_options,
const ResolveCommandLineProgramOptions & program_options,
const std::tr1::shared_ptr<const Map<std::string, std::string> > & keys_if_import,
- const std::tr1::shared_ptr<const Sequence<std::string> > & targets_if_not_purge,
+ const std::tr1::shared_ptr<const Sequence<std::pair<std::string, std::string> > > & targets_if_not_purge,
const std::tr1::shared_ptr<const Sequence<std::string> > & world_specs_if_not_auto,
const bool purge)
{
@@ -1904,7 +1906,7 @@ paludis::cave::resolve_common(
retcode |= display_resolution(env, resolver->resolved(), resolution_options,
display_options, program_options, keys_if_import,
- purge ? make_shared_ptr(new const Sequence<std::string>) : targets_if_not_purge);
+ purge ? make_shared_ptr(new const Sequence<std::pair<std::string, std::string> >) : targets_if_not_purge);
if (! resolver->resolved()->taken_unable_to_make_decisions()->empty())
retcode |= 1;
@@ -1918,7 +1920,7 @@ paludis::cave::resolve_common(
if (0 == retcode)
return perform_resolution(env, resolver->resolved(), resolution_options,
execution_options, program_options, keys_if_import,
- purge ? make_shared_ptr(new const Sequence<std::string>) : targets_if_not_purge,
+ purge ? make_shared_ptr(new const Sequence<std::pair<std::string, std::string> >) : targets_if_not_purge,
world_specs_if_not_auto ? world_specs_if_not_auto : targets_cleaned_up,
is_set);
}
@@ -1934,3 +1936,7 @@ paludis::cave::resolve_common(
return retcode | 1;
}
+template class Sequence<std::pair<std::string, std::string> >;
+template class WrappedForwardIterator<Sequence<std::pair<std::string, std::string> >::ConstIteratorTag,
+ const std::pair<std::string, std::string> >;
+
diff --git a/src/clients/cave/resolve_common.hh b/src/clients/cave/resolve_common.hh
index ea0ef71..5fb0689 100644
--- a/src/clients/cave/resolve_common.hh
+++ b/src/clients/cave/resolve_common.hh
@@ -37,7 +37,7 @@ namespace paludis
const ResolveCommandLineDisplayOptions & display_options,
const ResolveCommandLineProgramOptions & program_options,
const std::tr1::shared_ptr<const Map<std::string, std::string> > & keys_if_import,
- const std::tr1::shared_ptr<const Sequence<std::string> > & targets_if_not_purge,
+ const std::tr1::shared_ptr<const Sequence<std::pair<std::string, std::string> > > & targets_if_not_purge,
const std::tr1::shared_ptr<const Sequence<std::string> > & world_specs_if_not_auto,
const bool purge
) PALUDIS_ATTRIBUTE((warn_unused_result));