aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-02 18:23:46 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-02 18:23:46 +0100
commit1d3c79763c219d5286727caeda43e04bfd364f19 (patch)
treec20e81d4d7e4d067997febfd5bb9fee44026425e
parentb725eec6e014e202ee1c8fbda9328be1b358c6bb (diff)
downloadpaludis-1d3c79763c219d5286727caeda43e04bfd364f19.tar.gz
paludis-1d3c79763c219d5286727caeda43e04bfd364f19.tar.xz
resolve --prefer/--avoid can take a non-q PN
Fixes: ticket:989
-rw-r--r--src/clients/cave/resolve_common.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 8cf9f53..4dd3f5d 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -96,6 +96,7 @@
#include <paludis/package_id.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/package_database.hh>
#include <algorithm>
#include <iostream>
@@ -638,6 +639,15 @@ namespace
return result;
}
+
+ QualifiedPackageName disambiguate_if_necessary(const Environment * const env,
+ const std::string & s)
+ {
+ if (std::string::npos != s.find('/'))
+ return QualifiedPackageName(s);
+ else
+ return env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(s));
+ }
}
int
@@ -829,11 +839,11 @@ paludis::cave::resolve_common(
for (args::StringSetArg::ConstIterator i(resolution_options.a_favour.begin_args()),
i_end(resolution_options.a_favour.end_args()) ;
i != i_end ; ++i)
- prefer_or_avoid_helper.add_prefer_name(QualifiedPackageName(*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()) ;
i != i_end ; ++i)
- prefer_or_avoid_helper.add_avoid_name(QualifiedPackageName(*i));
+ prefer_or_avoid_helper.add_avoid_name(disambiguate_if_necessary(env.get(), *i));
RemoveIfDependentHelper remove_if_dependent_helper(env.get());
for (args::StringSetArg::ConstIterator i(resolution_options.a_remove_if_dependent.begin_args()),