aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-09 14:40:23 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-09 14:40:23 +0000
commitbfba94957941bf45dda994473681fdb4c9e6bc57 (patch)
tree9153a482d6d733094baa4bbb0339c2a7a7e09b57
parent97176d89a2adf76e804f1b3090935b3c91ed262d (diff)
downloadpaludis-bfba94957941bf45dda994473681fdb4c9e6bc57.tar.gz
paludis-bfba94957941bf45dda994473681fdb4c9e6bc57.tar.xz
--no-{dependencies,blockers}-from
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc8
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh4
-rw-r--r--src/clients/cave/resolve_common.cc39
3 files changed, 45 insertions, 6 deletions
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index 41bc623..5d2e36c 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -143,6 +143,14 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
a_no_follow_installed_dependencies(&g_dependency_options, "no-follow-installed-dependencies", 'n',
"Ignore dependencies (except compiled-against dependencies, which are always taken) "
"for installed packages. (default if --lazy)", true),
+ a_no_dependencies_from(&g_dependency_options, "no-dependencies-from", '0',
+ "Ignore dependencies (not blockers) from packages matching the supplied specification. May be "
+ "specified multiple times. Use '*/*' to ignore all dependencies. Use of this option can lead to "
+ "horrible breakages."),
+ a_no_blockers_from(&g_dependency_options, "no-blockers-from", '!',
+ "Ignore blockers from packages matching the supplied specification. May be specified "
+ "multiple times. Use '*/*' to ignore all blockers. Use of this option can lead to "
+ "horrible breakages."),
g_suggestion_options(this, "Suggestion Options", "Control whether suggestions are taken. Suggestions that are "
"already installed are instead treated as hard dependencies."),
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index 4b9d88e..5bcbd76 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -61,7 +61,9 @@ namespace paludis
args::ArgsGroup g_dependency_options;
args::SwitchArg a_follow_installed_build_dependencies;
args::SwitchArg a_no_follow_installed_dependencies;
-//
+ args::StringSetArg a_no_dependencies_from;
+ args::StringSetArg a_no_blockers_from;
+
args::ArgsGroup g_suggestion_options;
args::EnumArg a_suggestions;
args::EnumArg a_recommendations;
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index e2a1692..6e65cc2 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -739,19 +739,45 @@ namespace
return result;
}
+ bool ignore_dep_from(
+ const Environment * const env,
+ const ResolveCommandLineResolutionOptions & resolution_options,
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const bool is_block)
+ {
+ const args::StringSetArg & s(is_block ?
+ resolution_options.a_no_blockers_from :
+ resolution_options.a_no_dependencies_from);
+
+ for (args::StringSetArg::ConstIterator a(s.begin_args()), a_end(s.end_args()) ;
+ a != a_end ; ++a)
+ if (match_package(*env, parse_user_package_dep_spec(*a, env, UserPackageDepSpecOptions() + updso_allow_wildcards),
+ *id, MatchPackageOptions()))
+ return true;
+
+ return false;
+ }
+
struct CareAboutDepFnVisitor
{
+ const Environment * const env;
const ResolveCommandLineResolutionOptions & resolution_options;
const SanitisedDependency dep;
- CareAboutDepFnVisitor(const ResolveCommandLineResolutionOptions & c, const SanitisedDependency & d) :
+ CareAboutDepFnVisitor(const Environment * const e,
+ const ResolveCommandLineResolutionOptions & c,
+ const SanitisedDependency & d) :
+ env(e),
resolution_options(c),
dep(d)
{
}
- bool visit(const ExistingNoChangeDecision &) const
+ bool visit(const ExistingNoChangeDecision & decision) const
{
+ if (ignore_dep_from(env, resolution_options, decision.existing_id(), dep.spec().if_block()))
+ return false;
+
if (! is_enabled_dep(dep))
return false;
@@ -786,8 +812,11 @@ namespace
throw InternalError(PALUDIS_HERE, "RemoveDecision shouldn't have deps");
}
- bool visit(const ChangesToMakeDecision &) const
+ bool visit(const ChangesToMakeDecision & decision) const
{
+ if (ignore_dep_from(env, resolution_options, decision.origin_id(), dep.spec().if_block()))
+ return false;
+
if (is_enabled_dep(dep))
return true;
@@ -795,11 +824,11 @@ namespace
}
};
- bool care_about_dep_fn(const Environment * const, const ResolveCommandLineResolutionOptions & resolution_options,
+ bool care_about_dep_fn(const Environment * const env, const ResolveCommandLineResolutionOptions & resolution_options,
const Resolvent &, const std::tr1::shared_ptr<const Resolution> & resolution,
const SanitisedDependency & dep)
{
- CareAboutDepFnVisitor v(resolution_options, dep);
+ CareAboutDepFnVisitor v(env, resolution_options, dep);
return resolution->decision()->accept_returning<bool>(v);
}