aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-04-06 15:26:37 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-04-06 15:26:37 +0100
commit17388019c5c47f50b086c30ad43d8b451831b3c8 (patch)
treedae39d24868f267d09296cfe7207168c43224c0d
parent91c3701361d9c6e28c59c5f45062f2bd1be8ab57 (diff)
downloadpaludis-17388019c5c47f50b086c30ad43d8b451831b3c8.tar.gz
paludis-17388019c5c47f50b086c30ad43d8b451831b3c8.tar.xz
Rework and fix take/ignore
-rw-r--r--paludis/resolver/Makefile.am10
-rw-r--r--paludis/resolver/decider.cc32
-rw-r--r--paludis/resolver/decider.hh7
-rw-r--r--paludis/resolver/resolver_functions-fwd.hh8
-rw-r--r--paludis/resolver/resolver_functions.cc29
-rw-r--r--paludis/resolver/resolver_functions.hh29
-rw-r--r--paludis/resolver/resolver_functions.se15
-rw-r--r--paludis/resolver/resolver_test.cc24
-rw-r--r--paludis/resolver/resolver_test.hh10
-rw-r--r--src/clients/cave/resolve_common.cc151
10 files changed, 189 insertions, 126 deletions
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index 72bafeb..17af9bb 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -5,6 +5,7 @@ DISTCLEANFILES = \
change_type-se.hh change_type-se.cc \
destination_types-se.hh destination_types-se.cc \
failure_kinds-se.hh failure_kinds-se.cc \
+ resolver_functions-se.hh resolver_functions-se.cc \
use_existing-se.hh use_existing-se.cc
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
EXTRA_DIST = \
@@ -12,6 +13,7 @@ EXTRA_DIST = \
change_type-se.hh change_type-se.cc change_type.se \
destination_types-se.hh destination_types-se.cc destination_types.se \
failure_kinds-se.hh failure_kinds-se.cc failure_kinds.se \
+ resolver_functions-se.hh resolver_functions-se.cc resolver_functions.se \
use_existing-se.hh use_existing-se.cc use_existing.se \
$(check_SCRIPTS)
BUILT_SOURCES = \
@@ -19,6 +21,7 @@ BUILT_SOURCES = \
change_type-se.hh change_type-se.cc \
destination_types-se.hh destination_types-se.cc \
failure_kinds-se.hh failure_kinds-se.cc \
+ resolver_functions-se.hh resolver_functions-se.cc \
use_existing-se.hh use_existing-se.cc
noinst_HEADERS = \
@@ -71,6 +74,7 @@ libpaludisresolver_a_SOURCES = \
resolutions.cc \
resolvent.cc \
resolver.cc \
+ resolver_functions.cc \
resolver_lists.cc \
sanitised_dependencies.cc \
spec_rewriter.cc \
@@ -247,3 +251,9 @@ change_type-se.hh : change_type.se $(top_srcdir)/misc/make_se.bash
change_type-se.cc : change_type.se $(top_srcdir)/misc/make_se.bash
if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/change_type.se > $@ ; then rm -f $@ ; exit 1 ; fi
+resolver_functions-se.hh : resolver_functions.se $(top_srcdir)/misc/make_se.bash
+ if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/resolver_functions.se > $@ ; then rm -f $@ ; exit 1 ; fi
+
+resolver_functions-se.cc : resolver_functions.se $(top_srcdir)/misc/make_se.bash
+ if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/resolver_functions.se > $@ ; then rm -f $@ ; exit 1 ; fi
+
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 5074247..68351b7 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -621,7 +621,8 @@ Decider::_make_constraints_from_target(
const std::tr1::shared_ptr<ConstraintSequence>
Decider::_make_constraints_from_dependency(const Resolvent & resolvent, const SanitisedDependency & dep,
- const std::tr1::shared_ptr<const Reason> & reason) const
+ const std::tr1::shared_ptr<const Reason> & reason,
+ const SpecInterest interest) const
{
if (dep.spec().if_package())
{
@@ -631,8 +632,7 @@ Decider::_make_constraints_from_dependency(const Resolvent & resolvent, const Sa
value_for<n::nothing_is_fine_too>(false),
value_for<n::reason>(reason),
value_for<n::spec>(*dep.spec().if_package()),
- value_for<n::untaken>(! _imp->fns.take_dependency_fn()(
- resolvent, dep, reason)),
+ value_for<n::untaken>(si_untaken == interest),
value_for<n::use_existing>(_imp->fns.get_use_existing_fn()(
resolvent, *dep.spec().if_package(), reason))
))));
@@ -1004,8 +1004,18 @@ Decider::_add_dependencies_if_necessary(
{
Context context_2("When handling dependency '" + stringify(s->spec()) + "':");
- if (! _care_about_dependency_spec(our_resolvent, our_resolution, *s))
- continue;
+ SpecInterest interest(_interest_in_spec(our_resolvent, our_resolution, *s));
+
+ switch (interest)
+ {
+ case si_ignore:
+ continue;
+
+ case si_untaken:
+ case si_take:
+ case last_si:
+ break;
+ }
const std::tr1::shared_ptr<DependencyReason> reason(new DependencyReason(
package_id, our_resolvent, *s, _already_met(*s)));
@@ -1031,7 +1041,8 @@ Decider::_add_dependencies_if_necessary(
r != r_end ; ++r)
{
const std::tr1::shared_ptr<Resolution> dep_resolution(_resolution_for_resolvent(*r, true));
- const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_dependency(our_resolvent, *s, reason));
+ const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_dependency(
+ our_resolvent, *s, reason, interest));
for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
c != c_end ; ++c)
@@ -1040,11 +1051,11 @@ Decider::_add_dependencies_if_necessary(
}
}
-bool
-Decider::_care_about_dependency_spec(const Resolvent & resolvent,
+SpecInterest
+Decider::_interest_in_spec(const Resolvent & resolvent,
const std::tr1::shared_ptr<const Resolution> & resolution, const SanitisedDependency & dep) const
{
- return _imp->fns.care_about_dep_fn()(resolvent, resolution, dep);
+ return _imp->fns.interest_in_spec_fn()(resolvent, resolution, dep);
}
const std::tr1::shared_ptr<Constraints>
@@ -1214,7 +1225,8 @@ Decider::find_any_score(const Resolvent & our_resolvent, const SanitisedDependen
r != r_end ; ++r)
{
const std::tr1::shared_ptr<Resolution> resolution(_create_resolution_for_resolvent(*r));
- const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_dependency(our_resolvent, dep, reason));
+ const std::tr1::shared_ptr<ConstraintSequence> constraints(_make_constraints_from_dependency(
+ our_resolvent, dep, reason, si_take));
for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
c != c_end ; ++c)
resolution->constraints()->add(*c);
diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh
index 3a17b65..70dd2cc 100644
--- a/paludis/resolver/decider.hh
+++ b/paludis/resolver/decider.hh
@@ -79,7 +79,8 @@ namespace paludis
const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_from_dependency(
const Resolvent &, const SanitisedDependency &,
- const std::tr1::shared_ptr<const Reason> &) const;
+ const std::tr1::shared_ptr<const Reason> &,
+ const SpecInterest) const;
const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_from_blocker(
const Resolvent & resolvent, const BlockDepSpec & dep,
@@ -158,7 +159,9 @@ namespace paludis
void _add_dependencies_if_necessary(const Resolvent & our_resolvent,
const std::tr1::shared_ptr<Resolution> & our_resolution);
- bool _care_about_dependency_spec(const Resolvent &, const std::tr1::shared_ptr<const Resolution> &,
+ SpecInterest _interest_in_spec(
+ const Resolvent &,
+ const std::tr1::shared_ptr<const Resolution> &,
const SanitisedDependency &) const;
const std::tr1::shared_ptr<Constraints> _initial_constraints_for(const Resolvent &) const;
diff --git a/paludis/resolver/resolver_functions-fwd.hh b/paludis/resolver/resolver_functions-fwd.hh
index a33bb62..1019f9d 100644
--- a/paludis/resolver/resolver_functions-fwd.hh
+++ b/paludis/resolver/resolver_functions-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -20,11 +20,17 @@
#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_RESOLVER_FUNCTIONS_FWD_HH
#define PALUDIS_GUARD_PALUDIS_RESOLVER_RESOLVER_FUNCTIONS_FWD_HH 1
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
namespace paludis
{
namespace resolver
{
struct ResolverFunctions;
+
+#include <paludis/resolver/resolver_functions-se.hh>
+
}
}
diff --git a/paludis/resolver/resolver_functions.cc b/paludis/resolver/resolver_functions.cc
new file mode 100644
index 0000000..fc3e24c
--- /dev/null
+++ b/paludis/resolver/resolver_functions.cc
@@ -0,0 +1,29 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/resolver/resolver_functions.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <istream>
+#include <ostream>
+
+using namespace paludis;
+
+#include <paludis/resolver/resolver_functions-se.cc>
+
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index 8c6f525..a9442dc 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -34,6 +34,11 @@
#include <paludis/util/tribool-fwd.hh>
#include <paludis/filter-fwd.hh>
#include <paludis/name-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/repository-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/generator-fwd.hh>
+#include <paludis/filtered_generator-fwd.hh>
#include <tr1/functional>
namespace paludis
@@ -42,7 +47,6 @@ namespace paludis
{
struct allowed_to_break_fn;
struct allowed_to_remove_fn;
- struct care_about_dep_fn;
struct confirm_fn;
struct find_repository_for_fn;
struct get_constraints_for_dependent_fn;
@@ -50,10 +54,10 @@ namespace paludis
struct get_initial_constraints_for_fn;
struct get_resolvents_for_fn;
struct get_use_existing_fn;
+ struct interest_in_spec_fn;
struct make_destination_filtered_generator_fn;
struct prefer_or_avoid_fn;
struct remove_if_dependent_fn;
- struct take_dependency_fn;
}
namespace resolver
@@ -69,12 +73,6 @@ namespace paludis
typedef std::tr1::function<bool (
const Resolvent &,
const std::tr1::shared_ptr<const Resolution> &,
- const SanitisedDependency &
- )> CareAboutDepFunction;
-
- typedef std::tr1::function<bool (
- const Resolvent &,
- const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const RequiredConfirmation> &
)> ConfirmFunction;
@@ -113,6 +111,12 @@ namespace paludis
const std::tr1::shared_ptr<const Reason> &
)> GetUseExistingFunction;
+ typedef std::tr1::function<SpecInterest (
+ const Resolvent &,
+ const std::tr1::shared_ptr<const Resolution> &,
+ const SanitisedDependency &
+ )> InterestInSpecFunction;
+
typedef std::tr1::function<FilteredGenerator (
const Generator &,
const Resolvent &
@@ -126,17 +130,10 @@ namespace paludis
const std::tr1::shared_ptr<const PackageID> &
)> RemoveIfDependentFunction;
- typedef std::tr1::function<bool (
- const Resolvent &,
- const SanitisedDependency &,
- const std::tr1::shared_ptr<const Reason> &
- )> TakeDependencyFunction;
-
struct ResolverFunctions
{
NamedValue<n::allowed_to_break_fn, AllowedToBreakFunction> allowed_to_break_fn;
NamedValue<n::allowed_to_remove_fn, AllowedToRemoveFunction> allowed_to_remove_fn;
- NamedValue<n::care_about_dep_fn, CareAboutDepFunction> care_about_dep_fn;
NamedValue<n::confirm_fn, ConfirmFunction> confirm_fn;
NamedValue<n::find_repository_for_fn, FindRepositoryForFunction> find_repository_for_fn;
NamedValue<n::get_constraints_for_dependent_fn, GetConstraintsForDependentFunction> get_constraints_for_dependent_fn;
@@ -144,11 +141,11 @@ namespace paludis
NamedValue<n::get_initial_constraints_for_fn, GetInitialConstraintsFunction> get_initial_constraints_for_fn;
NamedValue<n::get_resolvents_for_fn, GetResolventsForFunction> get_resolvents_for_fn;
NamedValue<n::get_use_existing_fn, GetUseExistingFunction> get_use_existing_fn;
+ NamedValue<n::interest_in_spec_fn, InterestInSpecFunction> interest_in_spec_fn;
NamedValue<n::make_destination_filtered_generator_fn,
MakeDestinationFilteredGeneratorFunction> make_destination_filtered_generator_fn;
NamedValue<n::prefer_or_avoid_fn, PreferOrAvoidFunction> prefer_or_avoid_fn;
NamedValue<n::remove_if_dependent_fn, RemoveIfDependentFunction> remove_if_dependent_fn;
- NamedValue<n::take_dependency_fn, TakeDependencyFunction> take_dependency_fn;
};
}
}
diff --git a/paludis/resolver/resolver_functions.se b/paludis/resolver/resolver_functions.se
new file mode 100644
index 0000000..49643a2
--- /dev/null
+++ b/paludis/resolver/resolver_functions.se
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_SpecInterest()
+{
+ prefix si
+ namespace paludis::resolver
+
+ key si_ignore "Ignore the dep entirely"
+ key si_untaken "Treat the dep as untaken"
+ key si_take "Take the dep"
+
+ want_destringify
+}
+
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 010678d..c86b3f9 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -73,12 +73,6 @@ paludis::resolver::resolver_test::from_keys(const std::tr1::shared_ptr<const Map
return mm->second;
}
-bool
-paludis::resolver::resolver_test::care_about_dep_fn(const Resolvent &, const std::tr1::shared_ptr<const Resolution> &, const SanitisedDependency &)
-{
- return true;
-}
-
const std::tr1::shared_ptr<Constraints>
paludis::resolver::resolver_test::initial_constraints_for_fn(
const InitialConstraints & initial_constraints,
@@ -219,13 +213,14 @@ paludis::resolver::resolver_test::is_just_suggestion(const SanitisedDependency &
return v.seen_suggestion && ! v.seen_not_suggestion;
}
-bool
-paludis::resolver::resolver_test::take_dependency_fn(
- const Resolvent &,
- const SanitisedDependency & dep,
- const std::tr1::shared_ptr<const Reason> &)
+SpecInterest
+paludis::resolver::resolver_test::interest_in_spec_fn(
+ const Resolvent &, const std::tr1::shared_ptr<const Resolution> &, const SanitisedDependency & dep)
{
- return ! is_just_suggestion(dep);
+ if (is_just_suggestion(dep))
+ return si_untaken;
+ else
+ return si_take;
}
UseExisting
@@ -382,7 +377,6 @@ ResolverTestCase::get_resolver_functions(InitialConstraints & initial_constraint
allowed_to_break_names, std::tr1::placeholders::_1)),
value_for<n::allowed_to_remove_fn>(std::tr1::bind(&allowed_to_remove_fn,
allowed_to_remove_names, std::tr1::placeholders::_1)),
- value_for<n::care_about_dep_fn>(&care_about_dep_fn),
value_for<n::confirm_fn>(&confirm_fn),
value_for<n::find_repository_for_fn>(std::tr1::bind(&find_repository_for_fn,
&env, std::tr1::placeholders::_1, std::tr1::placeholders::_2,
@@ -394,12 +388,12 @@ ResolverTestCase::get_resolver_functions(InitialConstraints & initial_constraint
std::tr1::placeholders::_1)),
value_for<n::get_resolvents_for_fn>(&get_resolvents_for_fn),
value_for<n::get_use_existing_fn>(&get_use_existing_fn),
+ value_for<n::interest_in_spec_fn>(&interest_in_spec_fn),
value_for<n::make_destination_filtered_generator_fn>(&make_destination_filtered_generator_fn),
value_for<n::prefer_or_avoid_fn>(std::tr1::bind(&prefer_or_avoid_fn,
prefer_or_avoid_names, std::tr1::placeholders::_1)),
value_for<n::remove_if_dependent_fn>(std::tr1::bind(&remove_if_dependent_fn,
- remove_if_dependent_names, std::tr1::placeholders::_1)),
- value_for<n::take_dependency_fn>(&take_dependency_fn)
+ remove_if_dependent_names, std::tr1::placeholders::_1))
);
}
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 65acbc3..61ec179 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -57,7 +57,10 @@ namespace paludis
typedef std::map<Resolvent, std::tr1::shared_ptr<Constraints> > InitialConstraints;
- bool care_about_dep_fn(const Resolvent &, const std::tr1::shared_ptr<const Resolution> &, const SanitisedDependency &);
+ SpecInterest interest_in_spec_fn(
+ const Resolvent &,
+ const std::tr1::shared_ptr<const Resolution> &,
+ const SanitisedDependency &);
const std::tr1::shared_ptr<Constraints> initial_constraints_for_fn(
const InitialConstraints & initial_constraints,
@@ -76,11 +79,6 @@ namespace paludis
bool is_just_suggestion(const SanitisedDependency & dep);
- bool take_dependency_fn(
- const Resolvent &,
- const SanitisedDependency & dep,
- const std::tr1::shared_ptr<const Reason> &);
-
UseExisting get_use_existing_fn(
const Resolvent &,
const PackageDepSpec &,
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index ba2193e..76eeef8 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -897,88 +897,90 @@ namespace
}
};
- bool care_about_dep_fn(const Environment * const env, const ResolveCommandLineResolutionOptions & resolution_options,
- const Resolvent &, const std::tr1::shared_ptr<const Resolution> & resolution,
+ SpecInterest interest_in_spec_fn(
+ const Environment * const env,
+ const ResolveCommandLineResolutionOptions & resolution_options,
+ const Resolvent & resolvent,
+ const std::tr1::shared_ptr<const Resolution> & resolution,
const SanitisedDependency & dep)
{
CareAboutDepFnVisitor v(env, resolution_options, dep);
- return resolution->decision()->accept_returning<bool>(v);
- }
+ if (resolution->decision()->accept_returning<bool>(v))
+ {
+ bool suggestion(is_suggestion(dep)), recommendation(is_recommendation(dep));
- bool
- take_dependency_fn(const Environment * const env,
- const ResolveCommandLineResolutionOptions & resolution_options,
- const Resolvent & resolvent,
- const SanitisedDependency & dep,
- const std::tr1::shared_ptr<const Reason> &)
- {
- bool suggestion(is_suggestion(dep)), recommendation(is_recommendation(dep));
+ if (! (suggestion || recommendation))
+ return si_take;
- if (! (suggestion || recommendation))
- return true;
+ for (args::StringSetArg::ConstIterator a(resolution_options.a_take.begin_args()),
+ a_end(resolution_options.a_take.end_args()) ;
+ a != a_end ; ++a)
+ {
+ PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
+ PackageDepSpec spec(*dep.spec().if_package());
+ if (match_qpns(*env, user_spec, *spec.package_ptr()))
+ return si_take;
+ }
- for (args::StringSetArg::ConstIterator a(resolution_options.a_take.begin_args()),
- a_end(resolution_options.a_take.end_args()) ;
- a != a_end ; ++a)
- {
- PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
- PackageDepSpec spec(*dep.spec().if_package());
- if (match_qpns(*env, user_spec, *spec.package_ptr()))
- return true;
- }
+ for (args::StringSetArg::ConstIterator a(resolution_options.a_take_from.begin_args()),
+ a_end(resolution_options.a_take_from.end_args()) ;
+ a != a_end ; ++a)
+ {
+ PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
+ if (match_qpns(*env, user_spec, resolvent.package()))
+ return si_take;
+ }
- for (args::StringSetArg::ConstIterator a(resolution_options.a_take_from.begin_args()),
- a_end(resolution_options.a_take_from.end_args()) ;
- a != a_end ; ++a)
- {
- PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
- if (match_qpns(*env, user_spec, resolvent.package()))
- return true;
- }
+ for (args::StringSetArg::ConstIterator a(resolution_options.a_ignore.begin_args()),
+ a_end(resolution_options.a_ignore.end_args()) ;
+ a != a_end ; ++a)
+ {
+ PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
+ PackageDepSpec spec(*dep.spec().if_package());
+ if (match_qpns(*env, user_spec, *spec.package_ptr()))
+ return si_ignore;
+ }
- for (args::StringSetArg::ConstIterator a(resolution_options.a_ignore.begin_args()),
- a_end(resolution_options.a_ignore.end_args()) ;
- a != a_end ; ++a)
- {
- PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
- PackageDepSpec spec(*dep.spec().if_package());
- if (match_qpns(*env, user_spec, *spec.package_ptr()))
- return false;
- }
+ for (args::StringSetArg::ConstIterator a(resolution_options.a_ignore_from.begin_args()),
+ a_end(resolution_options.a_ignore_from.end_args()) ;
+ a != a_end ; ++a)
+ {
+ PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
+ if (match_qpns(*env, user_spec, resolvent.package()))
+ return si_ignore;
+ }
- for (args::StringSetArg::ConstIterator a(resolution_options.a_ignore_from.begin_args()),
- a_end(resolution_options.a_ignore_from.end_args()) ;
- a != a_end ; ++a)
- {
- PackageDepSpec user_spec(parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards));
- if (match_qpns(*env, user_spec, resolvent.package()))
- return false;
- }
+ if (suggestion)
+ {
+ if (resolution_options.a_suggestions.argument() == "take")
+ return si_take;
+ else if (resolution_options.a_suggestions.argument() == "ignore")
+ return si_ignore;
+ }
- if (suggestion)
- {
- if (resolution_options.a_suggestions.argument() == "take")
- return true;
- }
+ if (recommendation)
+ {
+ if (resolution_options.a_recommendations.argument() == "take")
+ return si_take;
+ else if (resolution_options.a_recommendations.argument() == "ignore")
+ return si_ignore;
+ }
- if (recommendation)
- {
- if (resolution_options.a_recommendations.argument() == "take")
- return true;
- }
+ /* we also take suggestions and recommendations that have already been installed */
+ if (dep.spec().if_package())
+ {
+ const std::tr1::shared_ptr<const PackageIDSequence> installed_ids(
+ (*env)[selection::SomeArbitraryVersion(
+ generator::Matches(*dep.spec().if_package(), MatchPackageOptions()) |
+ filter::InstalledAtRoot(FSEntry("/")))]);
+ if (! installed_ids->empty())
+ return si_take;
+ }
- /* we also take suggestions and recommendations that have already been installed */
- if (dep.spec().if_package())
- {
- const std::tr1::shared_ptr<const PackageIDSequence> installed_ids(
- (*env)[selection::SomeArbitraryVersion(
- generator::Matches(*dep.spec().if_package(), MatchPackageOptions()) |
- filter::InstalledAtRoot(FSEntry("/")))]);
- if (! installed_ids->empty())
- return true;
+ return si_untaken;
}
-
- return false;
+ else
+ return si_ignore;
}
const std::tr1::shared_ptr<const Repository>
@@ -1578,9 +1580,6 @@ paludis::cave::resolve_common(
env.get(),
std::tr1::cref(allowed_to_remove_specs),
std::tr1::placeholders::_1)),
- value_for<n::care_about_dep_fn>(std::tr1::bind(&care_about_dep_fn,
- env.get(), std::tr1::cref(resolution_options), std::tr1::placeholders::_1,
- std::tr1::placeholders::_2, std::tr1::placeholders::_3)),
value_for<n::confirm_fn>(std::tr1::bind(&confirm_fn,
env.get(), std::tr1::cref(resolution_options), std::tr1::placeholders::_1,
std::tr1::placeholders::_2, std::tr1::placeholders::_3)),
@@ -1601,6 +1600,9 @@ paludis::cave::resolve_common(
value_for<n::get_use_existing_fn>(std::tr1::bind(&use_existing_fn,
env.get(), std::tr1::cref(resolution_options), std::tr1::placeholders::_1, std::tr1::placeholders::_2,
std::tr1::placeholders::_3)),
+ value_for<n::interest_in_spec_fn>(std::tr1::bind(&interest_in_spec_fn,
+ env.get(), std::tr1::cref(resolution_options), 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,
env.get(), std::tr1::cref(resolution_options), std::tr1::placeholders::_1, std::tr1::placeholders::_2)),
value_for<n::prefer_or_avoid_fn>(std::tr1::bind(&prefer_or_avoid_fn,
@@ -1609,10 +1611,7 @@ paludis::cave::resolve_common(
value_for<n::remove_if_dependent_fn>(std::tr1::bind(&remove_if_dependent_fn,
env.get(),
std::tr1::cref(remove_if_dependent_specs),
- std::tr1::placeholders::_1)),
- value_for<n::take_dependency_fn>(std::tr1::bind(&take_dependency_fn, env.get(),
- std::tr1::cref(resolution_options), std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3))
-
+ std::tr1::placeholders::_1))
));
ScopedSelectionCache selection_cache(env.get());