aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-05 17:24:42 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-05 19:06:04 +0100
commit0a0afc97925e6c8df3cedd5a4c3dee60a9673785 (patch)
treeebfa071857b3aacd7a4db5dc9bd25c421f505088 /src
parent975c0c94b62ff647c8aceab9c4ff62ca4e47142e (diff)
downloadpaludis-0a0afc97925e6c8df3cedd5a4c3dee60a9673785.tar.gz
paludis-0a0afc97925e6c8df3cedd5a4c3dee60a9673785.tar.xz
No need for fancy PackageDepSpecData subclassing
Diffstat (limited to 'src')
-rw-r--r--src/clients/cave/cmd_digest.cc4
-rw-r--r--src/clients/cave/cmd_fix_linkage.cc10
-rw-r--r--src/clients/cave/cmd_mirror.cc1
-rw-r--r--src/clients/cave/cmd_print_spec.cc89
-rw-r--r--src/clients/cave/cmd_report.cc8
-rw-r--r--src/clients/cave/cmd_show.cc35
6 files changed, 73 insertions, 74 deletions
diff --git a/src/clients/cave/cmd_digest.cc b/src/clients/cave/cmd_digest.cc
index 3c8ea88f4..dbfcd0f6d 100644
--- a/src/clients/cave/cmd_digest.cc
+++ b/src/clients/cave/cmd_digest.cc
@@ -47,7 +47,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/action.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <cstdlib>
#include <iostream>
@@ -116,7 +116,7 @@ DigestCommand::run(
throw args::DoHelp("digest takes exactly two parameters");
RepositoryName repo(*next(cmdline.begin_parameters()));
- Filter repo_filter(filter::Matches(make_package_dep_spec({ }).in_repository(repo), make_null_shared_ptr(), { }));
+ Filter repo_filter(filter::Matches(MutablePackageDepSpecData({ }).constrain_in_repository(repo), make_null_shared_ptr(), { }));
QualifiedPackageName pkg(std::string::npos == cmdline.begin_parameters()->find('/') ?
env->fetch_unique_qualified_package_name(PackageNamePart(*cmdline.begin_parameters()), repo_filter) :
QualifiedPackageName(*cmdline.begin_parameters()));
diff --git a/src/clients/cave/cmd_fix_linkage.cc b/src/clients/cave/cmd_fix_linkage.cc
index c12fcf05a..dc340c595 100644
--- a/src/clients/cave/cmd_fix_linkage.cc
+++ b/src/clients/cave/cmd_fix_linkage.cc
@@ -37,8 +37,8 @@
#include <paludis/metadata_key.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/version_operator.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/version_spec.hh>
+#include <paludis/dep_spec_data.hh>
#include <iostream>
#include <set>
@@ -208,13 +208,13 @@ FixLinkageCommand::run(
cout << endl;
}
- PartiallyMadePackageDepSpec part_spec({ });
- part_spec.package((*pkg_it)->name());
+ MutablePackageDepSpecData part_spec({ });
+ part_spec.constrain_package((*pkg_it)->name());
if ((*pkg_it)->slot_key())
- part_spec.exact_slot_constraint((*pkg_it)->slot_key()->value(), false);
+ part_spec.constrain_exact_slot((*pkg_it)->slot_key()->value(), false);
if (cmdline.a_exact.specified())
- part_spec.version_constraint((*pkg_it)->version(), vo_equal, vcc_and);
+ part_spec.constrain_version(vcc_and, vo_equal, (*pkg_it)->version());
targets->push_back(std::make_pair(stringify(PackageDepSpec(part_spec)), join(broken_files.begin(), broken_files.end(), ", ")));
}
diff --git a/src/clients/cave/cmd_mirror.cc b/src/clients/cave/cmd_mirror.cc
index f51560916..2d9267739 100644
--- a/src/clients/cave/cmd_mirror.cc
+++ b/src/clients/cave/cmd_mirror.cc
@@ -48,7 +48,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/standard_output_manager.hh>
#include <paludis/action.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <cstdlib>
#include <iostream>
diff --git a/src/clients/cave/cmd_print_spec.cc b/src/clients/cave/cmd_print_spec.cc
index ad6f36015..03df2026b 100644
--- a/src/clients/cave/cmd_print_spec.cc
+++ b/src/clients/cave/cmd_print_spec.cc
@@ -38,11 +38,11 @@
#include <paludis/environment.hh>
#include <paludis/metadata_key.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
#include <paludis/elike_use_requirement.hh>
+#include <paludis/dep_spec_data.hh>
#include <iostream>
#include <algorithm>
@@ -122,51 +122,43 @@ namespace
const PrintSpecCommandLine & cmdline
)
{
- PartiallyMadePackageDepSpec s(spec);
+ MutablePackageDepSpecData s(*spec.data());
if (cmdline.a_package.specified())
{
- if (cmdline.a_package.argument().empty())
- s.clear_package();
- else
- s.package(QualifiedPackageName(cmdline.a_package.argument()));
+ s.unconstrain_package();
+ s.unconstrain_package_name_part();
+ s.unconstrain_category_name_part();
+ if (! cmdline.a_package.argument().empty())
+ s.constrain_package(QualifiedPackageName(cmdline.a_package.argument()));
}
if (cmdline.a_slot_requirement.specified())
{
- if (cmdline.a_slot_requirement.argument().empty())
- {
- s.clear_any_slot();
- s.clear_exact_slot();
- }
- else
- {
- s.clear_any_slot();
- s.exact_slot_constraint(SlotName(cmdline.a_slot_requirement.argument()), false);
- }
+ s.unconstrain_exact_slot();
+ s.unconstrain_any_slot();
+ if (! cmdline.a_slot_requirement.argument().empty())
+ s.constrain_exact_slot(SlotName(cmdline.a_slot_requirement.argument()), false);
}
if (cmdline.a_in_repository.specified())
{
- if (cmdline.a_in_repository.argument().empty())
- s.clear_in_repository();
- else
- s.in_repository(RepositoryName(cmdline.a_in_repository.argument()));
+ s.unconstrain_in_repository();
+ if (! cmdline.a_in_repository.argument().empty())
+ s.constrain_in_repository(RepositoryName(cmdline.a_in_repository.argument()));
}
if (cmdline.a_from_repository.specified())
{
- if (cmdline.a_from_repository.argument().empty())
- s.clear_from_repository();
- else
- s.from_repository(RepositoryName(cmdline.a_from_repository.argument()));
+ s.unconstrain_from_repository();
+ if (! cmdline.a_from_repository.argument().empty())
+ s.constrain_from_repository(RepositoryName(cmdline.a_from_repository.argument()));
}
if (cmdline.a_installable_to_repository.specified())
{
- if (cmdline.a_installable_to_repository.argument().empty())
- s.clear_installable_to_repository();
- else
+ s.unconstrain_installable_to_repository();
+ if (! cmdline.a_installable_to_repository.argument().empty())
{
std::string repo(cmdline.a_installable_to_repository.argument());
bool include_masked(false);
@@ -176,23 +168,21 @@ namespace
include_masked = true;
}
- s.installable_to_repository(RepositoryName(repo), include_masked);
+ s.constrain_installable_to_repository(RepositoryName(repo), include_masked);
}
}
if (cmdline.a_installed_at_path.specified())
{
- if (cmdline.a_installed_at_path.argument().empty())
- s.clear_installed_at_path();
- else
- s.installed_at_path(FSPath(cmdline.a_installed_at_path.argument()));
+ s.unconstrain_installed_at_path();
+ if (! cmdline.a_installed_at_path.argument().empty())
+ s.constrain_installed_at_path(FSPath(cmdline.a_installed_at_path.argument()));
}
if (cmdline.a_installable_to_path.specified())
{
- if (cmdline.a_installable_to_path.argument().empty())
- s.clear_installable_to_path();
- else
+ s.unconstrain_installable_to_path();
+ if (! cmdline.a_installable_to_path.argument().empty())
{
std::string path(cmdline.a_installable_to_path.argument());
bool include_masked(false);
@@ -202,24 +192,27 @@ namespace
include_masked = true;
}
- s.installable_to_path(FSPath(path), include_masked);
+ s.constrain_installable_to_path(FSPath(path), include_masked);
}
}
+ if (cmdline.a_package_part.specified() || cmdline.a_category_part.specified())
+ {
+ s.unconstrain_package();
+ s.unconstrain_package_name_part();
+ s.unconstrain_category_name_part();
+ }
+
if (cmdline.a_package_part.specified())
{
- if (cmdline.a_package_part.argument().empty())
- s.clear_package_name_part();
- else
- s.package_name_part(PackageNamePart(cmdline.a_package_part.argument()));
+ if (! cmdline.a_package_part.argument().empty())
+ s.constrain_package_name_part(PackageNamePart(cmdline.a_package_part.argument()));
}
if (cmdline.a_category_part.specified())
{
- if (cmdline.a_category_part.argument().empty())
- s.clear_category_name_part();
- else
- s.category_name_part(CategoryNamePart(cmdline.a_category_part.argument()));
+ if (! cmdline.a_category_part.argument().empty())
+ s.constrain_category_name_part(CategoryNamePart(cmdline.a_category_part.argument()));
}
VersionConstraintCombiner vcc(vcc_and);
@@ -235,7 +228,7 @@ namespace
if (cmdline.a_version_requirement.specified())
{
- s.clear_version();
+ s.unconstrain_versions();
for (args::StringSetArg::ConstIterator a(cmdline.a_version_requirement.begin_args()),
a_end(cmdline.a_version_requirement.end_args()) ;
@@ -247,13 +240,13 @@ namespace
throw args::DoHelp("--" + cmdline.a_version_requirement.long_name() + " arguments should be in the form =1.23");
std::string op(a->substr(0, p)), ver(a->substr(p));
- s.version_constraint(VersionSpec(ver, {}), VersionOperator(op), vcc);
+ s.constrain_version(vcc, VersionOperator(op), VersionSpec(ver, {}));
}
}
if (cmdline.a_additional_requirement.specified())
{
- s.clear_choices();
+ s.unconstrain_choices();
for (args::StringSetArg::ConstIterator a(cmdline.a_additional_requirement.begin_args()),
a_end(cmdline.a_additional_requirement.end_args()) ;
@@ -261,7 +254,7 @@ namespace
if (! a->empty())
{
auto k(parse_elike_use_requirement(*a, { }));
- s.choice_constraint(k);
+ s.constrain_choice(k);
}
}
diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc
index ff6e639ed..78c75c77d 100644
--- a/src/clients/cave/cmd_report.cc
+++ b/src/clients/cave/cmd_report.cc
@@ -37,9 +37,9 @@
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
#include <paludis/match_package.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/action.hh>
#include <paludis/version_operator.hh>
+#include <paludis/dep_spec_data.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -106,9 +106,9 @@ namespace
{
auto ids((*env)[selection::BestVersionOnly((
generator::InRepository(RepositoryName(*r)) &
- generator::Matches(make_package_dep_spec({ })
- .package(id->name())
- .version_constraint(id->version(), vo_equal, vcc_and),
+ generator::Matches(MutablePackageDepSpecData({ })
+ .constrain_package(id->name())
+ .constrain_version(vcc_and, vo_equal, id->version()),
make_null_shared_ptr(), { })) |
filter::SupportsAction<InstallAction>())]);
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index a74421c97..11c197441 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -25,8 +25,20 @@
#include "format_user_config.hh"
#include "parse_spec_with_nice_error.hh"
+#include <paludis/util/set.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/pretty_print.hh>
+#include <paludis/util/timestamp.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/join.hh>
+
#include <paludis/args/args.hh>
#include <paludis/args/do_help.hh>
+
#include <paludis/name.hh>
#include <paludis/environment.hh>
#include <paludis/repository.hh>
@@ -37,23 +49,14 @@
#include <paludis/selection.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/visitor_cast.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/pretty_print.hh>
-#include <paludis/util/timestamp.hh>
-#include <paludis/util/make_null_shared_ptr.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/join.hh>
#include <paludis/action.hh>
#include <paludis/mask.hh>
#include <paludis/choice.hh>
-#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/mask_utils.hh>
#include <paludis/permitted_choice_value_parameter_values.hh>
#include <paludis/contents.hh>
+#include <paludis/dep_spec_data.hh>
+
#include <cstdlib>
#include <iostream>
#include <algorithm>
@@ -239,7 +242,7 @@ namespace
for (PackageIDSequence::ConstIterator i(names->begin()), i_end(names->end()) ;
i != i_end ; ++i)
{
- PackageDepSpec name_spec(make_package_dep_spec({ }).package((*i)->name()));
+ PackageDepSpec name_spec(MutablePackageDepSpecData({ }).constrain_package((*i)->name()));
cout << fuc(select_format_for_spec(env, name_spec, make_null_shared_ptr(),
fs_wildcard_spec_installed(),
fs_wildcard_spec_installable(),
@@ -1323,7 +1326,9 @@ namespace
for (auto r(repos.begin()), r_end(repos.end()) ; r != r_end ; ++r)
{
auto r_ids((*env)[selection::AllVersionsGroupedBySlot(generator::Matches(
- PartiallyMadePackageDepSpec(s).in_repository(*r), make_null_shared_ptr(), { }))]);
+ MutablePackageDepSpecData(*s.data())
+ .unconstrain_in_repository()
+ .constrain_in_repository(*r), make_null_shared_ptr(), { }))]);
if (! r_ids->empty())
do_one_package_with_ids(cmdline, env, basic_ppos, s, r_ids, cout, rest_out);
}
@@ -1350,7 +1355,9 @@ namespace
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
- do_one_package(cmdline, env, basic_ppos, PartiallyMadePackageDepSpec(s).package((*i)->name()));
+ do_one_package(cmdline, env, basic_ppos, MutablePackageDepSpecData(*s.data())
+ .unconstrain_package()
+ .constrain_package((*i)->name()));
}
}