diff options
author | 2012-07-27 20:02:26 +0100 | |
---|---|---|
committer | 2012-07-27 21:28:11 +0100 | |
commit | 426a01ee4256e2c8fc9135a43a156846a6d593cc (patch) | |
tree | 6891265629214a4822008c12151252682bf799c0 /src | |
parent | ccbd7c2b7cfb276c26dc3b0174f0ffaedee25529 (diff) | |
download | paludis-426a01ee4256e2c8fc9135a43a156846a6d593cc.tar.gz paludis-426a01ee4256e2c8fc9135a43a156846a6d593cc.tar.xz |
cave resolve --prefer-matching / --avoid-matching
Diffstat (limited to 'src')
-rw-r--r-- | src/clients/cave/resolve_cmdline.cc | 4 | ||||
-rw-r--r-- | src/clients/cave/resolve_cmdline.hh | 2 | ||||
-rw-r--r-- | src/clients/cave/resolve_common.cc | 12 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/clients/cave/resolve_cmdline.cc b/src/clients/cave/resolve_cmdline.cc index 3e5c939f8..5ad7fb37f 100644 --- a/src/clients/cave/resolve_cmdline.cc +++ b/src/clients/cave/resolve_cmdline.cc @@ -231,8 +231,12 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A g_package_options(this, "Package Selection Options", "Control which packages are selected."), a_favour(&g_package_options, "favour", 'F', "If there is a choice (e.g. || ( ) dependencies), favour the " "specified package names"), + a_favour_matching(&g_package_options, "favour-matching", '\0', "If there is a choice (e.g. || ( ) dependencies), favour specs " + "which match all of the packages matching the supplied spec"), a_avoid(&g_package_options, "avoid", 'A', "If there is a choice (e.g. || ( ) dependencies), avoid the " "specified package names"), + a_avoid_matching(&g_package_options, "avoid-matching", '\0', "If there is a choice (e.g. || ( ) dependencies), avoid specs " + "which match any of the packages matching the supplied spec"), a_preset(&g_package_options, "preset", 'p', "Preset a given constraint. For example, --preset =cat/pkg-2.1 will tell " "the resolver to use that particular version. Note that this may lead to errors, if the specified version " "does not satisfy other constraints. Also note that specifying a preset will not force a package to be " diff --git a/src/clients/cave/resolve_cmdline.hh b/src/clients/cave/resolve_cmdline.hh index 8bdd0b4f2..ed787650c 100644 --- a/src/clients/cave/resolve_cmdline.hh +++ b/src/clients/cave/resolve_cmdline.hh @@ -85,7 +85,9 @@ namespace paludis args::ArgsGroup g_package_options; args::StringSetArg a_favour; + args::StringSetArg a_favour_matching; args::StringSetArg a_avoid; + args::StringSetArg a_avoid_matching; args::StringSetArg a_preset; args::StringSetArg a_hide; diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc index 3ddbddb33..00e4c1ce1 100644 --- a/src/clients/cave/resolve_common.cc +++ b/src/clients/cave/resolve_common.cc @@ -964,10 +964,16 @@ paludis::cave::resolve_common( i_end(resolution_options.a_favour.end_args()) ; i != i_end ; ++i) prefer_or_avoid_helper.add_prefer_name(disambiguate_if_necessary(env.get(), *i)); - for (args::StringSetArg::ConstIterator i(resolution_options.a_avoid.begin_args()), - i_end(resolution_options.a_avoid.end_args()) ; + for (args::StringSetArg::ConstIterator i(resolution_options.a_favour_matching.begin_args()), + i_end(resolution_options.a_favour_matching.end_args()) ; i != i_end ; ++i) - prefer_or_avoid_helper.add_avoid_name(disambiguate_if_necessary(env.get(), *i)); + prefer_or_avoid_helper.add_prefer_matching((*env)[selection::AllVersionsUnsorted(generator::Matches( + parse_spec_with_nice_error(*i, env.get(), { }, filter::All()), make_null_shared_ptr(), { }))]); + for (args::StringSetArg::ConstIterator i(resolution_options.a_avoid_matching.begin_args()), + i_end(resolution_options.a_avoid_matching.end_args()) ; + i != i_end ; ++i) + prefer_or_avoid_helper.add_avoid_matching((*env)[selection::AllVersionsUnsorted(generator::Matches( + parse_spec_with_nice_error(*i, env.get(), { }, filter::All()), make_null_shared_ptr(), { }))]); RemoveIfDependentHelper remove_if_dependent_helper(env.get()); for (args::StringSetArg::ConstIterator i(resolution_options.a_remove_if_dependent.begin_args()), |