aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-27 13:44:54 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-27 13:44:54 +0100
commit7fe98e809eaa0d96f8e33c5f3a9526f88597fa0a (patch)
tree587e84d0aa125b2917d5f0452610ce64890b652c
parent9c5bc5e125d2b3306475490331210807ea065723 (diff)
downloadpaludis-7fe98e809eaa0d96f8e33c5f3a9526f88597fa0a.tar.gz
paludis-7fe98e809eaa0d96f8e33c5f3a9526f88597fa0a.tar.xz
more binaries work
-rw-r--r--paludis/resolver/resolver.cc20
-rw-r--r--paludis/resolver/resolver.hh3
-rw-r--r--paludis/resolver/resolver_functions.hh2
-rw-r--r--paludis/resolver/resolver_test.cc4
-rw-r--r--paludis/resolver/resolver_test.hh2
-rw-r--r--src/clients/cave/cmd_resolve.cc15
6 files changed, 25 insertions, 21 deletions
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index fb4b141..da8a02d 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -1362,24 +1362,16 @@ Resolver::_get_resolvents_for(
exact_slot = spec.slot_requirement_ptr()->accept_returning<std::tr1::shared_ptr<SlotName> >(f);
}
- if (exact_slot)
- {
- std::tr1::shared_ptr<Resolvents> result(new Resolvents);
- DestinationTypes destination_types(_get_destination_types_for(spec, reason));
- for (EnumIterator<DestinationType> t, t_end(last_dt) ; t != t_end ; ++t)
- if (destination_types[*t])
- result->push_back(Resolvent(spec, *exact_slot, *t));
- return result;
- }
- else
- return _imp->fns.get_resolvents_for_fn()(spec, reason);
+ return _imp->fns.get_resolvents_for_fn()(spec, exact_slot, reason);
}
const DestinationTypes
-Resolver::_get_destination_types_for(const PackageDepSpec & spec,
+Resolver::_get_destination_types_for(
+ const PackageDepSpec & spec,
+ const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const Reason> & reason) const
{
- return _imp->fns.get_destination_types_for_fn()(spec, reason);
+ return _imp->fns.get_destination_types_for_fn()(spec, id, reason);
}
const std::tr1::shared_ptr<const Resolvents>
@@ -1390,7 +1382,7 @@ Resolver::_get_error_resolvents_for(
Context context("When finding slots for '" + stringify(spec) + "', which can't be found the normal way:");
std::tr1::shared_ptr<Resolvents> result(new Resolvents);
- DestinationTypes destination_types(_get_destination_types_for(spec, reason));
+ DestinationTypes destination_types(_get_destination_types_for(spec, make_null_shared_ptr(), reason));
for (EnumIterator<DestinationType> t, t_end(last_dt) ; t != t_end ; ++t)
if (destination_types[*t])
result->push_back(Resolvent(spec, true, *t));
diff --git a/paludis/resolver/resolver.hh b/paludis/resolver/resolver.hh
index 845d676..0ae43fd 100644
--- a/paludis/resolver/resolver.hh
+++ b/paludis/resolver/resolver.hh
@@ -67,7 +67,8 @@ namespace paludis
const DestinationTypes _get_destination_types_for(
const PackageDepSpec & spec,
- const std::tr1::shared_ptr<const Reason> & reason) const;
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Reason> &) const;
const std::tr1::shared_ptr<const Resolvents> _get_error_resolvents_for(
const PackageDepSpec & spec,
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index b18bc43..04d5e28 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -59,6 +59,7 @@ namespace paludis
typedef std::tr1::function<DestinationTypes (
const PackageDepSpec &,
+ const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Reason> &
)> GetDestinationTypesForFunction;
@@ -68,6 +69,7 @@ namespace paludis
typedef std::tr1::function<std::tr1::shared_ptr<Resolvents> (
const PackageDepSpec &,
+ const std::tr1::shared_ptr<const SlotName> &,
const std::tr1::shared_ptr<const Reason> &
)> GetResolventsForFunction;
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 5739719..e0f24a3 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -80,10 +80,11 @@ paludis::resolver::resolver_test::initial_constraints_for_fn(
std::tr1::shared_ptr<Resolvents>
paludis::resolver::resolver_test::get_resolvents_for_fn(const PackageDepSpec & spec,
+ const std::tr1::shared_ptr<const SlotName> & slot,
const std::tr1::shared_ptr<const Reason> &)
{
std::tr1::shared_ptr<Resolvents> result(new Resolvents);
- result->push_back(Resolvent(spec, make_shared_ptr(new SlotName("0")), dt_install_to_slash));
+ result->push_back(Resolvent(spec, slot ? slot : make_shared_ptr(new const SlotName("0")), dt_install_to_slash));
return result;
}
@@ -107,6 +108,7 @@ paludis::resolver::resolver_test::make_destination_filtered_generator_fn(const G
DestinationTypes
paludis::resolver::resolver_test::get_destination_types_for_fn(const PackageDepSpec &,
+ const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Reason> &)
{
return DestinationTypes() + dt_install_to_slash;
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 58f8823..48c24b8 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -59,6 +59,7 @@ namespace paludis
const Resolvent & resolvent);
std::tr1::shared_ptr<Resolvents> get_resolvents_for_fn(const PackageDepSpec & spec,
+ const std::tr1::shared_ptr<const SlotName> &,
const std::tr1::shared_ptr<const Reason> &);
bool is_suggestion(const SanitisedDependency & dep);
@@ -82,6 +83,7 @@ namespace paludis
FilteredGenerator make_destination_filtered_generator_fn(const Generator &, const Resolvent &);
DestinationTypes get_destination_types_for_fn(const PackageDepSpec &,
+ const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Reason> &);
struct ResolverTestCase : test::TestCase
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index b70afb2..3608975 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -95,7 +95,7 @@ namespace
DestinationTypes visit(const DependencyReason &) const
{
- return DestinationTypes() + dt_install_to_slash;
+ return visit(TargetReason()) + dt_install_to_slash;
}
DestinationTypes visit(const PresetReason &) const PALUDIS_ATTRIBUTE((noreturn))
@@ -113,6 +113,7 @@ namespace
const Environment * const,
const ResolveCommandLine & cmdline,
const PackageDepSpec &,
+ const std::tr1::shared_ptr<const PackageID> &,
const std::tr1::shared_ptr<const Reason> & reason)
{
DestinationTypesFinder f(cmdline);
@@ -400,6 +401,7 @@ namespace
get_resolvents_for_fn(const Environment * const env,
const ResolveCommandLine & cmdline,
const PackageDepSpec & spec,
+ const std::tr1::shared_ptr<const SlotName> & maybe_slot,
const std::tr1::shared_ptr<const Reason> & reason)
{
std::tr1::shared_ptr<PackageIDSequence> result_ids(new PackageIDSequence);
@@ -408,7 +410,8 @@ namespace
const std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
generator::Matches(spec, MatchPackageOptions() + mpo_ignore_additional_requirements) |
filter::SupportsAction<InstallAction>() |
- filter::NotMasked())]);
+ filter::NotMasked() |
+ (maybe_slot ? Filter(filter::Slot(*maybe_slot)) : Filter(filter::All())))]);
if (! ids->empty())
best = *ids->begin();
@@ -453,7 +456,7 @@ namespace
for (PackageIDSequence::ConstIterator i(result_ids->begin()), i_end(result_ids->end()) ;
i != i_end ; ++i)
{
- DestinationTypes destination_types(get_destination_types_for_fn(env, cmdline, spec, reason));
+ DestinationTypes destination_types(get_destination_types_for_fn(env, cmdline, spec, *i, reason));
for (EnumIterator<DestinationType> t, t_end(last_dt) ; t != t_end ; ++t)
if (destination_types[*t])
result->push_back(Resolvent(*i, *t));
@@ -964,11 +967,13 @@ ResolveCommand::run(
env.get(), std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2,
std::tr1::placeholders::_3)),
value_for<n::get_destination_types_for_fn>(std::tr1::bind(&get_destination_types_for_fn,
- env.get(), std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2)),
+ env.get(), std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2,
+ std::tr1::placeholders::_3)),
value_for<n::get_initial_constraints_for_fn>(std::tr1::bind(&initial_constraints_for_fn,
env.get(), std::tr1::cref(cmdline), std::tr1::cref(initial_constraints), std::tr1::placeholders::_1)),
value_for<n::get_resolvents_for_fn>(std::tr1::bind(&get_resolvents_for_fn,
- env.get(), std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2)),
+ env.get(), std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2,
+ std::tr1::placeholders::_3)),
value_for<n::get_use_existing_fn>(std::tr1::bind(&use_existing_fn,
std::tr1::cref(cmdline), std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3)),
value_for<n::make_destination_filtered_generator_fn>(std::tr1::bind(&make_destination_filtered_generator,