aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-14 20:01:45 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-15 10:42:03 +0100
commit1f5408648013aa4ea8cb70864888274b068402e3 (patch)
tree3a764a93fcb57a1461f20477e18fef85b3be2c76
parent706d8f3b19ec8ceca9ca19b0a9b3837346d539f0 (diff)
downloadpaludis-1f5408648013aa4ea8cb70864888274b068402e3.tar.gz
paludis-1f5408648013aa4ea8cb70864888274b068402e3.tar.xz
Make use of new parse_user_package_dep_spec features (continued)
-rw-r--r--paludis/install_task.cc94
-rw-r--r--paludis/uninstall_task.cc63
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc10
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc7
-rw-r--r--src/clients/contrarius/stage.cc40
-rw-r--r--src/clients/paludis/applets.cc12
-rw-r--r--src/clients/paludis/do_config.cc9
-rw-r--r--src/clients/paludis/do_contents.cc8
-rw-r--r--src/clients/paludis/do_executables.cc8
-rw-r--r--src/clients/paludis/info.cc8
-rw-r--r--src/clients/paludis/query.cc29
11 files changed, 98 insertions, 190 deletions
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index f1e6f14..88b6a19 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -174,12 +174,13 @@ namespace
case 'U':
return make_shared_ptr(new DepListEntryHandledSkippedUnsatisfied(
- parse_user_package_dep_spec(s.substr(1), UserPackageDepSpecOptions())));
+ parse_user_package_dep_spec(s.substr(1), env, UserPackageDepSpecOptions())));
case 'D':
return make_shared_ptr(new DepListEntryHandledSkippedDependent(
*(*env)[selection::RequireExactlyOne(generator::Matches(
- parse_user_package_dep_spec(s.substr(1), UserPackageDepSpecOptions())))]->begin()));
+ parse_user_package_dep_spec(s.substr(1), env,
+ UserPackageDepSpecOptions())))]->begin()));
case 'F':
if (s.length() != 1)
@@ -203,7 +204,8 @@ namespace
}
void
-InstallTask::set_targets_from_serialisation(const std::string & format, const std::tr1::shared_ptr<const Sequence<std::string> > & ss)
+InstallTask::set_targets_from_serialisation(const std::string & format,
+ const std::tr1::shared_ptr<const Sequence<std::string> > & ss)
{
if (format != "0.25")
throw InternalError(PALUDIS_HERE, "Serialisation format '" + format + "' not supported by this version of Paludis");
@@ -224,7 +226,8 @@ InstallTask::set_targets_from_serialisation(const std::string & format, const st
if (tokens.empty())
throw InternalError(PALUDIS_HERE, "Serialised value '" + *s + "' too short: no package_id");
const std::tr1::shared_ptr<const PackageID> package_id(*(*_imp->env)[selection::RequireExactlyOne(
- generator::Matches(parse_user_package_dep_spec(*tokens.begin(), UserPackageDepSpecOptions())))]->begin());
+ generator::Matches(parse_user_package_dep_spec(*tokens.begin(),
+ _imp->env, UserPackageDepSpecOptions())))]->begin());
tokens.pop_front();
if (tokens.empty())
@@ -378,78 +381,38 @@ InstallTask::_add_target(const std::string & target)
Context context("When adding install target '" + target + "':");
std::tr1::shared_ptr<SetSpecTree::ConstItem> s;
- std::string modified_target(target);
- bool done(false);
try
{
- if ((target != "insecurity") && ((s = ((_imp->env->set(SetName(target)))))))
- {
- if (_imp->had_set_targets)
- {
- _imp->had_resolution_failures = true;
- throw MultipleSetTargetsSpecified();
- }
-
- if (_imp->had_package_targets)
- {
- _imp->had_resolution_failures = true;
- throw HadBothPackageAndSetTargets();
- }
-
- _imp->had_set_targets = true;
- if (! _imp->override_target_type)
- _imp->dep_list.options()->target_type = dl_target_set;
- _imp->targets->add(s);
- done = true;
- }
- }
- catch (const SetNameError &)
- {
- }
-
- if (! done)
- {
- Log::get_instance()->message("install_task.target_is_package", ll_debug, lc_context) << "target '" << target << "' is a package";
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(parse_user_package_dep_spec(target,
+ _imp->env, UserPackageDepSpecOptions() + updso_allow_wildcards + updso_throw_if_set)));
if (_imp->had_set_targets)
- {
- _imp->had_resolution_failures = true;
throw HadBothPackageAndSetTargets();
- }
-
_imp->had_package_targets = true;
if (! _imp->override_target_type)
_imp->dep_list.options()->target_type = dl_target_package;
- if (std::string::npos != target.find('/'))
- {
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(parse_user_package_dep_spec(target, UserPackageDepSpecOptions())));
- spec->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
- _imp->targets->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
- new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
- }
- else
- {
- try
- {
- QualifiedPackageName q(_imp->env->package_database()->fetch_unique_qualified_package_name(
- PackageNamePart(target), filter::SupportsAction<InstallAction>()));
- modified_target = stringify(q);
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(make_package_dep_spec().package(q)));
- spec->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
- _imp->targets->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
- new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
- }
- catch (const NoSuchPackageError &)
- {
- _imp->had_resolution_failures = true;
- throw;
- }
- }
+ spec->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
+ _imp->targets->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
+ new TreeLeaf<SetSpecTree, PackageDepSpec>(spec)));
+ _imp->raw_targets.push_back(stringify(*spec));
}
+ catch (const GotASetNotAPackageDepSpec &)
+ {
+ if (_imp->had_set_targets)
+ throw MultipleSetTargetsSpecified();
+ if (_imp->had_package_targets)
+ throw HadBothPackageAndSetTargets();
+ _imp->had_set_targets = true;
- _imp->raw_targets.push_back(modified_target);
+ _imp->targets->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, NamedSetDepSpec> >(
+ new TreeLeaf<SetSpecTree, NamedSetDepSpec>(std::tr1::shared_ptr<NamedSetDepSpec>(
+ new NamedSetDepSpec(SetName(target))))));
+ _imp->had_set_targets = true;
+ if (! _imp->override_target_type)
+ _imp->dep_list.options()->target_type = dl_target_set;
+ }
}
void
@@ -974,7 +937,8 @@ InstallTask::_main_actions()
if (s_had_package_targets)
all->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, PackageDepSpec> >(
new TreeLeaf<SetSpecTree, PackageDepSpec>(std::tr1::shared_ptr<PackageDepSpec>(
- new PackageDepSpec(parse_user_package_dep_spec(*t, UserPackageDepSpecOptions()))))));
+ new PackageDepSpec(parse_user_package_dep_spec(*t, _imp->env,
+ UserPackageDepSpecOptions()))))));
else
all->add(std::tr1::shared_ptr<TreeLeaf<SetSpecTree, NamedSetDepSpec> >(
new TreeLeaf<SetSpecTree, NamedSetDepSpec>(std::tr1::shared_ptr<NamedSetDepSpec>(
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index 4323ef5..f7226d8 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -158,60 +158,31 @@ UninstallTask::add_target(const std::string & target)
{
Context context("When adding uninstall target '" + target + "':");
- /* we might have a dep spec, but we might just have a simple package name
- * without a category. either should work. */
- if (std::string::npos != target.find('/'))
+ try
{
+ std::tr1::shared_ptr<PackageDepSpec> pds(new PackageDepSpec(parse_user_package_dep_spec(
+ target, _imp->env, UserPackageDepSpecOptions() + updso_throw_if_set)));
+
if (_imp->had_set_targets)
throw HadBothPackageAndSetTargets();
-
_imp->had_package_targets = true;
- std::tr1::shared_ptr<PackageDepSpec> pds(new PackageDepSpec(parse_user_package_dep_spec(target, UserPackageDepSpecOptions())));
+
pds->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
_imp->targets.push_back(pds);
}
- else
- try
- {
- std::tr1::shared_ptr<SetSpecTree::ConstItem> spec(_imp->env->set(SetName(target)));
- if (spec)
- {
- if (_imp->had_package_targets)
- throw HadBothPackageAndSetTargets();
-
- if (_imp->had_set_targets)
- throw MultipleSetTargetsSpecified();
+ catch (const GotASetNotAPackageDepSpec &)
+ {
+ if (_imp->had_set_targets)
+ throw MultipleSetTargetsSpecified();
+ if (_imp->had_package_targets)
+ throw HadBothPackageAndSetTargets();
+ _imp->had_set_targets = true;
- _imp->had_set_targets = true;
- DepSpecFlattener<SetSpecTree, PackageDepSpec> f(_imp->env);
- spec->accept(f);
- std::copy(f.begin(), f.end(), std::back_inserter(_imp->targets));
- }
- else
- {
- if (_imp->had_set_targets)
- throw HadBothPackageAndSetTargets();
-
- _imp->had_package_targets = false;
- std::tr1::shared_ptr<PackageDepSpec> pds(new PackageDepSpec(make_package_dep_spec()
- .package(_imp->env->package_database()->fetch_unique_qualified_package_name(
- PackageNamePart(target), filter::SupportsAction<UninstallAction>()))));
- pds->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
- _imp->targets.push_back(pds);
- }
- }
- catch (const SetNameError &)
- {
- if (_imp->had_set_targets)
- throw HadBothPackageAndSetTargets();
-
- _imp->had_package_targets = false;
- std::tr1::shared_ptr<PackageDepSpec> pds(new PackageDepSpec(make_package_dep_spec()
- .package(_imp->env->package_database()->fetch_unique_qualified_package_name(
- PackageNamePart(target), filter::SupportsAction<UninstallAction>()))));
- pds->set_tag(std::tr1::shared_ptr<const DepTag>(new TargetDepTag));
- _imp->targets.push_back(pds);
- }
+ std::tr1::shared_ptr<SetSpecTree::ConstItem> spec(_imp->env->set(SetName(target)));
+ DepSpecFlattener<SetSpecTree, PackageDepSpec> f(_imp->env);
+ spec->accept(f);
+ std::copy(f.begin(), f.end(), std::back_inserter(_imp->targets));
+ }
_imp->raw_targets.push_back(target);
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index 86befb1..b89e763 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -266,14 +266,8 @@ int do_find_reverse_deps(NoConfigEnvironment & env)
std::tr1::shared_ptr<PackageDepSpec> spec;
try
{
- if (std::string::npos == CommandLine::get_instance()->begin_parameters()->find('/'))
- {
- spec.reset(new PackageDepSpec(make_package_dep_spec().package(env.package_database()->fetch_unique_qualified_package_name(
- PackageNamePart(*CommandLine::get_instance()->begin_parameters())))));
- }
- else
- spec.reset(new PackageDepSpec(parse_user_package_dep_spec(*CommandLine::get_instance()->begin_parameters(),
- UserPackageDepSpecOptions())));
+ spec.reset(new PackageDepSpec(parse_user_package_dep_spec(*CommandLine::get_instance()->begin_parameters(),
+ &env, UserPackageDepSpecOptions())));
}
catch (const AmbiguousPackageNameError & e)
{
diff --git a/src/clients/adjutrix/what_needs_keywording.cc b/src/clients/adjutrix/what_needs_keywording.cc
index 6467c5e..2a982ed 100644
--- a/src/clients/adjutrix/what_needs_keywording.cc
+++ b/src/clients/adjutrix/what_needs_keywording.cc
@@ -87,12 +87,7 @@ int do_what_needs_keywording(NoConfigEnvironment & env)
{
try
{
- if (std::string::npos == p->find('/'))
- d.add(make_package_dep_spec().package(env.package_database()->fetch_unique_qualified_package_name(
- PackageNamePart(*CommandLine::get_instance()->begin_parameters()))),
- env.default_destinations());
- else
- d.add(parse_user_package_dep_spec(*p, UserPackageDepSpecOptions()), env.default_destinations());
+ d.add(parse_user_package_dep_spec(*p, &env, UserPackageDepSpecOptions()), env.default_destinations());
}
catch (const NoSuchPackageError & e)
{
diff --git a/src/clients/contrarius/stage.cc b/src/clients/contrarius/stage.cc
index 86ade0a..6cc01b4 100644
--- a/src/clients/contrarius/stage.cc
+++ b/src/clients/contrarius/stage.cc
@@ -55,7 +55,7 @@ AuxiliaryStage::is_rebuild() const
for (std::list<std::string>::const_iterator p(packages.begin()), p_end(packages.end()) ;
p != p_end ; ++p)
if ((*_env)[selection::SomeArbitraryVersion(
- generator::Matches(parse_user_package_dep_spec(*p, UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(*p, _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]->empty())
return false;
@@ -68,7 +68,8 @@ BinutilsStage::build(const StageOptions &) const
Context context("When building BinutilsStage:");
std::tr1::shared_ptr<PackageDepSpec> binutils(new PackageDepSpec(
- parse_user_package_dep_spec(TargetConfig::get_instance()->binutils(), UserPackageDepSpecOptions())));
+ parse_user_package_dep_spec(TargetConfig::get_instance()->binutils(), _env.get(),
+ UserPackageDepSpecOptions())));
_env->clear_adaptions();
@@ -79,7 +80,8 @@ bool
BinutilsStage::is_rebuild() const
{
return (! (*_env)[selection::SomeArbitraryVersion(
- generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->binutils(), UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(
+ TargetConfig::get_instance()->binutils(), _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]->empty());
}
@@ -89,7 +91,8 @@ KernelHeadersStage::build(const StageOptions &) const
Context context("When building KernelHeadersStage:");
std::tr1::shared_ptr<PackageDepSpec> headers(new PackageDepSpec(
- parse_user_package_dep_spec(TargetConfig::get_instance()->headers(), UserPackageDepSpecOptions())));
+ parse_user_package_dep_spec(TargetConfig::get_instance()->headers(),
+ _env.get(), UserPackageDepSpecOptions())));
_env->clear_adaptions();
@@ -102,7 +105,8 @@ bool
KernelHeadersStage::is_rebuild() const
{
return (! (*_env)[selection::SomeArbitraryVersion(
- generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->headers(), UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->headers(),
+ _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]->empty());
}
@@ -111,8 +115,9 @@ MinimalStage::build(const StageOptions &) const
{
Context context("When executing MinimalStage:");
- std::tr1::shared_ptr<PackageDepSpec> gcc(new PackageDepSpec(parse_user_package_dep_spec(TargetConfig::get_instance()->gcc(),
- UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> gcc(new PackageDepSpec(parse_user_package_dep_spec(
+ TargetConfig::get_instance()->gcc(),
+ _env.get(), UserPackageDepSpecOptions())));
_env->clear_adaptions();
@@ -133,7 +138,8 @@ bool
MinimalStage::is_rebuild() const
{
return (! (*_env)[selection::SomeArbitraryVersion(
- generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->gcc(), UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(
+ TargetConfig::get_instance()->gcc(), _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]->empty());
}
@@ -142,7 +148,8 @@ LibCHeadersStage::build(const StageOptions &) const
{
Context context("When building LIbCHeaderStage:");
- std::tr1::shared_ptr<PackageDepSpec> libc(new PackageDepSpec(parse_user_package_dep_spec(TargetConfig::get_instance()->libc(),
+ std::tr1::shared_ptr<PackageDepSpec> libc(new PackageDepSpec(
+ parse_user_package_dep_spec(TargetConfig::get_instance()->libc(), _env.get(),
UserPackageDepSpecOptions())));
_env->clear_adaptions();
@@ -156,7 +163,8 @@ bool
LibCHeadersStage::is_rebuild() const
{
return (! (*_env)[selection::SomeArbitraryVersion(
- generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->libc(), UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(
+ TargetConfig::get_instance()->libc(), _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]->empty());
}
@@ -165,7 +173,8 @@ LibCStage::build(const StageOptions &) const
{
Context context("When building LibCStage:");
- std::tr1::shared_ptr<PackageDepSpec> libc(new PackageDepSpec(parse_user_package_dep_spec(TargetConfig::get_instance()->libc(),
+ std::tr1::shared_ptr<PackageDepSpec> libc(new PackageDepSpec(
+ parse_user_package_dep_spec(TargetConfig::get_instance()->libc(), _env.get(),
UserPackageDepSpecOptions())));
_env->clear_adaptions();
@@ -177,7 +186,8 @@ bool
LibCStage::is_rebuild() const
{
std::tr1::shared_ptr<const PackageIDSequence> c((*_env)[selection::BestVersionOnly(
- generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->libc(), UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->libc(),
+ _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]);
if (c->empty())
@@ -191,7 +201,8 @@ FullStage::build(const StageOptions &) const
{
Context context("When building FullStage:");
- std::tr1::shared_ptr<PackageDepSpec> gcc(new PackageDepSpec(parse_user_package_dep_spec(TargetConfig::get_instance()->gcc(),
+ std::tr1::shared_ptr<PackageDepSpec> gcc(new PackageDepSpec(parse_user_package_dep_spec(
+ TargetConfig::get_instance()->gcc(), _env.get(),
UserPackageDepSpecOptions())));
_env->clear_adaptions();
@@ -210,7 +221,8 @@ bool
FullStage::is_rebuild() const
{
std::tr1::shared_ptr<const PackageIDSequence> c((*_env)[selection::BestVersionOnly(
- generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->gcc(), UserPackageDepSpecOptions())) |
+ generator::Matches(parse_user_package_dep_spec(TargetConfig::get_instance()->gcc(),
+ _env.get(), UserPackageDepSpecOptions())) |
filter::InstalledAtRoot(_env->root()))]);
if (c->empty())
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 893b3ff..9964a4f 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -181,7 +181,8 @@ int do_has_version(std::tr1::shared_ptr<Environment> env)
Context context("When performing has-version action from command line:");
std::string query(*CommandLine::get_instance()->begin_parameters());
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(parse_user_package_dep_spec(query, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ parse_user_package_dep_spec(query, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries((*env)[selection::SomeArbitraryVersion(
generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
@@ -198,7 +199,8 @@ int do_best_version(std::tr1::shared_ptr<Environment> env)
Context context("When performing best-version action from command line:");
std::string query(*CommandLine::get_instance()->begin_parameters());
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(parse_user_package_dep_spec(query, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ parse_user_package_dep_spec(query, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(
generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
@@ -238,7 +240,8 @@ int do_match(std::tr1::shared_ptr<Environment> env)
Context context("When performing match action from command line:");
std::string query(*CommandLine::get_instance()->begin_parameters());
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(parse_user_package_dep_spec(query, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ parse_user_package_dep_spec(query, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(
generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
@@ -281,7 +284,8 @@ int do_environment_variable(std::tr1::shared_ptr<Environment> env)
std::string spec_str(*CommandLine::get_instance()->begin_parameters());
std::string var_str(* next(CommandLine::get_instance()->begin_parameters()));
- std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(parse_user_package_dep_spec(spec_str, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ parse_user_package_dep_spec(spec_str, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(
generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index a1f7590..1c76786 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -70,13 +70,8 @@ namespace
{
Context local_context("When handling query '" + target + "':");
- /* we might have a dep spec, but we might just have a simple package name
- * without a category. either should work. */
- std::tr1::shared_ptr<PackageDepSpec> spec(std::string::npos == target.find('/') ?
- new PackageDepSpec(make_package_dep_spec().package(
- env->package_database()->fetch_unique_qualified_package_name(
- PackageNamePart(target), filter::InstalledAtRoot(env->root())))) :
- new PackageDepSpec(parse_user_package_dep_spec(target, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(
+ new PackageDepSpec(parse_user_package_dep_spec(target, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries(
(*env)[selection::AllVersionsUnsorted(generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index 78bc41e..2bc2744 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -94,12 +94,8 @@ do_one_contents(
{
Context local_context("When handling query '" + q + "':");
- /* we might have a dep spec, but we might just have a simple package name
- * without a category. either should work. */
- std::tr1::shared_ptr<PackageDepSpec> spec(std::string::npos == q.find('/') ?
- new PackageDepSpec(make_package_dep_spec().package(
- env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(q)))) :
- new PackageDepSpec(parse_user_package_dep_spec(q, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries(
(*env)[selection::AllVersionsSorted(generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
diff --git a/src/clients/paludis/do_executables.cc b/src/clients/paludis/do_executables.cc
index 9f6b340..7a94a0e 100644
--- a/src/clients/paludis/do_executables.cc
+++ b/src/clients/paludis/do_executables.cc
@@ -124,12 +124,8 @@ do_one_executables(
{
Context local_context("When handling query '" + q + "':");
- /* we might have a dep spec, but we might just have a simple package name
- * without a category. either should work. */
- std::tr1::shared_ptr<PackageDepSpec> spec(std::string::npos == q.find('/') ?
- new PackageDepSpec(make_package_dep_spec().package(
- env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(q)))) :
- new PackageDepSpec(parse_user_package_dep_spec(q, UserPackageDepSpecOptions())));
+ std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
+ parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence> entries(
(*env)[selection::AllVersionsSorted(generator::Matches(*spec) | filter::InstalledAtRoot(env->root()))]);
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 6b4dc43..ae1c3d5 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -206,12 +206,8 @@ int do_one_info(
{
Context local_context("When handling query '" + q + "':");
- std::tr1::shared_ptr<PackageDepSpec> spec;
- if (std::string::npos != q.find('/'))
- spec.reset(new PackageDepSpec(parse_user_package_dep_spec(q, UserPackageDepSpecOptions())));
- else
- spec.reset(new PackageDepSpec(make_package_dep_spec().package(
- env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(q)))));
+ std::tr1::shared_ptr<PackageDepSpec> spec(
+ new PackageDepSpec(parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions())));
std::tr1::shared_ptr<const PackageIDSequence>
entries((*env)[selection::AllVersionsSorted(generator::Matches(*spec))]),
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index 492781b..39e8b63 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -128,30 +128,15 @@ void do_one_query(
{
Context local_context("When handling query '" + q + "':");
- /* we might have a dep spec, but we might just have a simple package name
- * without a category. or it might be a set... all should work. */
- std::tr1::shared_ptr<PackageDepSpec> spec;
- std::tr1::shared_ptr<const SetSpecTree::ConstItem> set;
- if (std::string::npos == q.find('/'))
+ try
{
- try
- {
- set = env->set(SetName(q));
- }
- catch (const SetNameError &)
- {
- }
- if (0 == set)
- spec.reset(new PackageDepSpec(make_package_dep_spec().package(
- env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(q)))));
+ do_one_package_query(env, masks_to_explain, make_shared_ptr(new PackageDepSpec(
+ parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions() + updso_throw_if_set))));
+ }
+ catch (const GotASetNotAPackageDepSpec &)
+ {
+ do_one_set_query(env, q, masks_to_explain, env->set(SetName(q)));
}
- else
- spec.reset(new PackageDepSpec(parse_user_package_dep_spec(q, UserPackageDepSpecOptions())));
-
- if (spec)
- do_one_package_query(env, masks_to_explain, spec);
- else
- do_one_set_query(env, q, masks_to_explain, set);
}
int do_query(std::tr1::shared_ptr<Environment> env)