aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-29 21:47:08 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-03 21:20:26 +0100
commit77be16f5c2de2ebcd7ce78084755f83c522edc39 (patch)
tree7f46de7cf0f1cd9ec9cd2c4b342446cd0c4d567c
parent5c42e4800f4e6edd91dc6d8cdf54afb3d1fb34df (diff)
downloadpaludis-77be16f5c2de2ebcd7ce78084755f83c522edc39.tar.gz
paludis-77be16f5c2de2ebcd7ce78084755f83c522edc39.tar.xz
Kill kc. Breaks python.
-rw-r--r--doc/api/cplusplus/examples/example_action.cc18
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc6
-rw-r--r--paludis/action-fwd.hh45
-rw-r--r--paludis/action.cc5
-rw-r--r--paludis/action.hh57
-rw-r--r--paludis/args/install_args_group.cc2
-rw-r--r--paludis/dep_list.cc9
-rw-r--r--paludis/distribution-fwd.hh31
-rw-r--r--paludis/distribution.cc42
-rw-r--r--paludis/distribution.hh53
-rw-r--r--paludis/elike_conditional_dep_spec.cc3
-rw-r--r--paludis/elike_dep_parser-fwd.hh18
-rw-r--r--paludis/elike_dep_parser.cc23
-rw-r--r--paludis/elike_dep_parser.hh30
-rw-r--r--paludis/elike_dep_parser_TEST.cc80
-rw-r--r--paludis/elike_package_dep_spec-fwd.hh14
-rw-r--r--paludis/elike_package_dep_spec.cc49
-rw-r--r--paludis/elike_package_dep_spec.hh25
-rw-r--r--paludis/environment_implementation.cc19
-rw-r--r--paludis/environment_maker.cc5
-rw-r--r--paludis/environments/no_config/no_config_environment.cc25
-rw-r--r--paludis/environments/paludis/paludis_config.cc46
-rw-r--r--paludis/environments/paludis/paludis_config.hh19
-rw-r--r--paludis/environments/paludis/paludis_environment.cc14
-rw-r--r--paludis/environments/paludis/use_conf.cc4
-rw-r--r--paludis/environments/portage/portage_environment.cc10
-rw-r--r--paludis/hooker.cc8
-rw-r--r--paludis/install_task.cc32
-rw-r--r--paludis/mask-fwd.hh22
-rw-r--r--paludis/mask.hh24
-rw-r--r--paludis/merger-fwd.hh21
-rw-r--r--paludis/merger.cc126
-rw-r--r--paludis/merger.hh32
-rw-r--r--paludis/merger_TEST.cc35
-rw-r--r--paludis/ndbam-fwd.hh19
-rw-r--r--paludis/ndbam.cc21
-rw-r--r--paludis/ndbam.hh23
-rw-r--r--paludis/ndbam_merger.cc54
-rw-r--r--paludis/ndbam_merger.hh42
-rw-r--r--paludis/ndbam_unmerger.cc56
-rw-r--r--paludis/ndbam_unmerger.hh32
-rw-r--r--paludis/package_id.hh1
-rw-r--r--paludis/report_task.cc4
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc36
-rw-r--r--paludis/repositories/cran/cran_repository.cc30
-rw-r--r--paludis/repositories/e/check_fetched_files_visitor.cc134
-rw-r--r--paludis/repositories/e/dep_parser.cc273
-rw-r--r--paludis/repositories/e/e_installed_repository.cc89
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc3
-rw-r--r--paludis/repositories/e/e_key.cc24
-rw-r--r--paludis/repositories/e/e_repository.cc88
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc88
-rw-r--r--paludis/repositories/e/e_repository_id.cc1
-rw-r--r--paludis/repositories/e/e_repository_mask_file.cc5
-rw-r--r--paludis/repositories/e/e_repository_profile.cc5
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc8
-rw-r--r--paludis/repositories/e/e_stripper.cc22
-rw-r--r--paludis/repositories/e/e_stripper.hh24
-rw-r--r--paludis/repositories/e/eapi-fwd.hh2
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/ebuild.cc425
-rw-r--r--paludis/repositories/e/ebuild.hh219
-rw-r--r--paludis/repositories/e/ebuild_entries.cc320
-rw-r--r--paludis/repositories/e/ebuild_id.cc32
-rw-r--r--paludis/repositories/e/exndbam_repository.cc161
-rw-r--r--paludis/repositories/e/info_metadata_key.cc1
-rw-r--r--paludis/repositories/e/make_ebuild_repository.cc17
-rw-r--r--paludis/repositories/e/qa/eapi_supported.cc1
-rw-r--r--paludis/repositories/e/qa/fetches_key.cc2
-rw-r--r--paludis/repositories/e/qa/iuse_key.cc2
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc6
-rw-r--r--paludis/repositories/e/qa/visibility.cc24
-rw-r--r--paludis/repositories/e/source_uri_finder.cc12
-rw-r--r--paludis/repositories/e/vdb_merger.cc54
-rw-r--r--paludis/repositories/e/vdb_merger.hh35
-rw-r--r--paludis/repositories/e/vdb_merger_TEST.cc20
-rw-r--r--paludis/repositories/e/vdb_repository.cc157
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc101
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc62
-rw-r--r--paludis/repositories/e/vdb_unmerger.hh29
-rw-r--r--paludis/repositories/e/vdb_unmerger_TEST.cc16
-rw-r--r--paludis/repositories/fake/dep_parser.cc231
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc37
-rw-r--r--paludis/repositories/fake/fake_package_id.cc8
-rw-r--r--paludis/repositories/fake/fake_repository.cc69
-rw-r--r--paludis/repositories/gems/gems_repository.cc30
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc30
-rw-r--r--paludis/repositories/gems/registration.cc5
-rw-r--r--paludis/repositories/unavailable/registration.cc15
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc19
-rw-r--r--paludis/repositories/unavailable/unavailable_id.hh37
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc67
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.hh24
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_TEST.cc29
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_file-fwd.hh28
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_file.cc14
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc44
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc18
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc104
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc101
-rw-r--r--paludis/repositories/unpackaged/registration.cc24
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc36
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc50
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.hh41
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc166
-rw-r--r--paludis/repositories/unpackaged/unpackaged_stripper.cc22
-rw-r--r--paludis/repositories/unpackaged/unpackaged_stripper.hh23
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc40
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc46
-rw-r--r--paludis/repositories/virtuals/virtuals_repository_TEST.cc2
-rw-r--r--paludis/repository-fwd.hh87
-rw-r--r--paludis/repository.hh112
-rw-r--r--paludis/stripper-fwd.hh11
-rw-r--r--paludis/stripper.cc15
-rw-r--r--paludis/stripper.hh17
-rw-r--r--paludis/stripper_TEST.cc12
-rw-r--r--paludis/sync_task.cc2
-rw-r--r--paludis/syncer.cc17
-rw-r--r--paludis/syncer.hh34
-rw-r--r--paludis/uninstall_task.cc1
-rw-r--r--paludis/unmerger.cc46
-rw-r--r--paludis/unmerger.hh20
-rw-r--r--paludis/user_dep_spec.cc25
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/kc-fwd.hh80
-rw-r--r--paludis/util/kc.hh646
-rw-r--r--paludis/util/keys.hh201
-rw-r--r--paludis/util/named_value-fwd.hh1
-rw-r--r--paludis/util/named_value.hh6
-rw-r--r--paludis/version_spec.cc128
-rw-r--r--python/action.cc65
-rw-r--r--python/mask.cc9
-rw-r--r--python/paludis_python.hh17
-rw-r--r--ruby/action.cc80
-rw-r--r--ruby/metadata_key.cc7
-rw-r--r--ruby/paludis_ruby.cc1
-rw-r--r--ruby/repository.cc92
-rw-r--r--src/clients/accerso/accerso.cc20
-rw-r--r--src/clients/adjutrix/display_default_system_resolution.cc14
-rw-r--r--src/clients/adjutrix/downgrade_check.cc16
-rw-r--r--src/clients/adjutrix/find_insecure_packages.cc4
-rw-r--r--src/clients/adjutrix/find_unused_packages.cc2
-rw-r--r--src/clients/adjutrix/keywords_graph.cc4
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc2
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/repository_buttons.cc2
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/sets_list_model.cc4
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc5
-rw-r--r--src/clients/paludis/applets.cc2
-rw-r--r--src/clients/paludis/list.cc4
-rw-r--r--src/clients/qualudis/qualudis.cc11
-rw-r--r--src/output/console_install_task.cc13
-rw-r--r--src/output/console_query_task.cc11
-rw-r--r--src/output/mask_displayer.cc5
153 files changed, 3232 insertions, 3714 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index 34576af..92ffd31 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -60,10 +60,10 @@ int main(int argc, char * argv[])
* creating a FetchAction, controlling whether safe resume is used
* and whether unneeded (e.g. due to disabled USE flags) source
* files should still be fetched. */
- FetchAction fetch_action(FetchActionOptions::named_create()
- (k::fetch_unneeded(), false)
- (k::safe_resume(), true)
- );
+ FetchAction fetch_action(make_named_values<FetchActionOptions>(
+ value_for<n::fetch_unneeded>(false),
+ value_for<n::safe_resume>(true)
+ ));
try
{
(*i)->perform_action(fetch_action);
@@ -79,16 +79,16 @@ int main(int argc, char * argv[])
for (Sequence<FetchActionFailure>::ConstIterator f(e.failures()->begin()), f_end(e.failures()->end()) ;
f != f_end ; ++f)
{
- cout << " * File '" << (*f)[k::target_file()] << "': ";
+ cout << " * File '" << f->target_file() << "': ";
bool need_comma(false);
- if ((*f)[k::requires_manual_fetching()])
+ if (f->requires_manual_fetching())
{
cout << "requires manual fetching";
need_comma = true;
}
- if ((*f)[k::failed_automatic_fetching()])
+ if (f->failed_automatic_fetching())
{
if (need_comma)
cout << ", ";
@@ -96,11 +96,11 @@ int main(int argc, char * argv[])
need_comma = true;
}
- if (! (*f)[k::failed_integrity_checks()].empty())
+ if (! f->failed_integrity_checks().empty())
{
if (need_comma)
cout << ", ";
- cout << "failed integrity checks: " << (*f)[k::failed_integrity_checks()];
+ cout << "failed integrity checks: " << f->failed_integrity_checks();
need_comma = true;
}
}
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 725e5f1..be7c3ec 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -113,13 +113,13 @@ namespace
* can return a zero pointer. Other keys can't. */
if (key.value())
{
- cout << indent << left << setw(30) << " Mask file:" << " " << (*key.value())[k::mask_file()] << endl;
+ cout << indent << left << setw(30) << " Mask file:" << " " << key.value()->mask_file() << endl;
/* Comment looks best if it's outputted over multiple lines,
* as that's how it tends to be stored in package.mask. */
cout << indent << left << setw(30) << " Comment:" << " ";
bool first(true);
- for (Sequence<std::string>::ConstIterator i((*key.value())[k::comment()]->begin()),
- i_end((*key.value())[k::comment()]->end()) ;
+ for (Sequence<std::string>::ConstIterator i(key.value()->comment()->begin()),
+ i_end(key.value()->comment()->end()) ;
i != i_end ; ++i)
{
if (! first)
diff --git a/paludis/action-fwd.hh b/paludis/action-fwd.hh
index ef58a1c..a3ec657 100644
--- a/paludis/action-fwd.hh
+++ b/paludis/action-fwd.hh
@@ -22,9 +22,6 @@
#include <iosfwd>
#include <paludis/util/attributes.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/repository-fwd.hh>
#include <tr1/memory>
/** \file
@@ -59,46 +56,12 @@ namespace paludis
class ConfigActionError;
class InfoActionError;
-#include <paludis/action-se.hh>
-
- /**
- * Options for a FetchAction.
- *
- * \see FetchAction
- * \ingroup g_actions
- * \since 0.26
- */
- typedef kc::KeyedClass<
- kc::Field<k::fetch_unneeded, bool>,
- kc::Field<k::safe_resume, bool>
- > FetchActionOptions;
+ struct FetchActionOptions;
+ struct InstallActionOptions;
- /**
- * Options for an InstallAction.
- *
- * \see InstallAction
- * \ingroup g_actions
- * \since 0.26
- */
- typedef kc::KeyedClass<
- kc::Field<k::debug_build, InstallActionDebugOption>,
- kc::Field<k::checks, InstallActionChecksOption>,
- kc::Field<k::destination, std::tr1::shared_ptr<Repository> >
- > InstallActionOptions;
+ struct FetchActionFailure;
- /**
- * A failed fetch action part.
- *
- * \see FetchActionError
- * \ingroup g_actions
- * \since 0.26
- */
- typedef kc::KeyedClass<
- kc::Field<k::target_file, std::string>,
- kc::Field<k::requires_manual_fetching, bool>,
- kc::Field<k::failed_automatic_fetching, bool>,
- kc::Field<k::failed_integrity_checks, std::string>
- > FetchActionFailure;
+#include <paludis/action-se.hh>
}
diff --git a/paludis/action.cc b/paludis/action.cc
index df63616..3b76783 100644
--- a/paludis/action.cc
+++ b/paludis/action.cc
@@ -23,7 +23,6 @@
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/sequence-impl.hh>
-#include <paludis/util/kc.hh>
using namespace paludis;
@@ -172,8 +171,8 @@ namespace
void visit(const InstallAction & a)
{
s << "install to ";
- if (a.options[k::destination()])
- s << a.options[k::destination()]->name();
+ if (a.options.destination())
+ s << a.options.destination()->name();
else
s << "nowhere";
}
diff --git a/paludis/action.hh b/paludis/action.hh
index 3aa4c91..62796be 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -28,6 +28,8 @@
#include <paludis/util/exception.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/sequence-fwd.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/util/fs_entry-fwd.hh>
/** \file
* Declarations for action-related classes.
@@ -41,6 +43,61 @@
namespace paludis
{
+ namespace n
+ {
+ struct checks;
+ struct debug_build;
+ struct destination;
+ struct failed_automatic_fetching;
+ struct failed_integrity_checks;
+ struct fetch_unneeded;
+ struct requires_manual_fetching;
+ struct safe_resume;
+ struct target_file;
+ }
+
+ /**
+ * Options for a FetchAction.
+ *
+ * \see FetchAction
+ * \ingroup g_actions
+ * \since 0.30
+ */
+ struct FetchActionOptions
+ {
+ NamedValue<n::fetch_unneeded, bool> fetch_unneeded;
+ NamedValue<n::safe_resume, bool> safe_resume;
+ };
+
+ /**
+ * Options for an InstallAction.
+ *
+ * \see InstallAction
+ * \ingroup g_actions
+ * \since 0.30
+ */
+ struct InstallActionOptions
+ {
+ NamedValue<n::checks, InstallActionChecksOption> checks;
+ NamedValue<n::debug_build, InstallActionDebugOption> debug_build;
+ NamedValue<n::destination, std::tr1::shared_ptr<Repository> > destination;
+ };
+
+ /**
+ * A failed fetch action part.
+ *
+ * \see FetchActionError
+ * \ingroup g_actions
+ * \since 0.30
+ */
+ struct FetchActionFailure
+ {
+ NamedValue<n::failed_automatic_fetching, bool> failed_automatic_fetching;
+ NamedValue<n::failed_integrity_checks, std::string> failed_integrity_checks;
+ NamedValue<n::requires_manual_fetching, bool> requires_manual_fetching;
+ NamedValue<n::target_file, std::string> target_file;
+ };
+
/**
* Types for visiting an action.
*
diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc
index 7730747..a7d30bf 100644
--- a/paludis/args/install_args_group.cc
+++ b/paludis/args/install_args_group.cc
@@ -95,7 +95,7 @@ InstallArgsGroup::destinations(Environment * env) const
{
std::tr1::shared_ptr<Repository> repo(env->package_database()->fetch_repository(
RepositoryName(*i)));
- if ((*repo)[k::destination_interface()])
+ if ((*repo).destination_interface())
d->insert(repo);
else
throw args::DoHelp("--destinations argument '" + *i + "' does not provide a destinations interface");
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index a9a8b42..e5a734a 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -52,7 +52,6 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/hashes.hh>
#include <algorithm>
@@ -1100,7 +1099,7 @@ DepList::add_package(const std::tr1::shared_ptr<const PackageID> & p, std::tr1::
p->provide_key()->value()->accept(f);
if (f.begin() != f.end() && ! (*DistributionData::get_instance()->distribution_from_string(
- _imp->env->distribution()))[k::support_old_style_virtuals()])
+ _imp->env->distribution())).support_old_style_virtuals())
throw DistributionConfigurationError("Package '" + stringify(*p) + "' has PROVIDEs, but this distribution "
"does not support old style virtuals");
@@ -1125,7 +1124,7 @@ DepList::add_package(const std::tr1::shared_ptr<const PackageID> & p, std::tr1::
our_merge_entry_post_position = _imp->merge_list.insert(next(our_merge_entry_post_position),
DepListEntry(DepListEntry::create()
.package_id((*_imp->env->package_database()->fetch_repository(
- RepositoryName("virtuals")))[k::make_virtuals_interface()]->make_virtual_package_id(
+ RepositoryName("virtuals"))).make_virtuals_interface()->make_virtual_package_id(
QualifiedPackageName((*i)->text()), p))
.generation(_imp->merge_list_generation)
.state(dle_has_all_deps)
@@ -1581,8 +1580,8 @@ DepList::find_destination(const PackageID & p,
{
for (DestinationsSet::ConstIterator d(dd->begin()), d_end(dd->end()) ;
d != d_end ; ++d)
- if ((**d)[k::destination_interface()])
- if ((**d)[k::destination_interface()]->is_suitable_destination_for(p))
+ if ((**d).destination_interface())
+ if ((**d).destination_interface()->is_suitable_destination_for(p))
return *d;
throw NoDestinationError(p, dd);
diff --git a/paludis/distribution-fwd.hh b/paludis/distribution-fwd.hh
index fb7b802..7ffc9a5 100644
--- a/paludis/distribution-fwd.hh
+++ b/paludis/distribution-fwd.hh
@@ -26,43 +26,12 @@
* \ingroup g_dep_spec
*/
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
#include <string>
namespace paludis
{
class DistributionData;
class DistributionConfigurationError;
-
- /**
- * Information about a distribution.
- *
- * \see DistributionData
- * \ingroup g_distribution
- * \since 0.26
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::default_environment, std::string>,
- kc::Field<k::fallback_environment, std::string>,
- kc::Field<k::support_old_style_virtuals, bool>,
- kc::Field<k::default_ebuild_distdir, std::string>,
- kc::Field<k::default_ebuild_write_cache, std::string>,
- kc::Field<k::default_ebuild_names_cache, std::string>,
- kc::Field<k::default_ebuild_builddir, std::string>,
- kc::Field<k::default_ebuild_layout, std::string>,
- kc::Field<k::default_ebuild_eapi_when_unknown, std::string>,
- kc::Field<k::default_ebuild_eapi_when_unspecified, std::string>,
- kc::Field<k::default_ebuild_profile_eapi, std::string>,
- kc::Field<k::default_vdb_provides_cache, std::string>,
- kc::Field<k::default_vdb_names_cache, std::string>,
- kc::Field<k::paludis_environment_use_conf_filename, std::string>,
- kc::Field<k::paludis_environment_keywords_conf_filename, std::string>,
- kc::Field<k::concept_use, std::string>,
- kc::Field<k::concept_keyword, std::string>,
- kc::Field<k::paludis_package, std::string>
- > Distribution;
}
#endif
diff --git a/paludis/distribution.cc b/paludis/distribution.cc
index 5f9cb4a..b6a7c2d 100644
--- a/paludis/distribution.cc
+++ b/paludis/distribution.cc
@@ -28,8 +28,8 @@
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/unordered_map>
using namespace paludis;
@@ -65,26 +65,26 @@ namespace paludis
KeyValueConfigFile k(*d, KeyValueConfigFileOptions(), &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
values.insert(std::make_pair(strip_trailing_string(d->basename(), ".conf"),
- make_shared_ptr(new Distribution(Distribution::named_create()
- (k::default_environment(), k.get("default_environment"))
- (k::fallback_environment(), k.get("fallback_environment"))
- (k::support_old_style_virtuals(), destringify<bool>(k.get("support_old_style_virtuals")))
- (k::default_ebuild_distdir(), k.get("default_ebuild_distdir"))
- (k::default_ebuild_write_cache(), k.get("default_ebuild_write_cache"))
- (k::default_ebuild_names_cache(), k.get("default_ebuild_names_cache"))
- (k::default_ebuild_builddir(), k.get("default_ebuild_builddir"))
- (k::default_ebuild_layout(), k.get("default_ebuild_layout"))
- (k::default_ebuild_eapi_when_unknown(), k.get("default_ebuild_eapi_when_unknown"))
- (k::default_ebuild_eapi_when_unspecified(), k.get("default_ebuild_eapi_when_unspecified"))
- (k::default_ebuild_profile_eapi(), k.get("default_ebuild_profile_eapi"))
- (k::default_vdb_provides_cache(), k.get("default_vdb_provides_cache"))
- (k::default_vdb_names_cache(), k.get("default_vdb_names_cache"))
- (k::paludis_environment_use_conf_filename(), k.get("paludis_environment_use_conf_filename"))
- (k::paludis_environment_keywords_conf_filename(), k.get("paludis_environment_keywords_conf_filename"))
- (k::concept_use(), k.get("concept_use"))
- (k::concept_keyword(), k.get("concept_keyword"))
- (k::paludis_package(), k.get("paludis_package"))
- ))));
+ make_shared_ptr(new Distribution(make_named_values<Distribution>(
+ value_for<n::concept_keyword>(k.get("concept_keyword")),
+ value_for<n::concept_use>(k.get("concept_use")),
+ value_for<n::default_ebuild_builddir>(k.get("default_ebuild_builddir")),
+ value_for<n::default_ebuild_distdir>(k.get("default_ebuild_distdir")),
+ value_for<n::default_ebuild_eapi_when_unknown>(k.get("default_ebuild_eapi_when_unknown")),
+ value_for<n::default_ebuild_eapi_when_unspecified>(k.get("default_ebuild_eapi_when_unspecified")),
+ value_for<n::default_ebuild_layout>(k.get("default_ebuild_layout")),
+ value_for<n::default_ebuild_names_cache>(k.get("default_ebuild_names_cache")),
+ value_for<n::default_ebuild_profile_eapi>(k.get("default_ebuild_profile_eapi")),
+ value_for<n::default_ebuild_write_cache>(k.get("default_ebuild_write_cache")),
+ value_for<n::default_environment>(k.get("default_environment")),
+ value_for<n::default_vdb_names_cache>(k.get("default_vdb_names_cache")),
+ value_for<n::default_vdb_provides_cache>(k.get("default_vdb_provides_cache")),
+ value_for<n::fallback_environment>(k.get("fallback_environment")),
+ value_for<n::paludis_environment_keywords_conf_filename>(k.get("paludis_environment_keywords_conf_filename")),
+ value_for<n::paludis_environment_use_conf_filename>(k.get("paludis_environment_use_conf_filename")),
+ value_for<n::paludis_package>(k.get("paludis_package")),
+ value_for<n::support_old_style_virtuals>(destringify<bool>(k.get("support_old_style_virtuals")))
+ )))));
}
}
};
diff --git a/paludis/distribution.hh b/paludis/distribution.hh
index 276903e..e0e380e 100644
--- a/paludis/distribution.hh
+++ b/paludis/distribution.hh
@@ -25,6 +25,7 @@
#include <paludis/util/exception.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/named_value.hh>
#include <tr1/memory>
/** \file
@@ -40,6 +41,58 @@
namespace paludis
{
+ namespace n
+ {
+ struct concept_keyword;
+ struct concept_use;
+ struct default_ebuild_builddir;
+ struct default_ebuild_distdir;
+ struct default_ebuild_eapi_when_unknown;
+ struct default_ebuild_eapi_when_unspecified;
+ struct default_ebuild_layout;
+ struct default_ebuild_names_cache;
+ struct default_ebuild_profile_eapi;
+ struct default_ebuild_write_cache;
+ struct default_environment;
+ struct default_vdb_names_cache;
+ struct default_vdb_provides_cache;
+ struct fallback_environment;
+ struct paludis_environment_keywords_conf_filename;
+ struct paludis_environment_use_conf_filename;
+ struct paludis_package;
+ struct support_old_style_virtuals;
+ }
+
+ /**
+ * Information about a distribution.
+ *
+ * \see DistributionData
+ * \ingroup g_distribution
+ * \since 0.30
+ * \nosubgrouping
+ */
+ struct Distribution
+ {
+ NamedValue<n::concept_keyword, std::string> concept_keyword;
+ NamedValue<n::concept_use, std::string> concept_use;
+ NamedValue<n::default_ebuild_builddir, std::string> default_ebuild_builddir;
+ NamedValue<n::default_ebuild_distdir, std::string> default_ebuild_distdir;
+ NamedValue<n::default_ebuild_eapi_when_unknown, std::string> default_ebuild_eapi_when_unknown;
+ NamedValue<n::default_ebuild_eapi_when_unspecified, std::string> default_ebuild_eapi_when_unspecified;
+ NamedValue<n::default_ebuild_layout, std::string> default_ebuild_layout;
+ NamedValue<n::default_ebuild_names_cache, std::string> default_ebuild_names_cache;
+ NamedValue<n::default_ebuild_profile_eapi, std::string> default_ebuild_profile_eapi;
+ NamedValue<n::default_ebuild_write_cache, std::string> default_ebuild_write_cache;
+ NamedValue<n::default_environment, std::string> default_environment;
+ NamedValue<n::default_vdb_names_cache, std::string> default_vdb_names_cache;
+ NamedValue<n::default_vdb_provides_cache, std::string> default_vdb_provides_cache;
+ NamedValue<n::fallback_environment, std::string> fallback_environment;
+ NamedValue<n::paludis_environment_keywords_conf_filename, std::string> paludis_environment_keywords_conf_filename;
+ NamedValue<n::paludis_environment_use_conf_filename, std::string> paludis_environment_use_conf_filename;
+ NamedValue<n::paludis_package, std::string> paludis_package;
+ NamedValue<n::support_old_style_virtuals, bool> support_old_style_virtuals;
+ };
+
/**
* Thrown if an invalid distribution file is encountered.
*
diff --git a/paludis/elike_conditional_dep_spec.cc b/paludis/elike_conditional_dep_spec.cc
index d369085..1ca1f22 100644
--- a/paludis/elike_conditional_dep_spec.cc
+++ b/paludis/elike_conditional_dep_spec.cc
@@ -21,7 +21,6 @@
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/visitor_cast.hh>
@@ -93,7 +92,7 @@ namespace
if (! id)
throw InternalError(PALUDIS_HERE, "! id");
- RepositoryUseInterface * const u((*id->repository())[k::use_interface()]);
+ RepositoryUseInterface * const u((*id->repository()).use_interface());
if (! u)
return true;
diff --git a/paludis/elike_dep_parser-fwd.hh b/paludis/elike_dep_parser-fwd.hh
index a1f5bf8..e620cbc 100644
--- a/paludis/elike_dep_parser-fwd.hh
+++ b/paludis/elike_dep_parser-fwd.hh
@@ -20,8 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_ELIKE_DEP_PARSER_FWD_HH
#define PALUDIS_GUARD_PALUDIS_ELIKE_DEP_PARSER_FWD_HH 1
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/map-fwd.hh>
#include <paludis/name-fwd.hh>
@@ -30,6 +28,8 @@
namespace paludis
{
+ struct ELikeDepParserCallbacks;
+
typedef std::tr1::function<void (const std::string &)> ELikeDepParserStringFunction;
typedef std::tr1::function<void (const std::string &, const std::string &)> ELikeDepParserArrowFunction;
typedef std::tr1::function<void ()> ELikeDepParserAnyFunction;
@@ -44,20 +44,6 @@ namespace paludis
typedef std::tr1::function<void (const std::tr1::shared_ptr<const Map<std::string, std::string> > &)>
ELikeDepParserAnnotationsFunction;
- typedef kc::KeyedClass<
- kc::Field<k::on_string, ELikeDepParserStringFunction>,
- kc::Field<k::on_arrow, ELikeDepParserArrowFunction>,
- kc::Field<k::on_any, ELikeDepParserAnyFunction>,
- kc::Field<k::on_all, ELikeDepParserAllFunction>,
- kc::Field<k::on_use, ELikeDepParserUseFunction>,
- kc::Field<k::on_label, ELikeDepParserLabelFunction>,
- kc::Field<k::on_pop, ELikeDepParserPopFunction>,
- kc::Field<k::on_error, ELikeDepParserErrorFunction>,
- kc::Field<k::on_should_be_empty, ELikeDepParserShouldBeEmptyFunction>,
- kc::Field<k::on_use_under_any, ELikeDepParserUseUnderAnyFunction>,
- kc::Field<k::on_annotations, ELikeDepParserAnnotationsFunction>
- > ELikeDepParserCallbacks;
-
void parse_elike_dependencies(const std::string &, const ELikeDepParserCallbacks & callbacks) PALUDIS_VISIBLE;
}
diff --git a/paludis/elike_dep_parser.cc b/paludis/elike_dep_parser.cc
index 0ad9247..615a37e 100644
--- a/paludis/elike_dep_parser.cc
+++ b/paludis/elike_dep_parser.cc
@@ -19,7 +19,6 @@
#include <paludis/elike_dep_parser.hh>
#include <paludis/util/simple_parser.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/map.hh>
@@ -34,7 +33,7 @@ namespace
void error(const SimpleParser & parser, const ELikeDepParserCallbacks & callbacks, const std::string & msg)
{
- callbacks[k::on_error()](parser.text(), parser.offset(), msg);
+ callbacks.on_error()(parser.text(), parser.offset(), msg);
throw InternalError(PALUDIS_HERE, "Got error '" + msg + "' parsing '" + parser.text() +
"', but the error function returned");
}
@@ -126,7 +125,7 @@ namespace
if (! parser.consume(+simple_parser::any_of(" \t\r\n")))
error(parser, callbacks, "Expected space or eof after ']]'");
- callbacks[k::on_annotations()](annotations);
+ callbacks.on_annotations()(annotations);
}
void
@@ -150,7 +149,7 @@ namespace
if (! parser.consume(+simple_parser::any_of(" \t\r\n")))
error(parser, callbacks, "Expected space after '('");
- callbacks[k::on_all()]();
+ callbacks.on_all()();
parse(parser, callbacks, true, false);
}
else if (parser.consume(+simple_parser::any_of(" \t\r\n")))
@@ -164,7 +163,7 @@ namespace
if (! parser.eof())
if (! parser.consume(+simple_parser::any_of(" \t\r\n")))
error(parser, callbacks, "Expected space or end of text after ')'");
- callbacks[k::on_pop()]();
+ callbacks.on_pop()();
parse_annotations(parser, callbacks);
return;
}
@@ -186,7 +185,7 @@ namespace
if (! parser.consume(+simple_parser::any_of(" \t\r\n")))
error(parser, callbacks, "Expected space after '|| ('");
- callbacks[k::on_any()]();
+ callbacks.on_any()();
parse(parser, callbacks, true, true);
}
else if (parser.consume(+simple_parser::any_except(" \t\r\n") >> word))
@@ -203,14 +202,14 @@ namespace
error(parser, callbacks, "Expected space after 'use? ('");
if (child_of_any)
- callbacks[k::on_use_under_any()]();
+ callbacks.on_use_under_any()();
- callbacks[k::on_use()](word);
+ callbacks.on_use()(word);
parse(parser, callbacks, true, false);
}
else if (':' == word.at(word.length() - 1))
{
- callbacks[k::on_label()](word);
+ callbacks.on_label()(word);
parse_annotations(parser, callbacks);
}
else if (parser.consume(+simple_parser::any_of(" \t\r\n") & simple_parser::exact("->")))
@@ -225,12 +224,12 @@ namespace
if ("->" == second || "||" == second || "(" == second || ")" == second)
error(parser, callbacks, "Expected word after '->' then space");
- callbacks[k::on_arrow()](word, second);
+ callbacks.on_arrow()(word, second);
parse_annotations(parser, callbacks);
}
else
{
- callbacks[k::on_string()](word);
+ callbacks.on_string()(word);
parse_annotations(parser, callbacks);
}
}
@@ -247,6 +246,6 @@ paludis::parse_elike_dependencies(const std::string & s, const ELikeDepParserCal
SimpleParser parser(s);
parse(parser, callbacks, false, false);
- callbacks[k::on_should_be_empty()]();
+ callbacks.on_should_be_empty()();
}
diff --git a/paludis/elike_dep_parser.hh b/paludis/elike_dep_parser.hh
index 08b6b24..ce42239 100644
--- a/paludis/elike_dep_parser.hh
+++ b/paludis/elike_dep_parser.hh
@@ -21,9 +21,39 @@
#define PALUDIS_GUARD_PALUDIS_ELIKE_DEP_PARSER_HH 1
#include <paludis/elike_dep_parser-fwd.hh>
+#include <paludis/util/named_value.hh>
namespace paludis
{
+ namespace n
+ {
+ struct on_all;
+ struct on_annotations;
+ struct on_any;
+ struct on_arrow;
+ struct on_error;
+ struct on_label;
+ struct on_pop;
+ struct on_should_be_empty;
+ struct on_string;
+ struct on_use;
+ struct on_use_under_any;
+ }
+
+ struct ELikeDepParserCallbacks
+ {
+ NamedValue<n::on_all, ELikeDepParserAllFunction> on_all;
+ NamedValue<n::on_annotations, ELikeDepParserAnnotationsFunction> on_annotations;
+ NamedValue<n::on_any, ELikeDepParserAnyFunction> on_any;
+ NamedValue<n::on_arrow, ELikeDepParserArrowFunction> on_arrow;
+ NamedValue<n::on_error, ELikeDepParserErrorFunction> on_error;
+ NamedValue<n::on_label, ELikeDepParserLabelFunction> on_label;
+ NamedValue<n::on_pop, ELikeDepParserPopFunction> on_pop;
+ NamedValue<n::on_should_be_empty, ELikeDepParserShouldBeEmptyFunction> on_should_be_empty;
+ NamedValue<n::on_string, ELikeDepParserStringFunction> on_string;
+ NamedValue<n::on_use, ELikeDepParserUseFunction> on_use;
+ NamedValue<n::on_use_under_any, ELikeDepParserUseUnderAnyFunction> on_use_under_any;
+ };
}
#endif
diff --git a/paludis/elike_dep_parser_TEST.cc b/paludis/elike_dep_parser_TEST.cc
index c6a6b87..1cd8141 100644
--- a/paludis/elike_dep_parser_TEST.cc
+++ b/paludis/elike_dep_parser_TEST.cc
@@ -18,9 +18,9 @@
*/
#include <paludis/elike_dep_parser.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -64,19 +64,19 @@ namespace test_cases
using namespace std::tr1::placeholders;
std::string in("|| ( a b ( c d e ) )"), out;
- ELikeDepParserCallbacks callbacks(ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&handler, std::tr1::ref(out), "s<", _1, ">", "", ""))
- (k::on_arrow(), std::tr1::bind(&handler, std::tr1::ref(out), "a<", _1, ", ", _2, ">"))
- (k::on_any(), std::tr1::bind(&handler, std::tr1::ref(out), "any<", "", "", "", ""))
- (k::on_all(), std::tr1::bind(&handler, std::tr1::ref(out), "all<", "", "", "", ""))
- (k::on_use(), std::tr1::bind(&handler, std::tr1::ref(out), "use<", _1, ", ", "", ""))
- (k::on_label(), std::tr1::bind(&handler, std::tr1::ref(out), "label<", _1, "", "", ""))
- (k::on_pop(), std::tr1::bind(&handler, std::tr1::ref(out), ">", "", "", "", ""))
- (k::on_error(), std::tr1::bind(&handler, std::tr1::ref(out), "error<", _1, ">", "", ""))
- (k::on_should_be_empty(), std::tr1::bind(&handler, std::tr1::ref(out), "EMPTY", "", "", "", ""))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), std::tr1::bind(&handle_annotations, std::tr1::ref(out), _1))
- );
+ ELikeDepParserCallbacks callbacks(make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&handler, std::tr1::ref(out), "all<", "", "", "", "")),
+ value_for<n::on_annotations>(std::tr1::bind(&handle_annotations, std::tr1::ref(out), _1)),
+ value_for<n::on_any>(std::tr1::bind(&handler, std::tr1::ref(out), "any<", "", "", "", "")),
+ value_for<n::on_arrow>(std::tr1::bind(&handler, std::tr1::ref(out), "a<", _1, ", ", _2, ">")),
+ value_for<n::on_error>(std::tr1::bind(&handler, std::tr1::ref(out), "error<", _1, ">", "", "")),
+ value_for<n::on_label>(std::tr1::bind(&handler, std::tr1::ref(out), "label<", _1, "", "", "")),
+ value_for<n::on_pop>(std::tr1::bind(&handler, std::tr1::ref(out), ">", "", "", "", "")),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&handler, std::tr1::ref(out), "EMPTY", "", "", "", "")),
+ value_for<n::on_string>(std::tr1::bind(&handler, std::tr1::ref(out), "s<", _1, ">", "", "")),
+ value_for<n::on_use>(std::tr1::bind(&handler, std::tr1::ref(out), "use<", _1, ", ", "", "")),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(in, callbacks);
TEST_CHECK_EQUAL(out, "any<s<a>s<b>all<s<c>s<d>s<e>>>EMPTY");
}
@@ -91,19 +91,19 @@ namespace test_cases
using namespace std::tr1::placeholders;
std::string in("( ( ) )"), out;
- ELikeDepParserCallbacks callbacks(ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&handler, std::tr1::ref(out), "s<", _1, ">", "", ""))
- (k::on_arrow(), std::tr1::bind(&handler, std::tr1::ref(out), "a<", _1, ", ", _2, ">"))
- (k::on_any(), std::tr1::bind(&handler, std::tr1::ref(out), "any<", "", "", "", ""))
- (k::on_all(), std::tr1::bind(&handler, std::tr1::ref(out), "all<", "", "", "", ""))
- (k::on_use(), std::tr1::bind(&handler, std::tr1::ref(out), "use<", _1, ", ", "", ""))
- (k::on_label(), std::tr1::bind(&handler, std::tr1::ref(out), "label<", _1, "", "", ""))
- (k::on_pop(), std::tr1::bind(&handler, std::tr1::ref(out), ">", "", "", "", ""))
- (k::on_error(), std::tr1::bind(&handler, std::tr1::ref(out), "error<", _1, ">", "", ""))
- (k::on_should_be_empty(), std::tr1::bind(&handler, std::tr1::ref(out), "EMPTY", "", "", "", ""))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), std::tr1::bind(&handle_annotations, std::tr1::ref(out), _1))
- );
+ ELikeDepParserCallbacks callbacks(make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&handler, std::tr1::ref(out), "all<", "", "", "", "")),
+ value_for<n::on_annotations>(std::tr1::bind(&handle_annotations, std::tr1::ref(out), _1)),
+ value_for<n::on_any>(std::tr1::bind(&handler, std::tr1::ref(out), "any<", "", "", "", "")),
+ value_for<n::on_arrow>(std::tr1::bind(&handler, std::tr1::ref(out), "a<", _1, ", ", _2, ">")),
+ value_for<n::on_error>(std::tr1::bind(&handler, std::tr1::ref(out), "error<", _1, ">", "", "")),
+ value_for<n::on_label>(std::tr1::bind(&handler, std::tr1::ref(out), "label<", _1, "", "", "")),
+ value_for<n::on_pop>(std::tr1::bind(&handler, std::tr1::ref(out), ">", "", "", "", "")),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&handler, std::tr1::ref(out), "EMPTY", "", "", "", "")),
+ value_for<n::on_string>(std::tr1::bind(&handler, std::tr1::ref(out), "s<", _1, ">", "", "")),
+ value_for<n::on_use>(std::tr1::bind(&handler, std::tr1::ref(out), "use<", _1, ", ", "", "")),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(in, callbacks);
TEST_CHECK_EQUAL(out, "all<all<>>EMPTY");
}
@@ -118,19 +118,19 @@ namespace test_cases
using namespace std::tr1::placeholders;
std::string in("a [[ first = foo second = [ bar baz ] ]]"), out;
- ELikeDepParserCallbacks callbacks(ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&handler, std::tr1::ref(out), "s<", _1, ">", "", ""))
- (k::on_arrow(), std::tr1::bind(&handler, std::tr1::ref(out), "a<", _1, ", ", _2, ">"))
- (k::on_any(), std::tr1::bind(&handler, std::tr1::ref(out), "any<", "", "", "", ""))
- (k::on_all(), std::tr1::bind(&handler, std::tr1::ref(out), "all<", "", "", "", ""))
- (k::on_use(), std::tr1::bind(&handler, std::tr1::ref(out), "use<", _1, ", ", "", ""))
- (k::on_label(), std::tr1::bind(&handler, std::tr1::ref(out), "label<", _1, "", "", ""))
- (k::on_pop(), std::tr1::bind(&handler, std::tr1::ref(out), ">", "", "", "", ""))
- (k::on_error(), std::tr1::bind(&handler, std::tr1::ref(out), "error<", _1, ">", "", ""))
- (k::on_should_be_empty(), std::tr1::bind(&handler, std::tr1::ref(out), "EMPTY", "", "", "", ""))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), std::tr1::bind(&handle_annotations, std::tr1::ref(out), _1))
- );
+ ELikeDepParserCallbacks callbacks(make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&handler, std::tr1::ref(out), "all<", "", "", "", "")),
+ value_for<n::on_annotations>(std::tr1::bind(&handle_annotations, std::tr1::ref(out), _1)),
+ value_for<n::on_any>(std::tr1::bind(&handler, std::tr1::ref(out), "any<", "", "", "", "")),
+ value_for<n::on_arrow>(std::tr1::bind(&handler, std::tr1::ref(out), "a<", _1, ", ", _2, ">")),
+ value_for<n::on_error>(std::tr1::bind(&handler, std::tr1::ref(out), "error<", _1, ">", "", "")),
+ value_for<n::on_label>(std::tr1::bind(&handler, std::tr1::ref(out), "label<", _1, "", "", "")),
+ value_for<n::on_pop>(std::tr1::bind(&handler, std::tr1::ref(out), ">", "", "", "", "")),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&handler, std::tr1::ref(out), "EMPTY", "", "", "", "")),
+ value_for<n::on_string>(std::tr1::bind(&handler, std::tr1::ref(out), "s<", _1, ">", "", "")),
+ value_for<n::on_use>(std::tr1::bind(&handler, std::tr1::ref(out), "use<", _1, ", ", "", "")),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(in, callbacks);
TEST_CHECK_EQUAL(out, "s<a>[first:foo;second:bar baz;]EMPTY");
}
diff --git a/paludis/elike_package_dep_spec-fwd.hh b/paludis/elike_package_dep_spec-fwd.hh
index 8bdb614..aaf40ae 100644
--- a/paludis/elike_package_dep_spec-fwd.hh
+++ b/paludis/elike_package_dep_spec-fwd.hh
@@ -22,8 +22,6 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/options-fwd.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/util/kc-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/version_operator-fwd.hh>
@@ -38,17 +36,7 @@ namespace paludis
typedef Options<ELikePackageDepSpecOption> ELikePackageDepSpecOptions;
- typedef kc::KeyedClass<
- kc::Field<k::check_sanity, std::tr1::function<void (const std::string &)> >,
- kc::Field<k::remove_trailing_square_bracket_if_exists, std::tr1::function<bool (std::string &, PartiallyMadePackageDepSpec &)> >,
- kc::Field<k::remove_trailing_slot_if_exists, std::tr1::function<void (std::string &, PartiallyMadePackageDepSpec &)> >,
- kc::Field<k::remove_trailing_repo_if_exists, std::tr1::function<void (std::string &, PartiallyMadePackageDepSpec &)> >,
- kc::Field<k::has_version_operator, std::tr1::function<bool (const std::string &)> >,
- kc::Field<k::get_remove_version_operator, std::tr1::function<VersionOperator (std::string &)> >,
- kc::Field<k::get_remove_trailing_version, std::tr1::function<VersionSpec (std::string &)> >,
- kc::Field<k::add_version_requirement, std::tr1::function<void (const VersionOperator &, const VersionSpec &, PartiallyMadePackageDepSpec &)> >,
- kc::Field<k::add_package_requirement, std::tr1::function<void (const std::string &, PartiallyMadePackageDepSpec &)> >
- > GenericELikePackageDepSpecParseFunctions;
+ struct GenericELikePackageDepSpecParseFunctions;
PackageDepSpec parse_generic_elike_package_dep_spec(const std::string & ss, const GenericELikePackageDepSpecParseFunctions & fns)
PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
diff --git a/paludis/elike_package_dep_spec.cc b/paludis/elike_package_dep_spec.cc
index 5d0cb96..96d82e2 100644
--- a/paludis/elike_package_dep_spec.cc
+++ b/paludis/elike_package_dep_spec.cc
@@ -23,7 +23,7 @@
#include <paludis/util/options.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/dep_spec.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
@@ -39,32 +39,32 @@ paludis::partial_parse_generic_elike_package_dep_spec(const std::string & ss, co
Context context("When parsing generic package dep spec '" + ss + "':");
/* Check that it's not, e.g. a set with updso_throw_if_set, or empty. */
- fns[k::check_sanity()](ss);
+ fns.check_sanity()(ss);
std::string s(ss);
PartiallyMadePackageDepSpec result;
/* Remove trailing [use], [version] etc parts. */
- while (fns[k::remove_trailing_square_bracket_if_exists()](s, result))
+ while (fns.remove_trailing_square_bracket_if_exists()(s, result))
{
}
/* Remove trailing ::repo and :slot parts. */
- fns[k::remove_trailing_repo_if_exists()](s, result);
- fns[k::remove_trailing_slot_if_exists()](s, result);
+ fns.remove_trailing_repo_if_exists()(s, result);
+ fns.remove_trailing_slot_if_exists()(s, result);
- if (fns[k::has_version_operator()](s))
+ if (fns.has_version_operator()(s))
{
/* Leading (or maybe =*) operator, so trailing version. */
- VersionOperator op(fns[k::get_remove_version_operator()](s));
- VersionSpec spec(fns[k::get_remove_trailing_version()](s));
- fns[k::add_version_requirement()](op, spec, result);
- fns[k::add_package_requirement()](s, result);
+ VersionOperator op(fns.get_remove_version_operator()(s));
+ VersionSpec spec(fns.get_remove_trailing_version()(s));
+ fns.add_version_requirement()(op, spec, result);
+ fns.add_package_requirement()(s, result);
}
else
{
/* No leading operator, so no version. */
- fns[k::add_package_requirement()](s, result);
+ fns.add_package_requirement()(s, result);
}
return result;
@@ -430,20 +430,19 @@ paludis::partial_parse_elike_package_dep_spec(
bool had_bracket_version_requirements(false);
- return partial_parse_generic_elike_package_dep_spec(ss, GenericELikePackageDepSpecParseFunctions::named_create()
- (k::check_sanity(), &elike_check_sanity)
- (k::remove_trailing_square_bracket_if_exists(), std::tr1::bind(&elike_remove_trailing_square_bracket_if_exists,
- _1, _2, options, std::tr1::ref(had_bracket_version_requirements), id))
- (k::remove_trailing_repo_if_exists(), std::tr1::bind(&elike_remove_trailing_repo_if_exists,
- _1, _2, options))
- (k::remove_trailing_slot_if_exists(), std::tr1::bind(&elike_remove_trailing_slot_if_exists,
- _1, _2, options))
- (k::has_version_operator(), std::tr1::bind(&elike_has_version_operator, _1, std::tr1::cref(had_bracket_version_requirements)))
- (k::get_remove_version_operator(), std::tr1::bind(&elike_get_remove_version_operator, _1, options))
- (k::get_remove_trailing_version(), std::tr1::bind(&elike_get_remove_trailing_version, _1))
- (k::add_version_requirement(), std::tr1::bind(&elike_add_version_requirement, _1, _2, _3))
- (k::add_package_requirement(), std::tr1::bind(&elike_add_package_requirement, _1, _2))
- );
+ return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
+ value_for<n::add_package_requirement>(std::tr1::bind(&elike_add_package_requirement, _1, _2)),
+ value_for<n::add_version_requirement>(std::tr1::bind(&elike_add_version_requirement, _1, _2, _3)),
+ value_for<n::check_sanity>(&elike_check_sanity),
+ value_for<n::get_remove_trailing_version>(std::tr1::bind(&elike_get_remove_trailing_version, _1)),
+ value_for<n::get_remove_version_operator>(std::tr1::bind(&elike_get_remove_version_operator, _1, options)),
+ value_for<n::has_version_operator>(std::tr1::bind(&elike_has_version_operator, _1,
+ std::tr1::cref(had_bracket_version_requirements))),
+ value_for<n::remove_trailing_repo_if_exists>(std::tr1::bind(&elike_remove_trailing_repo_if_exists, _1, _2, options)),
+ value_for<n::remove_trailing_slot_if_exists>(std::tr1::bind(&elike_remove_trailing_slot_if_exists, _1, _2, options)),
+ value_for<n::remove_trailing_square_bracket_if_exists>(std::tr1::bind(&elike_remove_trailing_square_bracket_if_exists,
+ _1, _2, options, std::tr1::ref(had_bracket_version_requirements), id))
+ ));
}
PackageDepSpec
diff --git a/paludis/elike_package_dep_spec.hh b/paludis/elike_package_dep_spec.hh
index 2186d41..97dfd38 100644
--- a/paludis/elike_package_dep_spec.hh
+++ b/paludis/elike_package_dep_spec.hh
@@ -21,10 +21,35 @@
#define PALUDIS_GUARD_PALUDIS_ELIKE_PACKAGE_DEP_SPEC_HH 1
#include <paludis/elike_package_dep_spec-fwd.hh>
+#include <paludis/util/named_value.hh>
namespace paludis
{
+ namespace n
+ {
+ struct add_package_requirement;
+ struct add_version_requirement;
+ struct check_sanity;
+ struct get_remove_trailing_version;
+ struct get_remove_version_operator;
+ struct has_version_operator;
+ struct remove_trailing_repo_if_exists;
+ struct remove_trailing_slot_if_exists;
+ struct remove_trailing_square_bracket_if_exists;
+ }
+ struct GenericELikePackageDepSpecParseFunctions
+ {
+ NamedValue<n::add_package_requirement, std::tr1::function<void (const std::string &, PartiallyMadePackageDepSpec &)> > add_package_requirement;
+ NamedValue<n::add_version_requirement, std::tr1::function<void (const VersionOperator &, const VersionSpec &, PartiallyMadePackageDepSpec &)> > add_version_requirement;
+ NamedValue<n::check_sanity, std::tr1::function<void (const std::string &)> > check_sanity;
+ NamedValue<n::get_remove_trailing_version, std::tr1::function<VersionSpec (std::string &)> > get_remove_trailing_version;
+ NamedValue<n::get_remove_version_operator, std::tr1::function<VersionOperator (std::string &)> > get_remove_version_operator;
+ NamedValue<n::has_version_operator, std::tr1::function<bool (const std::string &)> > has_version_operator;
+ NamedValue<n::remove_trailing_repo_if_exists, std::tr1::function<void (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_repo_if_exists;
+ NamedValue<n::remove_trailing_slot_if_exists, std::tr1::function<void (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_slot_if_exists;
+ NamedValue<n::remove_trailing_square_bracket_if_exists, std::tr1::function<bool (std::string &, PartiallyMadePackageDepSpec &)> > remove_trailing_square_bracket_if_exists;
+ };
}
#endif
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index a0e77a8..cde04cf 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -27,7 +27,6 @@
#include <paludis/util/set.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/system.hh>
-#include <paludis/util/kc.hh>
#include <paludis/hook.hh>
#include <paludis/distribution.hh>
#include <paludis/selection.hh>
@@ -79,8 +78,8 @@ EnvironmentImplementation::default_destinations() const
for (PackageDatabase::RepositoryConstIterator r(package_database()->begin_repositories()),
r_end(package_database()->end_repositories()) ;
r != r_end ; ++r)
- if ((**r)[k::destination_interface()])
- if ((**r)[k::destination_interface()]->is_default_destination())
+ if ((**r).destination_interface())
+ if ((**r).destination_interface()->is_default_destination())
result->insert(*r);
return result;
@@ -111,10 +110,10 @@ EnvironmentImplementation::set(const SetName & s) const
r_end(package_database()->end_repositories()) ;
r != r_end ; ++r)
{
- if (! (**r)[k::sets_interface()])
+ if (! (**r).sets_interface())
continue;
- std::tr1::shared_ptr<SetSpecTree::ConstItem> add((**r)[k::sets_interface()]->package_set(s));
+ std::tr1::shared_ptr<SetSpecTree::ConstItem> add((**r).sets_interface()->package_set(s));
if (add)
{
Log::get_instance()->message("environment_implementation.set_found_in_repository", ll_debug, lc_context)
@@ -144,14 +143,14 @@ EnvironmentImplementation::set(const SetName & s) const
bool
EnvironmentImplementation::query_use(const UseFlagName & f, const PackageID & e) const
{
- if ((*e.repository())[k::use_interface()])
+ if ((*e.repository()).use_interface())
{
- if ((*e.repository())[k::use_interface()]->query_use_mask(f, e))
+ if ((*e.repository()).use_interface()->query_use_mask(f, e))
return false;
- if ((*e.repository())[k::use_interface()]->query_use_force(f, e))
+ if ((*e.repository()).use_interface()->query_use_force(f, e))
return true;
- switch ((*e.repository())[k::use_interface()]->query_use(f, e))
+ switch ((*e.repository()).use_interface()->query_use(f, e))
{
case use_disabled:
case use_unspecified:
@@ -186,7 +185,7 @@ EnvironmentImplementation::set_names() const
bool
EnvironmentImplementation::is_paludis_package(const QualifiedPackageName & n) const
{
- return stringify(n) == (*DistributionData::get_instance()->distribution_from_string(distribution()))[k::paludis_package()];
+ return stringify(n) == (*DistributionData::get_instance()->distribution_from_string(distribution())).paludis_package();
}
std::tr1::shared_ptr<PackageIDSequence>
diff --git a/paludis/environment_maker.cc b/paludis/environment_maker.cc
index 5cd3b4f..335152e 100644
--- a/paludis/environment_maker.cc
+++ b/paludis/environment_maker.cc
@@ -25,7 +25,6 @@
#include <paludis/util/virtual_constructor-impl.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/distribution.hh>
#include <paludis/about.hh>
#include <list>
@@ -153,7 +152,7 @@ EnvironmentMaker::make_from_spec(const std::string & s) const
if (key.empty())
key = (*DistributionData::get_instance()->distribution_from_string(
- getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION)))[k::default_environment()];
+ getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))).default_environment();
try
{
@@ -162,7 +161,7 @@ EnvironmentMaker::make_from_spec(const std::string & s) const
catch (const FallBackToAnotherMakerError &)
{
std::string f((*DistributionData::get_instance()->distribution_from_string(
- getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION)))[k::fallback_environment()]);
+ getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION))).fallback_environment());
if (s.empty() && ! f.empty())
{
std::set<std::string> keys;
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index bf0af42..05557af 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -27,7 +27,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/kc.hh>
#include <paludis/repository_maker.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/config_file.hh>
@@ -223,7 +222,7 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))));
#ifdef ENABLE_VIRTUALS_REPOSITORY
- if ((*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::support_old_style_virtuals()])
+ if ((*DistributionData::get_instance()->distribution_from_string(env->distribution())).support_old_style_virtuals())
package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(env,
std::tr1::bind(from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1)));
#endif
@@ -249,7 +248,7 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env)
iv_keys->insert("root", "/");
#ifdef ENABLE_VIRTUALS_REPOSITORY
- if ((*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::support_old_style_virtuals()])
+ if ((*DistributionData::get_instance()->distribution_from_string(env->distribution())).support_old_style_virtuals())
package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env,
std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
#endif
@@ -264,14 +263,14 @@ NoConfigEnvironment::NoConfigEnvironment(const no_config_environment::Params & p
_imp->initialise(this);
if (_imp->main_repo)
- if ((*_imp->main_repo)[k::e_interface()]->end_profiles() != (*_imp->main_repo)[k::e_interface()]->begin_profiles())
- (*_imp->main_repo)[k::e_interface()]->set_profile((*_imp->main_repo)[k::e_interface()]->begin_profiles());
+ if ((*_imp->main_repo).e_interface()->end_profiles() != (*_imp->main_repo).e_interface()->begin_profiles())
+ (*_imp->main_repo).e_interface()->set_profile((*_imp->main_repo).e_interface()->begin_profiles());
if (_imp->master_repo)
- if ((*_imp->master_repo)[k::e_interface()]->end_profiles() !=
- (*_imp->master_repo)[k::e_interface()]->begin_profiles())
- (*_imp->master_repo)[k::e_interface()]->set_profile(
- (*_imp->master_repo)[k::e_interface()]->begin_profiles());
+ if ((*_imp->master_repo).e_interface()->end_profiles() !=
+ (*_imp->master_repo).e_interface()->begin_profiles())
+ (*_imp->master_repo).e_interface()->set_profile(
+ (*_imp->master_repo).e_interface()->begin_profiles());
add_metadata_key(_imp->format_key);
add_metadata_key(_imp->repository_dir_key);
@@ -352,14 +351,14 @@ NoConfigEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>
if (_imp->is_vdb)
return true;
- std::string accept_keywords_var((*_imp->main_repo)[k::e_interface()]->accept_keywords_variable());
+ std::string accept_keywords_var((*_imp->main_repo).e_interface()->accept_keywords_variable());
std::string ak;
if (! accept_keywords_var.empty())
- ak = (*_imp->main_repo)[k::e_interface()]->profile_variable(accept_keywords_var);
+ ak = (*_imp->main_repo).e_interface()->profile_variable(accept_keywords_var);
if (ak.empty())
{
- std::string arch_var((*_imp->main_repo)[k::e_interface()]->arch_variable());
+ std::string arch_var((*_imp->main_repo).e_interface()->arch_variable());
if (arch_var.empty())
{
@@ -368,7 +367,7 @@ NoConfigEnvironment::accept_keywords(std::tr1::shared_ptr<const KeywordNameSet>
}
else
{
- std::string arch((*_imp->main_repo)[k::e_interface()]->profile_variable(arch_var));
+ std::string arch((*_imp->main_repo).e_interface()->profile_variable(arch_var));
if (keywords->end() != keywords->find(KeywordName(arch)))
return true;
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 7bdc045..302295f 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -44,8 +44,8 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <fstream>
@@ -376,22 +376,22 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
#ifdef ENABLE_VIRTUALS_REPOSITORY
/* add virtuals repositories */
- if ((*DistributionData::get_instance()->distribution_from_string(distribution()))[k::support_old_style_virtuals()])
+ if ((*DistributionData::get_instance()->distribution_from_string(distribution())).support_old_style_virtuals())
{
std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(
new Map<std::string, std::string>);
iv_keys->insert("root", root_prefix.empty() ? "/" : root_prefix);
- _imp->repos.push_back(RepositoryConfigEntry::named_create()
- (k::format(), "installed_virtuals")
- (k::importance(), -1)
- (k::keys(), std::tr1::bind(&from_keys, iv_keys, std::tr1::placeholders::_1))
- );
-
- _imp->repos.push_back(RepositoryConfigEntry::named_create()
- (k::format(), "virtuals")
- (k::importance(), -2)
- (k::keys(), std::tr1::bind(&from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1))
- );
+ _imp->repos.push_back(make_named_values<RepositoryConfigEntry>(
+ value_for<n::format>("installed_virtuals"),
+ value_for<n::importance>(-1),
+ value_for<n::keys>(std::tr1::bind(&from_keys, iv_keys, std::tr1::placeholders::_1))
+ ));
+
+ _imp->repos.push_back(make_named_values<RepositoryConfigEntry>(
+ value_for<n::format>("virtuals"),
+ value_for<n::importance>(-2),
+ value_for<n::keys>(std::tr1::bind(&from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1))
+ ));
}
#endif
@@ -500,21 +500,21 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s
{
Log::get_instance()->message("paludis_environment.repositories.not_delaying", ll_debug, lc_context)
<< "Not delaying '" << *repo_file << "'";
- _imp->repos.push_back(RepositoryConfigEntry::named_create()
- (k::format(), format)
- (k::importance(), importance)
- (k::keys(), repo_func)
- );
+ _imp->repos.push_back(make_named_values<RepositoryConfigEntry>(
+ value_for<n::format>(format),
+ value_for<n::importance>(importance),
+ value_for<n::keys>(repo_func)
+ ));
}
}
for (std::list<std::tr1::function<std::string (const std::string &)> >::const_iterator
k(later_repo_files.begin()), k_end(later_repo_files.end()) ; k != k_end ; ++k)
- _imp->repos.push_back(RepositoryConfigEntry::named_create()
- (k::format(), (*k)("format"))
- (k::importance(), destringify<int>((*k)("importance")))
- (k::keys(), *k)
- );
+ _imp->repos.push_back(make_named_values<RepositoryConfigEntry>(
+ value_for<n::format>((*k)("format")),
+ value_for<n::importance>(destringify<int>((*k)("importance"))),
+ value_for<n::keys>(*k)
+ ));
if (_imp->repos.empty())
throw PaludisConfigError("No repositories specified");
diff --git a/paludis/environments/paludis/paludis_config.hh b/paludis/environments/paludis/paludis_config.hh
index dadce73..6b8b76e 100644
--- a/paludis/environments/paludis/paludis_config.hh
+++ b/paludis/environments/paludis/paludis_config.hh
@@ -28,6 +28,7 @@
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/map-fwd.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/environment_maker.hh>
#include <string>
@@ -42,6 +43,13 @@ namespace paludis
{
struct PaludisEnvironment;
+ namespace n
+ {
+ struct format;
+ struct importance;
+ struct keys;
+ }
+
namespace paludis_environment
{
struct KeywordsConf;
@@ -51,11 +59,12 @@ namespace paludis
struct MirrorsConf;
struct World;
- typedef kc::KeyedClass<
- kc::Field<k::format, std::string>,
- kc::Field<k::importance, int>,
- kc::Field<k::keys, std::tr1::function<std::string (const std::string &)> >
- > RepositoryConfigEntry;
+ struct RepositoryConfigEntry
+ {
+ NamedValue<n::format, std::string> format;
+ NamedValue<n::importance, int> importance;
+ NamedValue<n::keys, std::tr1::function<std::string (const std::string &)> > keys;
+ };
/**
* A PaludisConfigError is thrown if a configuration error is encountered
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 7aed93b..d260469 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -151,8 +151,8 @@ PaludisEnvironment::PaludisEnvironment(const std::string & s) :
for (PaludisConfig::RepositoryConstIterator r(_imp->config->begin_repositories()),
r_end(_imp->config->end_repositories()) ; r != r_end ; ++r)
- _imp->package_database->add_repository((*r)[k::importance()],
- RepositoryMaker::get_instance()->find_maker((*r)[k::format()])(this, (*r)[k::keys()]));
+ _imp->package_database->add_repository((*r).importance(),
+ RepositoryMaker::get_instance()->find_maker((*r).format())(this, (*r).keys()));
add_metadata_key(_imp->format_key);
add_metadata_key(_imp->config_location_key);
@@ -171,11 +171,11 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
"' in Paludis environment:");
/* first check package database use masks... */
- if ((*e.repository())[k::use_interface()])
+ if ((*e.repository()).use_interface())
{
- if ((*e.repository())[k::use_interface()]->query_use_mask(f, e))
+ if ((*e.repository()).use_interface()->query_use_mask(f, e))
return false;
- if ((*e.repository())[k::use_interface()]->query_use_force(f, e))
+ if ((*e.repository()).use_interface()->query_use_force(f, e))
return true;
}
@@ -200,9 +200,9 @@ PaludisEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
} while (false);
/* check use: package database config */
- if ((*e.repository())[k::use_interface()])
+ if ((*e.repository()).use_interface())
{
- switch ((*e.repository())[k::use_interface()]->query_use(f, e))
+ switch ((*e.repository()).use_interface()->query_use(f, e))
{
case use_disabled:
case use_unspecified:
diff --git a/paludis/environments/paludis/use_conf.cc b/paludis/environments/paludis/use_conf.cc
index af10d18..5297510 100644
--- a/paludis/environments/paludis/use_conf.cc
+++ b/paludis/environments/paludis/use_conf.cc
@@ -206,9 +206,9 @@ UseConf::query(const UseFlagName & f, const PackageID & e) const
UseFlagState result(use_unspecified);
bool ignore_empty_minus_star(false);
- if ((*e.repository())[k::use_interface()])
+ if ((*e.repository()).use_interface())
{
- std::tr1::shared_ptr<const UseFlagNameSet> prefixes((*e.repository())[k::use_interface()]->use_expand_prefixes());
+ std::tr1::shared_ptr<const UseFlagNameSet> prefixes((*e.repository()).use_interface()->use_expand_prefixes());
for (UseFlagNameSet::ConstIterator p(prefixes->begin()), p_end(prefixes->end()) ;
p != p_end ; ++p)
if (0 == p->data().compare(0, p->data().length(), stringify(f), 0, p->data().length()))
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index ceddf6b..cadb039 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -557,19 +557,19 @@ PortageEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
"' in Portage environment:");
/* first check package database use masks... */
- if ((*e.repository())[k::use_interface()])
+ if ((*e.repository()).use_interface())
{
- if ((*e.repository())[k::use_interface()]->query_use_mask(f, e))
+ if ((*e.repository()).use_interface()->query_use_mask(f, e))
return false;
- if ((*e.repository())[k::use_interface()]->query_use_force(f, e))
+ if ((*e.repository()).use_interface()->query_use_force(f, e))
return true;
}
UseFlagState state(use_unspecified);
/* check use: repo */
- if ((*e.repository())[k::use_interface()])
- state = (*e.repository())[k::use_interface()]->query_use(f, e);
+ if ((*e.repository()).use_interface())
+ state = (*e.repository()).use_interface()->query_use(f, e);
/* check use: general user config */
for (std::list<std::string>::const_iterator i(_imp->use_with_expands.begin()), i_end(_imp->use_with_expands.end()) ;
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 1b2a064..f572a45 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -705,17 +705,17 @@ Hooker::perform_hook(const Hook & hook) const
case hod_stdout:
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((**r)[k::hook_interface()])
+ if ((**r).hook_interface())
result.max_exit_status = std::max(result.max_exit_status,
- ((**r)[k::hook_interface()]->perform_hook(hook)).max_exit_status);
+ ((**r).hook_interface()->perform_hook(hook)).max_exit_status);
continue;
case hod_grab:
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((**r)[k::hook_interface()])
+ if ((**r).hook_interface())
{
- HookResult tmp((**r)[k::hook_interface()]->perform_hook(hook));
+ HookResult tmp((**r).hook_interface()->perform_hook(hook));
if (tmp > result)
result = tmp;
else if (! tmp.output.empty())
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index ebc0a88..683b399 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -42,9 +42,9 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/handled_information.hh>
#include <tr1/functional>
#include <sstream>
@@ -92,16 +92,16 @@ namespace paludis
env(e),
dep_list(e, o),
fetch_options(
- FetchActionOptions::named_create()
- (k::safe_resume(), false)
- (k::fetch_unneeded(), false)
- ),
+ make_named_values<FetchActionOptions>(
+ value_for<n::fetch_unneeded>(false),
+ value_for<n::safe_resume>(false)
+ )),
install_options(
- InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), std::tr1::shared_ptr<Repository>())
- ),
+ make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(std::tr1::shared_ptr<Repository>())
+ )),
targets(new ConstTreeSequence<SetSpecTree, AllDepSpec>(std::tr1::shared_ptr<AllDepSpec>(new AllDepSpec))),
destinations(d),
pretend(false),
@@ -656,7 +656,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
bool live_destination(false);
if (dep->destination)
- if ((*dep->destination)[k::destination_interface()] && (*dep->destination)[k::destination_interface()]->want_pre_post_phases())
+ if ((*dep->destination).destination_interface() && (*dep->destination).destination_interface()->want_pre_post_phases())
live_destination = true;
if (already_done(*dep))
@@ -696,7 +696,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
if (! _imp->fetch_only)
{
- _imp->install_options[k::destination()] = dep->destination;
+ _imp->install_options.destination() = dep->destination;
InstallAction install_action(_imp->install_options);
dep->package_id->perform_action(install_action);
}
@@ -844,7 +844,7 @@ InstallTask::_main_actions()
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end && ! any_live_destination ; ++dep)
if (dlk_package == dep->kind && dep->destination)
- if ((*dep->destination)[k::destination_interface()] && (*dep->destination)[k::destination_interface()]->want_pre_post_phases())
+ if ((*dep->destination).destination_interface() && (*dep->destination).destination_interface()->want_pre_post_phases())
any_live_destination = true;
if (0 != perform_hook(Hook("install_all_pre")
@@ -1130,13 +1130,13 @@ InstallTask::set_preserve_world(const bool value)
void
InstallTask::set_debug_mode(const InstallActionDebugOption value)
{
- _imp->install_options[k::debug_build()] = value;
+ _imp->install_options.debug_build() = value;
}
void
InstallTask::set_checks_mode(const InstallActionChecksOption value)
{
- _imp->install_options[k::checks()] = value;
+ _imp->install_options.checks() = value;
}
void
@@ -1177,7 +1177,7 @@ InstallTask::on_installed_paludis()
void
InstallTask::set_safe_resume(const bool value)
{
- _imp->fetch_options[k::safe_resume()] = value;
+ _imp->fetch_options.safe_resume() = value;
}
HookResult
diff --git a/paludis/mask-fwd.hh b/paludis/mask-fwd.hh
index ce9a054..6bb8386 100644
--- a/paludis/mask-fwd.hh
+++ b/paludis/mask-fwd.hh
@@ -20,12 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_MASK_FWD_HH
#define PALUDIS_GUARD_PALUDIS_MASK_FWD_HH 1
-#include <paludis/util/visitor-fwd.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/util/fs_entry-fwd.hh>
-#include <tr1/memory>
-
/** \file
* Forward declarations for paludis/mask.hh .
*
@@ -43,21 +37,7 @@ namespace paludis
class MaskVisitorTypes;
- /**
- * Information about a RepositoryMask.
- *
- * The mask_file key holds the file whence the mask originates.
- *
- * The comment key is a sequence of lines explaining the mask.
- *
- * \ingroup g_package_id
- * \since 0.26
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::mask_file, FSEntry>,
- kc::Field<k::comment, std::tr1::shared_ptr<const Sequence<std::string> > >
- > RepositoryMaskInfo;
+ struct RepositoryMaskInfo;
}
#endif
diff --git a/paludis/mask.hh b/paludis/mask.hh
index f84a814..3807463 100644
--- a/paludis/mask.hh
+++ b/paludis/mask.hh
@@ -27,6 +27,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/sequence-fwd.hh>
+#include <paludis/util/named_value.hh>
#include <string>
/** \file
@@ -41,6 +42,29 @@
namespace paludis
{
+ namespace n
+ {
+ struct comment;
+ struct mask_file;
+ }
+
+ /**
+ * Information about a RepositoryMask.
+ *
+ * The mask_file key holds the file whence the mask originates.
+ *
+ * The comment key is a sequence of lines explaining the mask.
+ *
+ * \ingroup g_package_id
+ * \since 0.30
+ * \nosubgrouping
+ */
+ struct RepositoryMaskInfo
+ {
+ NamedValue<n::comment, std::tr1::shared_ptr<const Sequence<std::string> > > comment;
+ NamedValue<n::mask_file, FSEntry> mask_file;
+ };
+
/**
* Types for a visitor that can visit a Mask subclass.
*
diff --git a/paludis/merger-fwd.hh b/paludis/merger-fwd.hh
index 5fda85e..825e566 100644
--- a/paludis/merger-fwd.hh
+++ b/paludis/merger-fwd.hh
@@ -23,8 +23,6 @@
#include <iosfwd>
#include <paludis/util/attributes.hh>
#include <paludis/util/options-fwd.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/environment-fwd.hh>
#include <tr1/functional>
@@ -55,24 +53,7 @@ namespace paludis
*/
typedef Options<MergeStatusFlag> MergeStatusFlags;
- /**
- * Parameters for a basic Merger.
- *
- * \see Merger
- * \ingroup g_repository
- * \nosubgrouping
- * \since 0.26
- */
- typedef kc::KeyedClass<
- kc::Field<k::environment, Environment *>,
- kc::Field<k::image, FSEntry>,
- kc::Field<k::root, FSEntry>,
- kc::Field<k::no_chown, bool>,
- kc::Field<k::options, MergerOptions>,
- kc::Field<k::install_under, FSEntry>,
- kc::Field<k::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> >
- > MergerParams;
-
+ class MergerParams;
class MergerError;
class Merger;
}
diff --git a/paludis/merger.cc b/paludis/merger.cc
index d7adab2..460d167 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -87,21 +87,21 @@ Merger::~Merger()
bool
Merger::check()
{
- Context context("When checking merge from '" + stringify(_imp->params[k::image()]) + "' to '"
- + stringify(_imp->params[k::root()]) + "':");
+ Context context("When checking merge from '" + stringify(_imp->params.image()) + "' to '"
+ + stringify(_imp->params.root()) + "':");
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_pre")
- ("INSTALL_SOURCE", stringify(_imp->params[k::image()]))
- ("INSTALL_DESTINATION", stringify(_imp->params[k::root()])))).max_exit_status)
+ ("INSTALL_SOURCE", stringify(_imp->params.image()))
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
make_check_fail();
- do_dir_recursive(true, _imp->params[k::image()], _imp->params[k::root()] / _imp->params[k::install_under()]);
+ do_dir_recursive(true, _imp->params.image(), _imp->params.root() / _imp->params.install_under());
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_post")
- ("INSTALL_SOURCE", stringify(_imp->params[k::image()]))
- ("INSTALL_DESTINATION", stringify(_imp->params[k::root()])))).max_exit_status)
+ ("INSTALL_SOURCE", stringify(_imp->params.image()))
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
make_check_fail();
return _imp->result;
@@ -116,8 +116,8 @@ Merger::make_check_fail()
void
Merger::merge()
{
- Context context("When performing merge from '" + stringify(_imp->params[k::image()]) + "' to '"
- + stringify(_imp->params[k::root()]) + "':");
+ Context context("When performing merge from '" + stringify(_imp->params.image()) + "' to '"
+ + stringify(_imp->params.root()) + "':");
struct SaveUmask
{
@@ -134,20 +134,20 @@ Merger::merge()
}
} old_umask(::umask(0000));
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_pre")
- ("INSTALL_SOURCE", stringify(_imp->params[k::image()]))
- ("INSTALL_DESTINATION", stringify(_imp->params[k::root()])))).max_exit_status)
+ ("INSTALL_SOURCE", stringify(_imp->params.image()))
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
Log::get_instance()->message("merger.pre_hooks.failure", ll_warning, lc_context) <<
- "Merge of '" << _imp->params[k::image()] << "' to '" << _imp->params[k::root()] << "' pre hooks returned non-zero";
+ "Merge of '" << _imp->params.image() << "' to '" << _imp->params.root() << "' pre hooks returned non-zero";
/* special handling for install_under */
{
- Context local_context("When preparing install_under directory '" + stringify(_imp->params[k::install_under()]) + "' under root '"
- + stringify(_imp->params[k::root()]) + "':");
+ Context local_context("When preparing install_under directory '" + stringify(_imp->params.install_under()) + "' under root '"
+ + stringify(_imp->params.root()) + "':");
std::list<FSEntry> dd;
- for (FSEntry d(_imp->params[k::root()].realpath() / _imp->params[k::install_under()]), d_end(_imp->params[k::root()].realpath()) ;
+ for (FSEntry d(_imp->params.root().realpath() / _imp->params.install_under()), d_end(_imp->params.root().realpath()) ;
d != d_end ; d = d.dirname())
dd.push_front(d);
for (std::list<FSEntry>::iterator d(dd.begin()), d_end(dd.end()) ; d != d_end ; ++d)
@@ -160,17 +160,17 @@ Merger::merge()
record_install_under_dir(*d, MergeStatusFlags() + msi_used_existing);
}
- if (! _imp->params[k::no_chown()])
- do_ownership_fixes_recursive(_imp->params[k::image()]);
+ if (! _imp->params.no_chown())
+ do_ownership_fixes_recursive(_imp->params.image());
- do_dir_recursive(false, _imp->params[k::image()], (_imp->params[k::root()] / _imp->params[k::install_under()]).realpath());
+ do_dir_recursive(false, _imp->params.image(), (_imp->params.root() / _imp->params.install_under()).realpath());
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_post")
- ("INSTALL_SOURCE", stringify(_imp->params[k::image()]))
- ("INSTALL_DESTINATION", stringify(_imp->params[k::root()])))).max_exit_status)
+ ("INSTALL_SOURCE", stringify(_imp->params.image()))
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
Log::get_instance()->message("merger.post_hooks.failure", ll_warning, lc_context) <<
- "Merge of '" << _imp->params[k::image()] << "' to '" << _imp->params[k::root()] << "' post hooks returned non-zero";
+ "Merge of '" << _imp->params.image() << "' to '" << _imp->params.root() << "' post hooks returned non-zero";
}
EntryType
@@ -208,9 +208,9 @@ Merger::do_dir_recursive(bool is_check, const FSEntry & src, const FSEntry & dst
DirIterator d(src, DirIteratorOptions() + dio_include_dotfiles + dio_inode_sort), d_end;
- if (is_check && d == d_end && dst != _imp->params[k::root()].realpath())
+ if (is_check && d == d_end && dst != _imp->params.root().realpath())
{
- if (_imp->params[k::options()][mo_allow_empty_dirs])
+ if (_imp->params.options()[mo_allow_empty_dirs])
Log::get_instance()->message("merger.empty_directory", ll_warning, lc_context) << "Installing empty directory '"
<< stringify(dst) << "'";
else
@@ -265,7 +265,7 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
EntryType m(entry_type(dst / src.basename()));
if (is_check &&
- 0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ 0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_file_pre")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
@@ -273,7 +273,7 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
if (! is_check)
{
- HookResult hr(_imp->params[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_file_override")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename()))
@@ -284,7 +284,7 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
<< stringify(src) << "' to '" << stringify(dst) << "' skip hooks returned non-zero";
else if (hr.output == "skip")
{
- std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params[k::root()].realpath())));
+ std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params.root().realpath())));
display_override("--- [skp] " + tidy);
return;
}
@@ -322,7 +322,7 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
} while (false);
if (is_check &&
- 0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ 0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_file_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
@@ -337,7 +337,7 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
EntryType m(entry_type(dst / src.basename()));
if (is_check &&
- 0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ 0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_dir_pre")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
@@ -345,7 +345,7 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
if (! is_check)
{
- HookResult hr(_imp->params[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_dir_override")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename()))
@@ -356,7 +356,7 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
<< stringify(src) << "' to '" << stringify(dst) << "' skip hooks returned non-zero";
else if (hr.output == "skip")
{
- std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params[k::root()].realpath())));
+ std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params.root().realpath())));
display_override("--- [skp] " + tidy);
_imp->skip_dir = true;
return;
@@ -396,7 +396,7 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
} while (false);
if (is_check &&
- 0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ 0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_dir_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
@@ -411,7 +411,7 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
EntryType m(entry_type(dst / src.basename()));
if (is_check &&
- 0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ 0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_sym_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
@@ -419,7 +419,7 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
if (! is_check)
{
- HookResult hr(_imp->params[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_sym_override")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename()))
@@ -430,14 +430,14 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
<< stringify(src) << "' to '" << stringify(dst) << "' skip hooks returned non-zero";
else if (hr.output == "skip")
{
- std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params[k::root()].realpath())));
+ std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params.root().realpath())));
display_override("--- [skp] " + tidy);
return;
}
}
else
{
- if (symlink_needs_rewriting(src) && ! _imp->params[k::options()][mo_rewrite_symlinks])
+ if (symlink_needs_rewriting(src) && ! _imp->params.options()[mo_rewrite_symlinks])
on_error(is_check, "Symlink to image detected at: " + stringify(src) + " (" + src.readlink() + ")");
}
@@ -473,7 +473,7 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
} while (false);
if (is_check &&
- 0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ 0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_sym_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
@@ -659,7 +659,7 @@ Merger::do_ownership_fixes_recursive(const FSEntry & dir)
{
for (DirIterator d(dir, DirIteratorOptions() + dio_include_dotfiles + dio_inode_sort), d_end ; d != d_end ; ++d)
{
- std::pair<uid_t, gid_t> new_ids(_imp->params[k::get_new_ids_or_minus_one()](*d));
+ std::pair<uid_t, gid_t> new_ids(_imp->params.get_new_ids_or_minus_one()(*d));
if (uid_t(-1) != new_ids.first || gid_t(-1) != new_ids.second)
{
FSEntry f(*d);
@@ -720,7 +720,7 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
if (dst_real.is_regular_file())
dst_real.chmod(0);
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_file_pre")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst_dir / src.basename()))
@@ -786,7 +786,7 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
if (-1 == output_fd)
throw MergerError("Cannot write '" + stringify(dst) + "': " + stringify(::strerror(errno)));
- if (! _imp->params[k::no_chown()])
+ if (! _imp->params.no_chown())
if (0 != ::fchown(output_fd, src.owner(), src.group()))
throw MergerError("Cannot fchown '" + stringify(dst) + "': " + stringify(::strerror(errno)));
@@ -813,7 +813,7 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
if (_imp->fixed_entries.end() != _imp->fixed_entries.find(src))
result += msi_fixed_ownership;
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_file_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst_dir / src.basename()))
@@ -828,7 +828,7 @@ bool
Merger::symlink_needs_rewriting(const FSEntry & sym)
{
std::string target(sym.readlink());
- std::string real_image(stringify(_imp->params[k::image()].realpath()));
+ std::string real_image(stringify(_imp->params.image().realpath()));
return (0 == target.compare(0, real_image.length(), real_image));
}
@@ -841,7 +841,7 @@ Merger::rewrite_symlink_as_needed(const FSEntry & src, const FSEntry & dst_dir)
FSCreateCon createcon(MatchPathCon::get_instance()->match(stringify(dst_dir / src.basename()), S_IFLNK));
- FSEntry real_image(_imp->params[k::image()].realpath());
+ FSEntry real_image(_imp->params.image().realpath());
FSEntry dst(src.readlink());
std::string fixed_dst(stringify(dst.strip_leading(real_image)));
@@ -859,7 +859,7 @@ Merger::record_renamed_dir_recursive(const FSEntry & dst)
for (DirIterator d(dst, DirIteratorOptions() + dio_include_dotfiles + dio_inode_sort), d_end ; d != d_end ; ++d)
{
MergeStatusFlags merged_how;
- if (_imp->fixed_entries.end() != _imp->fixed_entries.find(_imp->params[k::image()] / *d))
+ if (_imp->fixed_entries.end() != _imp->fixed_entries.find(_imp->params.image() / *d))
merged_how += msi_fixed_ownership;
EntryType m(entry_type(*d));
switch (m)
@@ -921,7 +921,7 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
MergeStatusFlags result;
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_dir_pre")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst_dir / src.basename())))).max_exit_status)
@@ -964,7 +964,7 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
+ stringify(dst) + "' that we just created: " + stringify(::strerror(errno)));
if ( !S_ISDIR(sb.st_mode))
throw MergerError("The directory that we just created is not a directory anymore");
- if (! _imp->params[k::no_chown()])
+ if (! _imp->params.no_chown())
::fchown(dst_fd, src.owner(), src.group());
/* pick up set*id bits */
::fchmod(dst_fd, mode);
@@ -974,7 +974,7 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
if (_imp->fixed_entries.end() != _imp->fixed_entries.find(src))
result += msi_fixed_ownership;
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_dir_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst_dir / src.basename())))).max_exit_status)
@@ -993,7 +993,7 @@ Merger::install_sym(const FSEntry & src, const FSEntry & dst_dir)
FSEntry dst(dst_dir / src.basename());
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_sym_pre")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst)))).max_exit_status)
@@ -1036,14 +1036,14 @@ Merger::install_sym(const FSEntry & src, const FSEntry & dst_dir)
_imp->merged_ids.insert(make_pair(src.lowlevel_id(), stringify(dst)));
}
- if (! _imp->params[k::no_chown()])
+ if (! _imp->params.no_chown())
{
dst.lchown(src.owner(), src.group());
if (_imp->fixed_entries.end() != _imp->fixed_entries.find(src))
result += msi_fixed_ownership;
}
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_sym_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst)))).max_exit_status)
@@ -1056,7 +1056,7 @@ Merger::install_sym(const FSEntry & src, const FSEntry & dst_dir)
void
Merger::unlink_file(FSEntry d)
{
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_file_pre")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_file.pre_hooks.failure", ll_warning, lc_context) <<
@@ -1065,7 +1065,7 @@ Merger::unlink_file(FSEntry d)
d.chmod(0);
d.unlink();
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_file_post")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_file.post_hooks.failure", ll_warning, lc_context) <<
@@ -1075,7 +1075,7 @@ Merger::unlink_file(FSEntry d)
void
Merger::unlink_sym(FSEntry d)
{
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_sym_pre")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_sym.pre_hooks.failure", ll_warning, lc_context) <<
@@ -1083,7 +1083,7 @@ Merger::unlink_sym(FSEntry d)
d.unlink();
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_sym_post")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_sym.post_hooks.failure", ll_warning, lc_context) <<
@@ -1093,7 +1093,7 @@ Merger::unlink_sym(FSEntry d)
void
Merger::unlink_dir(FSEntry d)
{
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_dir_pre")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_dir.pre_hooks.failure", ll_warning, lc_context) <<
@@ -1101,7 +1101,7 @@ Merger::unlink_dir(FSEntry d)
d.rmdir();
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_dir_post")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_dir.post_hooks.failure", ll_warning, lc_context) <<
@@ -1111,7 +1111,7 @@ Merger::unlink_dir(FSEntry d)
void
Merger::unlink_misc(FSEntry d)
{
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_misc_pre")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_misc.pre_hooks.failure", ll_warning, lc_context) <<
@@ -1119,7 +1119,7 @@ Merger::unlink_misc(FSEntry d)
d.unlink();
- if (0 != _imp->params[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_misc_post")
("UNLINK_TARGET", stringify(d)))).max_exit_status)
Log::get_instance()->message("merger.unlink_misc.post_hooks.failure", ll_warning, lc_context) <<
@@ -1130,8 +1130,8 @@ Hook
Merger::extend_hook(const Hook & h)
{
return h
- ("ROOT", stringify(_imp->params[k::root()]))
- ("IMAGE", stringify(_imp->params[k::image()]));
+ ("ROOT", stringify(_imp->params.root()))
+ ("IMAGE", stringify(_imp->params.image()));
}
#ifdef HAVE_XATTRS
diff --git a/paludis/merger.hh b/paludis/merger.hh
index ef48fb0..591f3b9 100644
--- a/paludis/merger.hh
+++ b/paludis/merger.hh
@@ -24,7 +24,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/options.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/merger_entry_type.hh>
#include <iosfwd>
#include <sys/stat.h>
@@ -46,6 +46,36 @@ namespace paludis
class Environment;
class Hook;
+ namespace n
+ {
+ struct environment;
+ struct get_new_ids_or_minus_one;
+ struct image;
+ struct install_under;
+ struct no_chown;
+ struct options;
+ struct root;
+ }
+
+ /**
+ * Parameters for a basic Merger.
+ *
+ * \see Merger
+ * \ingroup g_repository
+ * \nosubgrouping
+ * \since 0.30
+ */
+ struct MergerParams
+ {
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> > get_new_ids_or_minus_one;
+ NamedValue<n::image, FSEntry> image;
+ NamedValue<n::install_under, FSEntry> install_under;
+ NamedValue<n::no_chown, bool> no_chown;
+ NamedValue<n::options, MergerOptions> options;
+ NamedValue<n::root, FSEntry> root;
+ };
+
/**
* Thrown if an error occurs during a Merger operation.
*
diff --git a/paludis/merger_TEST.cc b/paludis/merger_TEST.cc
index 034be95..5503966 100644
--- a/paludis/merger_TEST.cc
+++ b/paludis/merger_TEST.cc
@@ -22,6 +22,7 @@
#include <paludis/hooker.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/hook.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -161,14 +162,15 @@ namespace
root_dir("merger_TEST_dir/" + stringify(src_type) + "_over_" + stringify(dst_type)
+ (0 == n ? "" : "_" + stringify(n)) + "_dir/root"),
env(FSEntry("merger_TEST_dir/hooks")),
- merger(MergerParams::named_create()
- (k::image(), image_dir)
- (k::root(), root_dir)
- (k::install_under(), FSEntry("/"))
- (k::environment(), &env)
- (k::no_chown(), true)
- (k::get_new_ids_or_minus_one(), &get_new_ids_or_minus_one)
- (k::options(), MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs))
+ merger(make_named_values<MergerParams>(
+ value_for<n::environment>(&env),
+ value_for<n::get_new_ids_or_minus_one>(&get_new_ids_or_minus_one),
+ value_for<n::image>(image_dir),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::no_chown>(true),
+ value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
+ value_for<n::root>(root_dir)
+ ))
{
}
@@ -177,14 +179,15 @@ namespace
image_dir("merger_TEST_dir/" + custom_test + "/image"),
root_dir("merger_TEST_dir/" + custom_test + "/root"),
env(FSEntry("merger_TEST_dir/hooks")),
- merger(MergerParams::named_create()
- (k::image(), image_dir)
- (k::root(), root_dir)
- (k::install_under(), FSEntry("/"))
- (k::environment(), &env)
- (k::no_chown(), true)
- (k::get_new_ids_or_minus_one(), &get_new_ids_or_minus_one)
- (k::options(), o))
+ merger(make_named_values<MergerParams>(
+ value_for<n::environment>(&env),
+ value_for<n::get_new_ids_or_minus_one>(&get_new_ids_or_minus_one),
+ value_for<n::image>(image_dir),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::no_chown>(true),
+ value_for<n::options>(o),
+ value_for<n::root>(root_dir)
+ ))
{
}
};
diff --git a/paludis/ndbam-fwd.hh b/paludis/ndbam-fwd.hh
index 1fe2435..fcdc85e 100644
--- a/paludis/ndbam-fwd.hh
+++ b/paludis/ndbam-fwd.hh
@@ -21,27 +21,12 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_NDBAM_FWD_HH 1
#include <paludis/util/sequence-fwd.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/util/fs_entry-fwd.hh>
-#include <paludis/util/mutex-fwd.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/version_spec-fwd.hh>
-#include <paludis/package_id-fwd.hh>
+#include <tr1/memory>
namespace paludis
{
class NDBAM;
-
- typedef kc::KeyedClass<
- kc::Field<k::name, QualifiedPackageName>,
- kc::Field<k::version, VersionSpec>,
- kc::Field<k::slot, SlotName>,
- kc::Field<k::fs_location, FSEntry>,
- kc::Field<k::magic, std::string>,
- kc::Field<k::package_id, std::tr1::shared_ptr<PackageID> >,
- kc::Field<k::mutex, std::tr1::shared_ptr<Mutex> >
- > NDBAMEntry;
+ struct NDBAMEntry;
typedef Sequence<std::tr1::shared_ptr<NDBAMEntry> > NDBAMEntrySequence;
}
diff --git a/paludis/ndbam.cc b/paludis/ndbam.cc
index d00bde0..db0d7a5 100644
--- a/paludis/ndbam.cc
+++ b/paludis/ndbam.cc
@@ -27,8 +27,8 @@
#include <paludis/util/log.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/config_file.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/ndbam.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
@@ -274,7 +274,7 @@ namespace
{
bool operator() (const std::tr1::shared_ptr<const NDBAMEntry> & a, const std::tr1::shared_ptr<const NDBAMEntry> & b) const
{
- return (*a)[k::version()] < (*b)[k::version()];
+ return (*a).version() < (*b).version();
}
};
}
@@ -325,14 +325,15 @@ NDBAM::entries(const QualifiedPackageName & q)
VersionSpec v(tokens[0]);
SlotName s(tokens[1]);
std::string m(tokens[2]);
- pc.entries->push_back(make_shared_ptr(new NDBAMEntry(NDBAMEntry::named_create()
- (k::name(), q)
- (k::version(), v)
- (k::slot(), s)
- (k::fs_location(), d->realpath())
- (k::package_id(), std::tr1::shared_ptr<PackageID>())
- (k::magic(), m)
- (k::mutex(), make_shared_ptr(new Mutex)))));
+ pc.entries->push_back(make_shared_ptr(new NDBAMEntry(NDBAMEntry(make_named_values<NDBAMEntry>(
+ value_for<n::fs_location>(d->realpath()),
+ value_for<n::magic>(m),
+ value_for<n::mutex>(make_shared_ptr(new Mutex)),
+ value_for<n::name>(q),
+ value_for<n::package_id>(std::tr1::shared_ptr<PackageID>()),
+ value_for<n::slot>(s),
+ value_for<n::version>(v)
+ )))));
}
catch (const InternalError &)
{
diff --git a/paludis/ndbam.hh b/paludis/ndbam.hh
index 05b73e8..5b70e63 100644
--- a/paludis/ndbam.hh
+++ b/paludis/ndbam.hh
@@ -26,6 +26,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/mutex.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/package_id-fwd.hh>
@@ -34,6 +35,28 @@
namespace paludis
{
+ namespace n
+ {
+ struct fs_location;
+ struct magic;
+ struct mutex;
+ struct name;
+ struct package_id;
+ struct slot;
+ struct version;
+ }
+
+ struct NDBAMEntry
+ {
+ NamedValue<n::fs_location, FSEntry> fs_location;
+ NamedValue<n::magic, std::string> magic;
+ NamedValue<n::mutex, std::tr1::shared_ptr<Mutex> > mutex;
+ NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::package_id, std::tr1::shared_ptr<PackageID> > package_id;
+ NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::version, VersionSpec> version;
+ };
+
/**
* NDBAM provides a partial implementation of a Repository for installed packages using
* a Paludis-defined on-disk format. It is used by unpackaged repositories and exndbam,
diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc
index 81dbfa6..161f804 100644
--- a/paludis/ndbam_merger.cc
+++ b/paludis/ndbam_merger.cc
@@ -27,6 +27,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/util/md5.hh>
@@ -54,23 +55,24 @@ namespace paludis
Implementation(const NDBAMMergerParams & p) :
params(p),
- realroot(params[k::root()].realpath())
+ realroot(params.root().realpath())
{
- tokenise_whitespace(p[k::config_protect()], std::back_inserter(config_protect));
- tokenise_whitespace(p[k::config_protect_mask()], std::back_inserter(config_protect_mask));
+ tokenise_whitespace(p.config_protect(), std::back_inserter(config_protect));
+ tokenise_whitespace(p.config_protect_mask(), std::back_inserter(config_protect_mask));
}
};
}
NDBAMMerger::NDBAMMerger(const NDBAMMergerParams & p) :
- Merger(MergerParams::named_create()
- (k::environment(), p[k::environment()])
- (k::image(), p[k::image()])
- (k::root(), p[k::root()])
- (k::no_chown(), ! getenv_with_default("PALUDIS_NO_CHOWN", "").empty())
- (k::install_under(), p[k::install_under()])
- (k::get_new_ids_or_minus_one(), p[k::get_new_ids_or_minus_one()])
- (k::options(), p[k::options()])),
+ Merger(make_named_values<MergerParams>(
+ value_for<n::environment>(p.environment()),
+ value_for<n::get_new_ids_or_minus_one>(p.get_new_ids_or_minus_one()),
+ value_for<n::image>(p.image()),
+ value_for<n::install_under>(p.install_under()),
+ value_for<n::no_chown>(! getenv_with_default("PALUDIS_NO_CHOWN", "").empty()),
+ value_for<n::options>(p.options()),
+ value_for<n::root>(p.root())
+ )),
PrivateImplementationPattern<NDBAMMerger>(new Implementation<NDBAMMerger>(p)),
_imp(PrivateImplementationPattern<NDBAMMerger>::_imp)
{
@@ -83,33 +85,33 @@ NDBAMMerger::~NDBAMMerger()
Hook
NDBAMMerger::extend_hook(const Hook & h)
{
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->params[k::environment()]->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->params.environment()->bashrc_files());
- if (_imp->params[k::package_id()])
+ if (_imp->params.package_id())
{
- std::string cat(stringify(_imp->params[k::package_id()]->name().category));
- std::string pn(stringify(_imp->params[k::package_id()]->name().package));
- std::string pvr(stringify(_imp->params[k::package_id()]->version()));
- std::string pv(stringify(_imp->params[k::package_id()]->version().remove_revision()));
- std::string slot(stringify(_imp->params[k::package_id()]->slot()));
+ std::string cat(stringify(_imp->params.package_id()->name().category));
+ std::string pn(stringify(_imp->params.package_id()->name().package));
+ std::string pvr(stringify(_imp->params.package_id()->version()));
+ std::string pv(stringify(_imp->params.package_id()->version().remove_revision()));
+ std::string slot(stringify(_imp->params.package_id()->slot()));
return Merger::extend_hook(h)
("P", pn + "-" + pv)
("PN", pn)
("CATEGORY", cat)
- ("PR", _imp->params[k::package_id()]->version().revision_only())
+ ("PR", _imp->params.package_id()->version().revision_only())
("PV", pv)
("PVR", pvr)
("PF", pn + "-" + pvr)
("SLOT", slot)
- ("CONFIG_PROTECT", _imp->params[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->params[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->params.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->params.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "));
}
else
return Merger::extend_hook(h)
- ("CONFIG_PROTECT", _imp->params[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->params[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->params.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->params.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "));
}
@@ -330,15 +332,15 @@ NDBAMMerger::make_arrows(const MergeStatusFlags & flags) const
void
NDBAMMerger::merge()
{
- display_override(">>> Merging to " + stringify(_imp->params[k::root()]));
- _imp->contents_file.reset(new std::ofstream(stringify(_imp->params[k::contents_file()]).c_str()));
+ display_override(">>> Merging to " + stringify(_imp->params.root()));
+ _imp->contents_file.reset(new std::ofstream(stringify(_imp->params.contents_file()).c_str()));
Merger::merge();
}
bool
NDBAMMerger::check()
{
- std::cout << ">>> Checking whether we can merge to " << _imp->params[k::root()] << " ";
+ std::cout << ">>> Checking whether we can merge to " << _imp->params.root() << " ";
bool result(Merger::check());
std::cout << std::endl;
return result;
diff --git a/paludis/ndbam_merger.hh b/paludis/ndbam_merger.hh
index 42ca550..30baf69 100644
--- a/paludis/ndbam_merger.hh
+++ b/paludis/ndbam_merger.hh
@@ -22,24 +22,38 @@
#include <paludis/merger.hh>
#include <paludis/package_id-fwd.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
+#include <paludis/util/named_value.hh>
#include <tr1/functional>
namespace paludis
{
- typedef kc::KeyedClass<
- kc::Field<k::environment, Environment *>,
- kc::Field<k::image, FSEntry>,
- kc::Field<k::root, FSEntry>,
- kc::Field<k::install_under, FSEntry>,
- kc::Field<k::contents_file, FSEntry>,
- kc::Field<k::config_protect, std::string>,
- kc::Field<k::config_protect_mask, std::string>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >,
- kc::Field<k::options, MergerOptions>,
- kc::Field<k::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> >
- > NDBAMMergerParams;
+ namespace n
+ {
+ struct config_protect;
+ struct config_protect_mask;
+ struct contents_file;
+ struct environment;
+ struct get_new_ids_or_minus_one;
+ struct image;
+ struct install_under;
+ struct options;
+ struct package_id;
+ struct root;
+ }
+
+ struct NDBAMMergerParams
+ {
+ NamedValue<n::config_protect, std::string> config_protect;
+ NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::contents_file, FSEntry> contents_file;
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> > get_new_ids_or_minus_one;
+ NamedValue<n::image, FSEntry> image;
+ NamedValue<n::install_under, FSEntry> install_under;
+ NamedValue<n::options, MergerOptions> options;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ NamedValue<n::root, FSEntry> root;
+ };
/**
* Merger subclass for NDBAM.
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index 9eac2fa..851b9d2 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -36,6 +36,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <list>
#include <map>
@@ -58,8 +59,8 @@ namespace paludis
Implementation(const NDBAMUnmergerOptions & o) :
options(o)
{
- tokenise_whitespace(o[k::config_protect()], std::back_inserter(config_protect));
- tokenise_whitespace(o[k::config_protect_mask()], std::back_inserter(config_protect_mask));
+ tokenise_whitespace(o.config_protect(), std::back_inserter(config_protect));
+ tokenise_whitespace(o.config_protect_mask(), std::back_inserter(config_protect_mask));
}
};
}
@@ -101,9 +102,10 @@ class NDBAMUnmerger::SymlinkExtraInfo :
};
NDBAMUnmerger::NDBAMUnmerger(const NDBAMUnmergerOptions & o) :
- Unmerger(UnmergerOptions::named_create()
- (k::environment(), o[k::environment()])
- (k::root(), o[k::root()])),
+ Unmerger(make_named_values<UnmergerOptions>(
+ value_for<n::environment>(o.environment()),
+ value_for<n::root>(o.root())
+ )),
PrivateImplementationPattern<NDBAMUnmerger>(new Implementation<NDBAMUnmerger>(o)),
_imp(PrivateImplementationPattern<NDBAMUnmerger>::_imp.get())
{
@@ -116,29 +118,29 @@ NDBAMUnmerger::~NDBAMUnmerger()
Hook
NDBAMUnmerger::extend_hook(const Hook & h) const
{
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options[k::environment()]->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options.environment()->bashrc_files());
Hook result(Unmerger::extend_hook(h)
- ("CONFIG_PROTECT", _imp->options[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->options[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->options.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->options.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " ")));
- if (_imp->options[k::package_id()])
+ if (_imp->options.package_id())
{
- std::string cat(stringify(_imp->options[k::package_id()]->name().category));
- std::string pn(stringify(_imp->options[k::package_id()]->name().package));
- std::string pvr(stringify(_imp->options[k::package_id()]->version()));
- std::string pv(stringify(_imp->options[k::package_id()]->version().remove_revision()));
+ std::string cat(stringify(_imp->options.package_id()->name().category));
+ std::string pn(stringify(_imp->options.package_id()->name().package));
+ std::string pvr(stringify(_imp->options.package_id()->version()));
+ std::string pv(stringify(_imp->options.package_id()->version().remove_revision()));
return result
("P", pn + "-" + pv)
("PN", pn)
("CATEGORY", cat)
- ("PR", _imp->options[k::package_id()]->version().revision_only())
+ ("PR", _imp->options.package_id()->version().revision_only())
("PV", pv)
("PVR", pvr)
("PF", pn + "-" + pvr)
- ("SLOT", stringify(_imp->options[k::package_id()]->slot()));
+ ("SLOT", stringify(_imp->options.package_id()->slot()));
}
return result;
@@ -172,7 +174,7 @@ NDBAMUnmerger::config_protected(const FSEntry & f) const
std::string
NDBAMUnmerger::make_tidy(const FSEntry & f) const
{
- std::string root_str(stringify(_imp->options[k::root()])), f_str(stringify(f));
+ std::string root_str(stringify(_imp->options.root())), f_str(stringify(f));
if (root_str == "/")
root_str.clear();
if (0 != f_str.compare(0, root_str.length(), root_str))
@@ -202,7 +204,7 @@ void
NDBAMUnmerger::populate_unmerge_set()
{
using namespace std::tr1::placeholders;
- _imp->options[k::ndbam()]->parse_contents(*_imp->options[k::package_id()],
+ _imp->options.ndbam()->parse_contents(*_imp->options.package_id(),
std::tr1::bind(&NDBAMUnmerger::_add_file, this, _1, _2, _3),
std::tr1::bind(&NDBAMUnmerger::_add_dir, this, _1),
std::tr1::bind(&NDBAMUnmerger::_add_sym, this, _1, _2, _3)
@@ -214,22 +216,22 @@ NDBAMUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei)
{
std::tr1::shared_ptr<FileExtraInfo> fie(std::tr1::static_pointer_cast<FileExtraInfo>(ei));
- if (! (_imp->options[k::root()] / f).is_regular_file())
+ if (! (_imp->options.root() / f).is_regular_file())
display("--- [!type] " + stringify(f));
- else if ((_imp->options[k::root()] / f).mtime() != fie->_mtime)
+ else if ((_imp->options.root() / f).mtime() != fie->_mtime)
display("--- [!time] " + stringify(f));
else
{
- std::ifstream md5_file(stringify(_imp->options[k::root()] / f).c_str());
+ std::ifstream md5_file(stringify(_imp->options.root() / f).c_str());
if (! md5_file)
{
Log::get_instance()->message("ndbam.unmerger.md5_failed", ll_warning, lc_no_context) << "Cannot get md5 for '" <<
- (_imp->options[k::root()] / f) << "'";
+ (_imp->options.root() / f) << "'";
display("--- [!md5?] " + stringify(f));
}
else if (MD5(md5_file).hexsum() != fie->_md5sum)
display("--- [!md5 ] " + stringify(f));
- else if (config_protected(_imp->options[k::root()] / f))
+ else if (config_protected(_imp->options.root() / f))
display("--- [cfgpr] " + stringify(f));
else
return true;
@@ -243,11 +245,11 @@ NDBAMUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei)
{
std::tr1::shared_ptr<SymlinkExtraInfo> sie(std::tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
- if (! (_imp->options[k::root()] / f).is_symbolic_link())
+ if (! (_imp->options.root() / f).is_symbolic_link())
display("--- [!type] " + stringify(f));
- else if ((_imp->options[k::root()] / f).mtime() != sie->_mtime)
+ else if ((_imp->options.root() / f).mtime() != sie->_mtime)
display("--- [!time] " + stringify(f));
- else if ((_imp->options[k::root()] / f).readlink() != sie->_dest)
+ else if ((_imp->options.root() / f).readlink() != sie->_dest)
display("--- [!dest] " + stringify(f));
else
return true;
@@ -264,9 +266,9 @@ NDBAMUnmerger::check_misc(const FSEntry &, std::tr1::shared_ptr<ExtraInfo>) cons
bool
NDBAMUnmerger::check_dir(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (! (_imp->options[k::root()] / f).is_directory())
+ if (! (_imp->options.root() / f).is_directory())
display("--- [!type] " + stringify(f));
- else if (DirIterator(_imp->options[k::root()] / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
+ else if (DirIterator(_imp->options.root() / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
display("--- [!empt] " + stringify(f));
else
return true;
diff --git a/paludis/ndbam_unmerger.hh b/paludis/ndbam_unmerger.hh
index f5f703c..21bece4 100644
--- a/paludis/ndbam_unmerger.hh
+++ b/paludis/ndbam_unmerger.hh
@@ -23,25 +23,35 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/fs_entry.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
#include <paludis/unmerger.hh>
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
namespace paludis
{
+ namespace n
+ {
+ struct config_protect;
+ struct config_protect_mask;
+ struct contents_file;
+ struct environment;
+ struct ndbam;
+ struct package_id;
+ struct root;
+ }
+
class NDBAM;
- typedef kc::KeyedClass<
- kc::Field<k::environment, const Environment *>,
- kc::Field<k::root, FSEntry>,
- kc::Field<k::contents_file, FSEntry>,
- kc::Field<k::config_protect, std::string>,
- kc::Field<k::config_protect_mask, std::string>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >,
- kc::Field<k::ndbam, const NDBAM *>
- > NDBAMUnmergerOptions;
+ struct NDBAMUnmergerOptions
+ {
+ NamedValue<n::config_protect, std::string> config_protect;
+ NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::contents_file, FSEntry> contents_file;
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::ndbam, const NDBAM *> ndbam;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ NamedValue<n::root, FSEntry> root;
+ };
class PALUDIS_VISIBLE NDBAMUnmergerError :
public UnmergerError
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 34a0e0b..2462fdd 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -26,6 +26,7 @@
#include <paludis/util/operators.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/action-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
diff --git a/paludis/report_task.cc b/paludis/report_task.cc
index ef3772e..49dffba 100644
--- a/paludis/report_task.cc
+++ b/paludis/report_task.cc
@@ -143,12 +143,12 @@ ReportTask::execute()
r_end(e->package_database()->end_repositories()) ; r != r_end ; ++r)
{
std::tr1::shared_ptr<const Repository> rr(e->package_database()->fetch_repository((*r)->name()));
- if (! (*rr)[k::sets_interface()])
+ if (! (*rr).sets_interface())
continue;
try
{
- std::tr1::shared_ptr<const SetSpecTree::ConstItem> insecure((*rr)[k::sets_interface()]->package_set(SetName("insecurity")));
+ std::tr1::shared_ptr<const SetSpecTree::ConstItem> insecure((*rr).sets_interface()->package_set(SetName("insecurity")));
if (! insecure)
continue;
insecure->accept(vuln);
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index e2a4030..479c6d0 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -44,6 +44,7 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
#include <functional>
@@ -157,20 +158,21 @@ Implementation<CRANInstalledRepository>::need_ids() const
CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryParams & p) :
Repository(RepositoryName("installed-cran"),
- RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::destination_interface(), this)
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(this),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<CRANInstalledRepository>(new Implementation<CRANInstalledRepository>(p)),
_imp(PrivateImplementationPattern<CRANInstalledRepository>::_imp)
{
@@ -498,11 +500,11 @@ CRANInstalledRepository::want_pre_post_phases() const
void
CRANInstalledRepository::merge(const MergeParams & m)
{
- Context context("When merging '" + stringify(*m[k::package_id()]) + "' at '" + stringify(m[k::image_dir()])
+ Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
+ "' to repository '" + stringify(name()) + "':");
- if (! is_suitable_destination_for(*m[k::package_id()]))
- throw InstallActionError("Not a suitable destination for '" + stringify(*m[k::package_id()]) + "'");
+ if (! is_suitable_destination_for(*m.package_id()))
+ throw InstallActionError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
}
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index d6e840d..b09b72d 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -45,6 +45,7 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/unordered_map>
#include <tr1/functional>
#include <functional>
@@ -103,20 +104,21 @@ Implementation<CRANRepository>::~Implementation()
CRANRepository::CRANRepository(const CRANRepositoryParams & p) :
Repository(CRANRepository::fetch_repo_name(stringify(p.location)),
- RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), this)
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(this),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<CRANRepository>(new Implementation<CRANRepository>(p, make_shared_ptr(new Mutex))),
_imp(PrivateImplementationPattern<CRANRepository>::_imp)
{
diff --git a/paludis/repositories/e/check_fetched_files_visitor.cc b/paludis/repositories/e/check_fetched_files_visitor.cc
index 627daf0..669232f 100644
--- a/paludis/repositories/e/check_fetched_files_visitor.cc
+++ b/paludis/repositories/e/check_fetched_files_visitor.cc
@@ -35,11 +35,11 @@
#include <paludis/util/join.hh>
#include <paludis/util/save.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/rmd160.hh>
#include <paludis/util/sha1.hh>
#include <paludis/util/sha256.hh>
#include <paludis/util/md5.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/repositories/e/manifest2_reader.hh>
@@ -188,12 +188,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
case manifest_require:
case last_manifest:
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::failed_integrity_checks(), "No Manifest available")
- (k::requires_manual_fetching(), false)
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("No Manifest available"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
@@ -219,12 +219,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
Log::get_instance()->message("e.manifest.no_size", ll_debug, lc_context)
<< "Malformed Manifest: no file size found";
std::cout << "incorrect size";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Incorrect file size")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Incorrect file size"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
@@ -232,12 +232,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
if (! file_stream)
{
std::cout << "unreadable file";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Unreadable file")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Unreadable file"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
@@ -249,12 +249,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
Log::get_instance()->message("e.manifest.rmd160.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed RMD160 checksum";
std::cout << "failed RMD160";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Failed RMD160 checksum")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Failed RMD160 checksum"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
Log::get_instance()->message("e.manifest.rmd160.result", ll_debug, lc_context)
@@ -271,12 +271,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
Log::get_instance()->message("e.manifest.sha1.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed SHA1 checksum";
std::cout << "failed SHA1";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Failed SHA1 checksum")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Failed SHA1 checksum"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
Log::get_instance()->message("e.manifest.sha1.result", ll_debug, lc_context)
@@ -293,12 +293,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
Log::get_instance()->message("e.manifest.sha256.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed SHA256 checksum";
std::cout << "failed SHA256";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Failed SHA256 checksum")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Failed SHA256 checksum"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
Log::get_instance()->message("e.manifest.sha256.result", ll_debug, lc_context)
@@ -315,12 +315,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
Log::get_instance()->message("e.manifest.md5.failure", ll_debug, lc_context)
<< "Malformed Manifest: failed MD5 checksum";
std::cout << "failed MD5";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Failed MD5 checksum")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Failed MD5 checksum"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
Log::get_instance()->message("e.manifest.md5.result", ll_debug, lc_context)
@@ -331,12 +331,12 @@ CheckFetchedFilesVisitor::check_distfile_manifest(const FSEntry & distfile)
if (! found)
{
std::cout << "not in Manifest";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), stringify(distfile.basename()))
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "Not in Manifest")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("Not in Manifest"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(stringify(distfile.basename()))
+ ));
return false;
}
@@ -366,36 +366,36 @@ CheckFetchedFilesVisitor::visit_leaf(const FetchableURIDepSpec & u)
<< "Manual fetch required for '" << u.filename() << "'";
std::cout << "requires manual fetch";
_imp->need_nofetch = true;
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), u.filename())
- (k::requires_manual_fetching(), true)
- (k::failed_automatic_fetching(), false)
- (k::failed_integrity_checks(), "")
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>(""),
+ value_for<n::requires_manual_fetching>(true),
+ value_for<n::target_file>(u.filename())
+ ));
}
else
{
Log::get_instance()->message("e.check_fetched_files.does_not_exist", ll_debug, lc_context)
<< "Automatic fetch failed for '" << u.filename() << "'";
std::cout << "does not exist";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), u.filename())
- (k::requires_manual_fetching(), false)
- (k::failed_automatic_fetching(), true)
- (k::failed_integrity_checks(), "")
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(true),
+ value_for<n::failed_integrity_checks>(""),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(u.filename())
+ ));
}
}
else if (0 == (_imp->distdir / u.filename()).file_size())
{
Log::get_instance()->message("e.check_fetched_files.empty", ll_debug, lc_context) << "Empty file for '" << u.filename() << "'";
std::cout << "empty file";
- _imp->failures->push_back(FetchActionFailure::named_create()
- (k::target_file(), u.filename())
- (k::requires_manual_fetching(), false)
- (k::failed_integrity_checks(), "SIZE (empty file)")
- (k::failed_automatic_fetching(), false)
- );
+ _imp->failures->push_back(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(false),
+ value_for<n::failed_integrity_checks>("SIZE (empty file)"),
+ value_for<n::requires_manual_fetching>(false),
+ value_for<n::target_file>(u.filename())
+ ));
}
else if (! check_distfile_manifest(_imp->distdir / u.filename()))
{
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index f87fb78..f1df99a 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -20,12 +20,11 @@
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/elike_dep_parser.hh>
#include <paludis/elike_conditional_dep_spec.hh>
#include <paludis/elike_package_dep_spec.hh>
@@ -47,6 +46,15 @@ EDepParseError::EDepParseError(const std::string & s, const std::string & t) thr
{
}
+namespace paludis
+{
+ namespace n
+ {
+ struct add_handler;
+ struct item;
+ }
+}
+
namespace
{
template <typename T_>
@@ -54,10 +62,11 @@ namespace
{
typedef std::tr1::function<void (const std::tr1::shared_ptr<const typename T_::ConstItem> &)> AddHandler;
- typedef kc::KeyedClass<
- kc::Field<k::add_handler, AddHandler>,
- kc::Field<k::item, const std::tr1::shared_ptr<const typename T_::ConstItem> >
- > Item;
+ struct Item
+ {
+ NamedValue<n::add_handler, AddHandler> add_handler;
+ NamedValue<n::item, const std::tr1::shared_ptr<const typename T_::ConstItem> > item;
+ };
typedef std::list<Item> Stack;
};
@@ -67,7 +76,7 @@ namespace
const EAPI & eapi, const std::tr1::shared_ptr<const PackageID> & id)
{
PackageDepSpec p(parse_elike_package_dep_spec(s, eapi.supported()->package_dep_spec_parse_options(), id));
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, PackageDepSpec>(make_shared_ptr(new PackageDepSpec(p)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PackageDepSpec>(make_shared_ptr(new PackageDepSpec(p)))));
}
template <typename T_>
@@ -79,7 +88,7 @@ namespace
std::tr1::shared_ptr<BlockDepSpec> b(new BlockDepSpec(
make_shared_ptr(new PackageDepSpec(parse_elike_package_dep_spec(s.substr(1),
eapi.supported()->package_dep_spec_parse_options(), id)))));
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, BlockDepSpec>(b)));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, BlockDepSpec>(b)));
}
else
package_dep_spec_string_handler<T_>(h, s, eapi, id);
@@ -88,19 +97,19 @@ namespace
template <typename T_>
void license_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, LicenseDepSpec>(make_shared_ptr(new LicenseDepSpec(s)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, LicenseDepSpec>(make_shared_ptr(new LicenseDepSpec(s)))));
}
template <typename T_>
void restrict_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, PlainTextDepSpec>(make_shared_ptr(new PlainTextDepSpec(s)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PlainTextDepSpec>(make_shared_ptr(new PlainTextDepSpec(s)))));
}
template <typename T_>
void simple_uri_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, SimpleURIDepSpec>(make_shared_ptr(new SimpleURIDepSpec(s)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, SimpleURIDepSpec>(make_shared_ptr(new SimpleURIDepSpec(s)))));
}
template <typename T_>
@@ -108,7 +117,7 @@ namespace
const EAPI & eapi)
{
if (t.empty() || eapi.supported()->dependency_spec_tree_parse_options()[dstpo_uri_supports_arrow])
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, FetchableURIDepSpec>(make_shared_ptr(
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, FetchableURIDepSpec>(make_shared_ptr(
new FetchableURIDepSpec(t.empty() ? f : f + " -> " + t)))));
else
throw EDepParseError(s, "arrows in this EAPI");
@@ -146,7 +155,7 @@ namespace
void dependency_label_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s,
const EAPI & eapi)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, DependencyLabelsDepSpec>(
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, DependencyLabelsDepSpec>(
parse_dependency_label(s, eapi))));
}
@@ -154,7 +163,7 @@ namespace
void fetchable_label_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s,
const EAPI & eapi)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, URILabelsDepSpec>(
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, URILabelsDepSpec>(
parse_uri_label(s, eapi))));
}
@@ -164,11 +173,11 @@ namespace
using namespace std::tr1::placeholders;
std::tr1::shared_ptr<ConstTreeSequence<T_, A_> > item(
new ConstTreeSequence<T_, A_>(make_shared_ptr(new A_)));
- (*stack.begin())[k::add_handler()](item);
- stack.push_front(ParseStackTypes<T_>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<T_, A_>::add, item.get(), _1))
- (k::item(), item)
- );
+ (*stack.begin()).add_handler()(item);
+ stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<T_, A_>::add, item.get(), _1)),
+ value_for<n::item>(item)
+ ));
}
template <typename T_>
@@ -179,11 +188,11 @@ namespace
std::tr1::shared_ptr<ConstTreeSequence<T_, ConditionalDepSpec> > item(
new ConstTreeSequence<T_, ConditionalDepSpec>(make_shared_ptr(new ConditionalDepSpec(
parse_elike_conditional_dep_spec(u, env, id)))));
- (*stack.begin())[k::add_handler()](item);
- stack.push_front(ParseStackTypes<T_>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<T_, ConditionalDepSpec>::add, item.get(), _1))
- (k::item(), item)
- );
+ (*stack.begin()).add_handler()(item);
+ stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<T_, ConditionalDepSpec>::add, item.get(), _1)),
+ value_for<n::item>(item)
+ ));
}
template <typename T_>
@@ -225,29 +234,29 @@ paludis::erepository::parse_depend(const std::string & s,
ParseStackTypes<DependencySpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > top(
new ConstTreeSequence<DependencySpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<DependencySpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<DependencySpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::tr1::ref(stack), _1, eapi, id))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_all_handler<DependencySpecTree, AnyDepSpec>, std::tr1::ref(stack)))
- (k::on_all(), std::tr1::bind(&any_all_handler<DependencySpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<DependencySpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&dependency_label_handler<DependencySpecTree>, std::tr1::ref(stack), _1, eapi))
- (k::on_pop(), std::tr1::bind(&pop_handler<DependencySpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<DependencySpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), std::tr1::bind(&use_under_any_handler, s, eapi))
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<DependencySpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_all_handler<DependencySpecTree, AnyDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&dependency_label_handler<DependencySpecTree>, std::tr1::ref(stack), _1, eapi)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<DependencySpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<DependencySpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::tr1::ref(stack), _1, eapi, id)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<DependencySpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(std::tr1::bind(&use_under_any_handler, s, eapi))
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<ProvideSpecTree::ConstItem>
@@ -259,29 +268,29 @@ paludis::erepository::parse_provide(const std::string & s,
ParseStackTypes<ProvideSpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<ProvideSpecTree, AllDepSpec> > top(
new ConstTreeSequence<ProvideSpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<ProvideSpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<ProvideSpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<ProvideSpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<ProvideSpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, eapi, id))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<ProvideSpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<ProvideSpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<ProvideSpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), std::tr1::bind(&use_under_any_handler, s, eapi))
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<ProvideSpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<ProvideSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<ProvideSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, eapi, id)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(std::tr1::bind(&use_under_any_handler, s, eapi))
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<FetchableURISpecTree::ConstItem>
@@ -293,29 +302,29 @@ paludis::erepository::parse_fetchable_uri(const std::string & s,
ParseStackTypes<FetchableURISpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<FetchableURISpecTree, AllDepSpec> > top(
new ConstTreeSequence<FetchableURISpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<FetchableURISpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<FetchableURISpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<FetchableURISpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<FetchableURISpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), s, _1, "", eapi))
- (k::on_arrow(), std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), s, _1, _2, eapi))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<FetchableURISpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&fetchable_label_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, eapi))
- (k::on_pop(), std::tr1::bind(&pop_handler<FetchableURISpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<FetchableURISpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), std::tr1::bind(&use_under_any_handler, s, eapi))
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<FetchableURISpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), s, _1, _2, eapi)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&fetchable_label_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, eapi)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<FetchableURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<FetchableURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), s, _1, "", eapi)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(std::tr1::bind(&use_under_any_handler, s, eapi))
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<SimpleURISpecTree::ConstItem>
@@ -327,29 +336,29 @@ paludis::erepository::parse_simple_uri(const std::string & s,
ParseStackTypes<SimpleURISpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<SimpleURISpecTree, AllDepSpec> > top(
new ConstTreeSequence<SimpleURISpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<SimpleURISpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<SimpleURISpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<SimpleURISpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<SimpleURISpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&simple_uri_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<SimpleURISpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<SimpleURISpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<SimpleURISpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<SimpleURISpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<SimpleURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<SimpleURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&simple_uri_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<LicenseSpecTree::ConstItem>
@@ -361,29 +370,29 @@ paludis::erepository::parse_license(const std::string & s,
ParseStackTypes<LicenseSpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<LicenseSpecTree, AllDepSpec> > top(
new ConstTreeSequence<LicenseSpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<LicenseSpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<LicenseSpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<LicenseSpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<LicenseSpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&license_handler<LicenseSpecTree>, std::tr1::ref(stack), _1))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_all_handler<LicenseSpecTree, AnyDepSpec>, std::tr1::ref(stack)))
- (k::on_all(), std::tr1::bind(&any_all_handler<LicenseSpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<LicenseSpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<LicenseSpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<LicenseSpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), std::tr1::bind(&use_under_any_handler, s, eapi))
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<LicenseSpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_all_handler<LicenseSpecTree, AnyDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<LicenseSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<LicenseSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&license_handler<LicenseSpecTree>, std::tr1::ref(stack), _1)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<LicenseSpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(std::tr1::bind(&use_under_any_handler, s, eapi))
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<RestrictSpecTree::ConstItem>
@@ -395,29 +404,29 @@ paludis::erepository::parse_restrict(const std::string & s,
ParseStackTypes<RestrictSpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<RestrictSpecTree, AllDepSpec> > top(
new ConstTreeSequence<RestrictSpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<RestrictSpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<RestrictSpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<RestrictSpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<RestrictSpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&restrict_handler<RestrictSpecTree>, std::tr1::ref(stack), _1))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<RestrictSpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<RestrictSpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<RestrictSpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<RestrictSpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<RestrictSpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<RestrictSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<RestrictSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&restrict_handler<RestrictSpecTree>, std::tr1::ref(stack), _1)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<RestrictSpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<URILabelsDepSpec>
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 841b78b..0b62a6e 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -35,6 +35,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/system.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
@@ -360,24 +361,26 @@ EInstalledRepository::perform_config(const std::tr1::shared_ptr<const ERepositor
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
- EbuildConfigCommand config_cmd(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), ver_dir)
- (k::ebuild_file(), ver_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild"))
- (k::files_dir(), ver_dir)
- (k::eclassdirs(), eclassdirs)
- (k::exlibsdirs(), make_shared_ptr(new FSEntrySequence))
- (k::portdir(), ver_dir)
- (k::distdir(), ver_dir)
- (k::sandbox(), phase->option("sandbox"))
- (k::userpriv(), phase->option("userpriv"))
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::builddir(), _imp->params.builddir),
-
- EbuildConfigCommandParams::named_create()
- (k::root(), stringify(_imp->params.root))
- (k::load_environment(), load_env.get()));
+ EbuildConfigCommand config_cmd(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(ver_dir),
+ value_for<n::ebuild_dir>(ver_dir),
+ value_for<n::ebuild_file>(ver_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild")),
+ value_for<n::eclassdirs>(eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(make_shared_ptr(new FSEntrySequence)),
+ value_for<n::files_dir>(ver_dir),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(ver_dir),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv"))
+ ),
+
+ make_named_values<EbuildConfigCommandParams>(
+ value_for<n::load_environment>(load_env.get()),
+ value_for<n::root>(stringify(_imp->params.root))
+ ));
config_cmd();
}
@@ -457,30 +460,32 @@ EInstalledRepository::perform_info(const std::tr1::shared_ptr<const ERepositoryI
}
}
- EbuildInfoCommand info_cmd(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), ver_dir)
- (k::ebuild_file(), ver_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild"))
- (k::files_dir(), ver_dir)
- (k::eclassdirs(), eclassdirs)
- (k::exlibsdirs(), make_shared_ptr(new FSEntrySequence))
- (k::portdir(), ver_dir)
- (k::distdir(), ver_dir)
- (k::sandbox(), phase->option("sandbox"))
- (k::userpriv(), phase->option("userpriv"))
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::builddir(), _imp->params.builddir),
-
- EbuildInfoCommandParams::named_create()
- (k::root(), stringify(_imp->params.root))
- (k::use(), "")
- (k::use_expand(), "")
- (k::expand_vars(), make_shared_ptr(new Map<std::string, std::string>))
- (k::profiles(), make_shared_ptr(new FSEntrySequence))
- (k::info_vars(), i ? i : make_shared_ptr(new const Set<std::string>))
- (k::use_ebuild_file(), false)
- (k::load_environment(), load_env.get()));
+ EbuildInfoCommand info_cmd(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(ver_dir),
+ value_for<n::ebuild_dir>(ver_dir),
+ value_for<n::ebuild_file>(ver_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild")),
+ value_for<n::eclassdirs>(eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(make_shared_ptr(new FSEntrySequence)),
+ value_for<n::files_dir>(ver_dir),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(ver_dir),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv"))
+ ),
+
+ make_named_values<EbuildInfoCommandParams>(
+ value_for<n::expand_vars>(make_shared_ptr(new Map<std::string, std::string>)),
+ value_for<n::info_vars>(i ? i : make_shared_ptr(new const Set<std::string>)),
+ value_for<n::load_environment>(load_env.get()),
+ value_for<n::profiles>(make_shared_ptr(new FSEntrySequence)),
+ value_for<n::root>(stringify(_imp->params.root)),
+ value_for<n::use>(""),
+ value_for<n::use_ebuild_file>(false),
+ value_for<n::use_expand>("")
+ ));
info_cmd();
}
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 838f21c..fb1e94f 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -38,7 +38,6 @@
#include <paludis/util/strip.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/kc.hh>
#include <paludis/literal_metadata_key.hh>
#include <iterator>
#include <fstream>
@@ -466,7 +465,7 @@ EInstalledRepositoryID::eapi() const
<< _imp->environment->distribution() << "'";
_imp->eapi = EAPIData::get_instance()->eapi_from_string(
(*DistributionData::get_instance()->distribution_from_string(
- _imp->environment->distribution()))[k::default_ebuild_eapi_when_unspecified()]);
+ _imp->environment->distribution())).default_ebuild_eapi_when_unspecified());
}
return _imp->eapi;
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 1b0b1e4..df4e30c 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -578,8 +578,8 @@ EIUseKey::value() const
tokenise_whitespace(_imp->string_value, std::back_inserter(tokens));
std::tr1::shared_ptr<const UseFlagNameSet> prefixes;
- if ((*_imp->id->repository())[k::use_interface()])
- prefixes = (*_imp->id->repository())[k::use_interface()]->use_expand_prefixes();
+ if ((*_imp->id->repository()).use_interface())
+ prefixes = (*_imp->id->repository()).use_interface()->use_expand_prefixes();
else
prefixes.reset(new UseFlagNameSet);
@@ -614,9 +614,9 @@ EIUseKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
if (! result.empty())
result.append(" ");
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(i->flag, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(i->flag, *_imp->id))
result.append(f.format(*i, format::Masked()));
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(i->flag, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(i->flag, *_imp->id))
result.append(f.format(*i, format::Forced()));
else if (_imp->env->query_use(i->flag, *_imp->id))
result.append(f.format(*i, format::Enabled()));
@@ -630,9 +630,9 @@ EIUseKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
if (! result.empty())
result.append(" ");
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(j->second.flag, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(j->second.flag, *_imp->id))
result.append(f.format(j->second, format::Masked()));
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(j->second.flag, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(j->second.flag, *_imp->id))
result.append(f.format(j->second, format::Forced()));
else if (_imp->env->query_use(j->second.flag, *_imp->id))
result.append(f.format(j->second, format::Enabled()));
@@ -666,12 +666,12 @@ EIUseKey::pretty_print_flat_with_comparison(
std::string l;
bool n;
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(i->flag, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(i->flag, *_imp->id))
{
l = f.format(*i, format::Masked());
n = false;
}
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(i->flag, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(i->flag, *_imp->id))
{
l = f.format(*i, format::Forced());
n = true;
@@ -713,12 +713,12 @@ EIUseKey::pretty_print_flat_with_comparison(
std::string l;
bool n;
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(j->second.flag, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(j->second.flag, *_imp->id))
{
l = f.format(j->second, format::Masked());
n = false;
}
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(j->second.flag, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(j->second.flag, *_imp->id))
{
l = f.format(j->second, format::Forced());
n = true;
@@ -902,9 +902,9 @@ EUseKey::pretty_print_flat(const Formatter<UseFlagName> & f) const
if (! result.empty())
result.append(" ");
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(*i, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(*i, *_imp->id))
result.append(f.format(*i, format::Masked()));
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(*i, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(*i, *_imp->id))
result.append(f.format(*i, format::Forced()));
else if (_imp->env->query_use(*i, *_imp->id))
result.append(f.format(*i, format::Enabled()));
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 05b679b..9e974ca 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -71,11 +71,11 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/is_file_with_extension.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/rmd160.hh>
#include <paludis/util/sha1.hh>
#include <paludis/util/sha256.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
@@ -337,14 +337,15 @@ namespace paludis
profiles.push_back(layout->profiles_base_dir() / tokens.at(1));
try
{
- profiles_desc.push_back(RepositoryEInterface::ProfilesDescLine::named_create()
- (k::arch(), tokens.at(0))
- (k::path(), *profiles.begin())
- (k::status(), tokens.at(2))
- (k::profile(), std::tr1::shared_ptr<ERepositoryProfile>(new ERepositoryProfile(
+ profiles_desc.push_back(make_named_values<RepositoryEInterface::ProfilesDescLine>(
+ value_for<n::arch>(tokens.at(0)),
+ value_for<n::path>(*profiles.begin()),
+ value_for<n::profile>(std::tr1::shared_ptr<ERepositoryProfile>(new ERepositoryProfile(
params.environment, repo, repo->name(), profiles,
erepository::EAPIData::get_instance()->eapi_from_string(
- params.eapi_when_unknown)->supported()->ebuild_environment_variables()->env_arch()))));
+ params.eapi_when_unknown)->supported()->ebuild_environment_variables()->env_arch()))),
+ value_for<n::status>(tokens.at(2))
+ ));
}
catch (const InternalError &)
{
@@ -415,25 +416,25 @@ namespace
ERepository::ERepository(const ERepositoryParams & p) :
Repository(fetch_repo_name(p.location),
- RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), this)
- (k::use_interface(), this)
- (k::environment_variable_interface(), this)
- (k::mirrors_interface(), this)
- (k::virtuals_interface(), (*DistributionData::get_instance()->distribution_from_string(
- p.environment->distribution()))[k::support_old_style_virtuals()] ? this : 0)
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::destination_interface(), p.binary_destination ? this : 0)
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::e_interface(), this)
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(p.binary_destination ? this : 0),
+ value_for<n::e_interface>(this),
+ value_for<n::environment_variable_interface>(this),
+ value_for<n::hook_interface>(this),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(this),
+ value_for<n::mirrors_interface>(this),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
#ifdef ENABLE_QA
- (k::qa_interface(), this)
+ value_for<n::qa_interface>(this),
#else
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
#endif
- (k::hook_interface(), this)
- (k::manifest_interface(), this)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(this),
+ value_for<n::use_interface>(this),
+ value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string(p.environment->distribution())).support_old_style_virtuals() ? this : 0)
+ )),
PrivateImplementationPattern<ERepository>(new Implementation<ERepository>(this, p)),
_imp(PrivateImplementationPattern<ERepository>::_imp)
{
@@ -799,16 +800,16 @@ ERepository::sync() const
for (std::list<std::string>::const_iterator s(sync_list.begin()),
s_end(sync_list.end()) ; s != s_end ; ++s)
{
- DefaultSyncer syncer(SyncerParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::local(), stringify(_imp->params.location))
- (k::remote(), *s)
- );
- SyncOptions opts(
- _imp->params.sync_options,
- _imp->layout->sync_filter_file(),
- "sync " + stringify(name()) + "> "
- );
+ DefaultSyncer syncer(make_named_values<SyncerParams>(
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::local>(stringify(_imp->params.location)),
+ value_for<n::remote>(*s)
+ ));
+ SyncOptions opts(make_named_values<SyncOptions>(
+ value_for<n::filter_file>(_imp->layout->sync_filter_file()),
+ value_for<n::options>(_imp->params.sync_options),
+ value_for<n::output_prefix>("sync " + stringify(name()) + "> ")
+ ));
try
{
syncer.sync(opts);
@@ -841,7 +842,7 @@ ERepository::invalidate_masks()
_imp->layout->invalidate_masks();
if ((*DistributionData::get_instance()->distribution_from_string(_imp->params.environment->distribution()))
- [k::support_old_style_virtuals()])
+ .support_old_style_virtuals())
if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals")))
_imp->params.environment->package_database()->fetch_repository(
RepositoryName("virtuals"))->invalidate_masks();
@@ -925,9 +926,10 @@ ERepository::virtual_packages() const
for (ERepositoryProfile::VirtualsConstIterator i(_imp->profile_ptr->begin_virtuals()),
i_end(_imp->profile_ptr->end_virtuals()) ; i != i_end ; ++i)
- result->push_back(RepositoryVirtualsEntry::named_create()
- (k::provided_by_spec(), i->second)
- (k::virtual_name(), i->first));
+ result->push_back(make_named_values<RepositoryVirtualsEntry>(
+ value_for<n::provided_by_spec>(i->second),
+ value_for<n::virtual_name>(i->first)
+ ));
return result;
}
@@ -1039,7 +1041,7 @@ ERepository::find_profile(const FSEntry & location) const
_imp->need_profiles_desc();
for (ProfilesDesc::const_iterator i(_imp->profiles_desc.begin()),
i_end(_imp->profiles_desc.end()) ; i != i_end ; ++i)
- if ((*i)[k::path()] == location)
+ if ((*i).path() == location)
return ProfilesConstIterator(i);
return ProfilesConstIterator(_imp->profiles_desc.end());
}
@@ -1050,11 +1052,11 @@ ERepository::set_profile(const ProfilesConstIterator & iter)
Context context("When setting profile by iterator:");
Log::get_instance()->message("e.profile.using", ll_debug, lc_context)
- << "Using profile '" << ((*iter)[k::path()]) << "'";
- _imp->profile_ptr = (*iter)[k::profile()];
+ << "Using profile '" << ((*iter).path()) << "'";
+ _imp->profile_ptr = (*iter).profile();
if ((*DistributionData::get_instance()->distribution_from_string(_imp->params.environment->distribution()))
- [k::support_old_style_virtuals()])
+ .support_old_style_virtuals())
if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals")))
_imp->params.environment->package_database()->fetch_repository(
RepositoryName("virtuals"))->invalidate();
@@ -1068,14 +1070,14 @@ ERepository::set_profile_by_arch(const UseFlagName & arch)
Context context("When setting profile by arch '" + stringify(arch) + "':");
for (ProfilesConstIterator p(begin_profiles()), p_end(end_profiles()) ; p != p_end ; ++p)
- if ((*p)[k::arch()] == stringify(arch) && (*p)[k::status()] == "stable")
+ if ((*p).arch() == stringify(arch) && (*p).status() == "stable")
{
set_profile(p);
return;
}
for (ProfilesConstIterator p(begin_profiles()), p_end(end_profiles()) ; p != p_end ; ++p)
- if ((*p)[k::arch()] == stringify(arch))
+ if ((*p).arch() == stringify(arch))
{
set_profile(p);
return;
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 24a24aa..c795497 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -33,8 +33,8 @@
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/util/set.hh>
-#include <paludis/util/kc.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
@@ -828,16 +828,16 @@ namespace test_cases
std::tr1::shared_ptr<const RepositoryVirtualsInterface::VirtualsSequence> seq(repo->virtual_packages());
for (RepositoryVirtualsInterface::VirtualsSequence::ConstIterator it(seq->begin()),
it_end(seq->end()); it_end != it; ++it, ++count)
- if ("virtual/one" == stringify((*it)[k::virtual_name()]))
+ if ("virtual/one" == stringify(it->virtual_name()))
{
has_one = true;
- TEST_CHECK_STRINGIFY_EQUAL(*(*it)[k::provided_by_spec()], "cat-one/pkg-one");
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec(), "cat-one/pkg-one");
}
else
{
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/two");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/two");
has_two = true;
- TEST_CHECK_STRINGIFY_EQUAL(*(*it)[k::provided_by_spec()], "cat-two/pkg-two");
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec(), "cat-two/pkg-two");
}
TEST_CHECK(has_one);
@@ -852,21 +852,21 @@ namespace test_cases
seq = repo->virtual_packages();
for (RepositoryVirtualsInterface::VirtualsSequence::ConstIterator it(seq->begin()),
it_end(seq->end()); it_end != it; ++it, ++count)
- if ("virtual/one" == stringify((*it)[k::virtual_name()]))
+ if ("virtual/one" == stringify(it->virtual_name()))
{
has_one = true;
- TEST_CHECK_STRINGIFY_EQUAL(*(*it)[k::provided_by_spec()], "cat-two/pkg-two");
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec(), "cat-two/pkg-two");
}
- else if ("virtual/two" == stringify((*it)[k::virtual_name()]))
+ else if ("virtual/two" == stringify(it->virtual_name()))
{
has_two = true;
- TEST_CHECK_STRINGIFY_EQUAL(*(*it)[k::provided_by_spec()], "cat-one/pkg-one");
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec(), "cat-one/pkg-one");
}
else
{
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/three");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/three");
has_three = true;
- TEST_CHECK_STRINGIFY_EQUAL(*(*it)[k::provided_by_spec()], "cat-three/pkg-three");
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec(), "cat-three/pkg-three");
}
TEST_CHECK(has_one);
@@ -943,10 +943,10 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(1, repo);
- FetchAction action(FetchActionOptions::named_create()
- (k::fetch_unneeded(), false)
- (k::safe_resume(), true)
- );
+ FetchAction action(make_named_values<FetchActionOptions>(
+ value_for<n::fetch_unneeded>(false),
+ value_for<n::safe_resume>(true)
+ ));
{
TestMessageSuffix suffix("no files", true);
@@ -1045,10 +1045,10 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(1, repo);
- FetchAction action(FetchActionOptions::named_create()
- (k::fetch_unneeded(), false)
- (k::safe_resume(), true)
- );
+ FetchAction action(make_named_values<FetchActionOptions>(
+ value_for<n::fetch_unneeded>(false),
+ value_for<n::safe_resume>(true)
+ ));
const std::tr1::shared_ptr<const PackageID> id(*env[selection::AllVersionsSorted(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("category/package",
@@ -1113,11 +1113,11 @@ namespace test_cases
std::tr1::bind(from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1)));
#endif
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
#ifdef ENABLE_VIRTUALS_REPOSITORY
{
@@ -1338,11 +1338,11 @@ namespace test_cases
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
env.package_database()->add_repository(2, installed_repo);
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
{
TestMessageSuffix suffix("econf source 1", true);
@@ -1402,11 +1402,11 @@ namespace test_cases
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
env.package_database()->add_repository(2, installed_repo);
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
{
TestMessageSuffix suffix("econf source kdebuild-1", true);
@@ -1571,11 +1571,11 @@ namespace test_cases
std::tr1::bind(from_keys, make_shared_ptr(new Map<std::string, std::string>), std::tr1::placeholders::_1)));
#endif
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
{
TestMessageSuffix suffix("in-ebuild die", true);
@@ -2028,11 +2028,11 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(1, installed_repo);
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("cat/pkg",
diff --git a/paludis/repositories/e/e_repository_id.cc b/paludis/repositories/e/e_repository_id.cc
index d6325fd..850c245 100644
--- a/paludis/repositories/e/e_repository_id.cc
+++ b/paludis/repositories/e/e_repository_id.cc
@@ -20,7 +20,6 @@
#include <paludis/version_spec.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/e_repository_id.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/set.hh>
using namespace paludis;
diff --git a/paludis/repositories/e/e_repository_mask_file.cc b/paludis/repositories/e/e_repository_mask_file.cc
index 57875d9..9e443f9 100644
--- a/paludis/repositories/e/e_repository_mask_file.cc
+++ b/paludis/repositories/e/e_repository_mask_file.cc
@@ -25,7 +25,7 @@
#include <paludis/util/strip.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/mask.hh>
#include <list>
@@ -77,7 +77,8 @@ MaskFile::MaskFile(const FSEntry & f, const LineConfigFileOptions & opts) :
continue;
}
- _imp->lines.push_back(std::make_pair(*it, std::tr1::shared_ptr<RepositoryMaskInfo>(new RepositoryMaskInfo(f, comment))));
+ _imp->lines.push_back(std::make_pair(*it, std::tr1::shared_ptr<RepositoryMaskInfo>(new RepositoryMaskInfo(
+ make_named_values<RepositoryMaskInfo>(value_for<n::comment>(comment), value_for<n::mask_file>(f))))));
comment_used = true;
}
}
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 18ccda2..f214a1b 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -37,7 +37,6 @@
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/config_file.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/hashes.hh>
#include <paludis/dep_tag.hh>
#include <paludis/environment.hh>
@@ -246,7 +245,7 @@ Implementation<ERepositoryProfile>::load_profile_directory_recursively(const FSE
load_spec_use_file(dir / "package.use.force", stacked_values_list.back().package_use_force);
packages_file.add_file(dir / "packages");
- if ((*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::support_old_style_virtuals()])
+ if ((*DistributionData::get_instance()->distribution_from_string(env->distribution())).support_old_style_virtuals())
virtuals_file.add_file(dir / "virtuals");
package_mask_file.add_file(dir / "package.mask");
}
@@ -489,7 +488,7 @@ Implementation<ERepositoryProfile>::make_vars_from_file_vars()
}
if ((*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::support_old_style_virtuals()])
+ env->distribution())).support_old_style_virtuals())
try
{
for (erepository::ProfileFile<LineConfigFile>::ConstIterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ;
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index 82a73ed..da88d55 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -64,7 +64,7 @@ namespace test_cases
std::tr1::shared_ptr<ERepository> repo(make_ebuild_repository(&env,
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
- std::tr1::shared_ptr<const SetNameSet> sets_list((*repo)[k::sets_interface()]->sets_list());
+ std::tr1::shared_ptr<const SetNameSet> sets_list(repo->sets_interface()->sets_list());
TEST_CHECK_EQUAL(sets_list->size(), 4U);
TEST_CHECK(sets_list->end() != sets_list->find(SetName("system")));
TEST_CHECK(sets_list->end() != sets_list->find(SetName("security")));
@@ -92,7 +92,7 @@ namespace test_cases
installed->add_version("cat-two", "bar", "1.5");
env.package_database()->add_repository(0, installed);
- std::tr1::shared_ptr<SetSpecTree::ConstItem> set1((*repo)[k::sets_interface()]->package_set(SetName("set1")));
+ std::tr1::shared_ptr<SetSpecTree::ConstItem> set1(repo->sets_interface()->package_set(SetName("set1")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false);
set1->accept(pretty);
@@ -122,7 +122,7 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(1, repo);
- std::tr1::shared_ptr<SetSpecTree::ConstItem> insecurity((*repo)[k::sets_interface()]->package_set(SetName("insecurity")));
+ std::tr1::shared_ptr<SetSpecTree::ConstItem> insecurity(repo->sets_interface()->package_set(SetName("insecurity")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false);
insecurity->accept(pretty);
@@ -160,7 +160,7 @@ namespace test_cases
installed->add_version("cat-three", "baz", "1.0");
env.package_database()->add_repository(0, installed);
- std::tr1::shared_ptr<const SetSpecTree::ConstItem> security((*repo)[k::sets_interface()]->package_set(SetName("security")));
+ std::tr1::shared_ptr<const SetSpecTree::ConstItem> security(repo->sets_interface()->package_set(SetName("security")));
StringifyFormatter ff;
erepository::DepSpecPrettyPrinter pretty(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false);
security->accept(pretty);
diff --git a/paludis/repositories/e/e_stripper.cc b/paludis/repositories/e/e_stripper.cc
index 1f32d5d..23c24e5 100644
--- a/paludis/repositories/e/e_stripper.cc
+++ b/paludis/repositories/e/e_stripper.cc
@@ -18,9 +18,9 @@
*/
#include <paludis/repositories/e/e_stripper.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <iostream>
using namespace paludis;
@@ -41,11 +41,11 @@ namespace paludis
}
EStripper::EStripper(const EStripperOptions & options) :
- Stripper(StripperOptions::named_create()
- (k::image_dir(), options[k::image_dir()])
- (k::debug_build(), options[k::debug_build()])
- (k::debug_dir(), options[k::debug_dir()])
- ),
+ Stripper(make_named_values<StripperOptions>(
+ value_for<n::debug_build>(options.debug_build()),
+ value_for<n::debug_dir>(options.debug_dir()),
+ value_for<n::image_dir>(options.image_dir())
+ )),
PrivateImplementationPattern<EStripper>(new Implementation<EStripper>(options)),
_imp(PrivateImplementationPattern<EStripper>::_imp)
{
@@ -58,20 +58,20 @@ EStripper::~EStripper()
void
EStripper::on_strip(const FSEntry & f)
{
- std::cout << "str " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+ std::cout << "str " << f.strip_leading(_imp->options.image_dir()) << std::endl;
}
void
EStripper::on_split(const FSEntry & f, const FSEntry & g)
{
- std::cout << "spl " << f.strip_leading(_imp->options[k::image_dir()]) <<
- " -> " << g.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+ std::cout << "spl " << f.strip_leading(_imp->options.image_dir()) <<
+ " -> " << g.strip_leading(_imp->options.image_dir()) << std::endl;
}
void
EStripper::on_unknown(const FSEntry & f)
{
- std::cout << "--- " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+ std::cout << "--- " << f.strip_leading(_imp->options.image_dir()) << std::endl;
}
void
@@ -87,7 +87,7 @@ EStripper::on_leave_dir(const FSEntry &)
void
EStripper::strip()
{
- std::cout << ">>> Stripping inside " << _imp->options[k::image_dir()] << std::endl;
+ std::cout << ">>> Stripping inside " << _imp->options.image_dir() << std::endl;
Stripper::strip();
}
diff --git a/paludis/repositories/e/e_stripper.hh b/paludis/repositories/e/e_stripper.hh
index a8c9470..7bbd33c 100644
--- a/paludis/repositories/e/e_stripper.hh
+++ b/paludis/repositories/e/e_stripper.hh
@@ -21,17 +21,29 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_STRIPPER_HH 1
#include <paludis/stripper.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <tr1/memory>
namespace paludis
{
+ namespace n
+ {
+ struct debug_build;
+ struct debug_dir;
+ struct image_dir;
+ struct package_id;
+ }
+
namespace erepository
{
- typedef kc::KeyedClass<
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >,
- kc::Field<k::image_dir, FSEntry>,
- kc::Field<k::debug_dir, FSEntry>,
- kc::Field<k::debug_build, InstallActionDebugOption>
- > EStripperOptions;
+ struct EStripperOptions
+ {
+ NamedValue<n::debug_build, InstallActionDebugOption> debug_build;
+ NamedValue<n::debug_dir, FSEntry> debug_dir;
+ NamedValue<n::image_dir, FSEntry> image_dir;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ };
class EStripper :
public Stripper,
diff --git a/paludis/repositories/e/eapi-fwd.hh b/paludis/repositories/e/eapi-fwd.hh
index 2a15c50..5a48869 100644
--- a/paludis/repositories/e/eapi-fwd.hh
+++ b/paludis/repositories/e/eapi-fwd.hh
@@ -20,8 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_EAPI_FWD_HH
#define PALUDIS_GUARD_PALUDIS_EAPI_FWD_HH 1
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
#include <paludis/repositories/e/dep_parser-fwd.hh>
#include <paludis/merger-fwd.hh>
#include <paludis/name-fwd.hh>
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index d5b4461..9be81c7 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -34,7 +34,6 @@
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_named_values.hh>
#include <tr1/unordered_map>
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index a3dee4a..3592e39 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -42,7 +42,6 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/set.hh>
#include <paludis/util/cookie.hh>
-#include <paludis/util/kc.hh>
#include <paludis/about.hh>
#include <paludis/environment.hh>
@@ -96,122 +95,122 @@ EbuildCommand::operator() ()
Command cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
"/ebuild.bash '" + ebuild_file() + "' " + commands());
- if (params[k::sandbox()])
+ if (params.sandbox())
cmd.with_sandbox();
- if (params[k::userpriv()])
- cmd.with_uid_gid(params[k::environment()]->reduced_uid(), params[k::environment()]->reduced_gid());
+ if (params.userpriv())
+ cmd.with_uid_gid(params.environment()->reduced_uid(), params.environment()->reduced_gid());
using namespace std::tr1::placeholders;
- cmd.with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params[k::environment()], params[k::package_id()], _1));
+ cmd.with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params.environment(), params.package_id(), _1));
- std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(params[k::environment()]->syncers_dirs());
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(params[k::environment()]->bashrc_files());
- std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(params[k::environment()]->fetchers_dirs());
- std::tr1::shared_ptr<const FSEntrySequence> hook_dirs(params[k::environment()]->hook_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(params.environment()->syncers_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(params.environment()->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(params.environment()->fetchers_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> hook_dirs(params.environment()->hook_dirs());
cmd = extend_command(cmd
- .with_setenv("P", stringify(params[k::package_id()]->name().package) + "-" +
- stringify(params[k::package_id()]->version().remove_revision()))
- .with_setenv("PV", stringify(params[k::package_id()]->version().remove_revision()))
- .with_setenv("PR", stringify(params[k::package_id()]->version().revision_only()))
- .with_setenv("PN", stringify(params[k::package_id()]->name().package))
- .with_setenv("PVR", stringify(params[k::package_id()]->version()))
- .with_setenv("PF", stringify(params[k::package_id()]->name().package) + "-" +
- stringify(params[k::package_id()]->version()))
- .with_setenv("CATEGORY", stringify(params[k::package_id()]->name().category))
- .with_setenv("REPOSITORY", stringify(params[k::package_id()]->repository()->name()))
- .with_setenv("FILESDIR", stringify(params[k::files_dir()]))
- .with_setenv("EAPI", stringify(params[k::package_id()]->eapi()->exported_name()))
+ .with_setenv("P", stringify(params.package_id()->name().package) + "-" +
+ stringify(params.package_id()->version().remove_revision()))
+ .with_setenv("PV", stringify(params.package_id()->version().remove_revision()))
+ .with_setenv("PR", stringify(params.package_id()->version().revision_only()))
+ .with_setenv("PN", stringify(params.package_id()->name().package))
+ .with_setenv("PVR", stringify(params.package_id()->version()))
+ .with_setenv("PF", stringify(params.package_id()->name().package) + "-" +
+ stringify(params.package_id()->version()))
+ .with_setenv("CATEGORY", stringify(params.package_id()->name().category))
+ .with_setenv("REPOSITORY", stringify(params.package_id()->repository()->name()))
+ .with_setenv("FILESDIR", stringify(params.files_dir()))
+ .with_setenv("EAPI", stringify(params.package_id()->eapi()->exported_name()))
.with_setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
stringify(PALUDIS_VERSION_MINOR) + "." +
stringify(PALUDIS_VERSION_MICRO) + stringify(PALUDIS_VERSION_SUFFIX) +
(std::string(PALUDIS_GIT_HEAD).empty() ?
std::string("") : "-git-" + std::string(PALUDIS_GIT_HEAD)))
- .with_setenv("PALUDIS_TMPDIR", stringify(params[k::builddir()]))
+ .with_setenv("PALUDIS_TMPDIR", stringify(params.builddir()))
.with_setenv("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
.with_setenv("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "))
.with_setenv("PALUDIS_HOOK_DIRS", join(hook_dirs->begin(), hook_dirs->end(), " "))
.with_setenv("PALUDIS_FETCHERS_DIRS", join(fetchers_dirs->begin(), fetchers_dirs->end(), " "))
.with_setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " "))
- .with_setenv("PALUDIS_COMMAND", params[k::environment()]->paludis_command())
- .with_setenv("PALUDIS_REDUCED_GID", stringify(params[k::environment()]->reduced_gid()))
- .with_setenv("PALUDIS_REDUCED_UID", stringify(params[k::environment()]->reduced_uid()))
+ .with_setenv("PALUDIS_COMMAND", params.environment()->paludis_command())
+ .with_setenv("PALUDIS_REDUCED_GID", stringify(params.environment()->reduced_gid()))
+ .with_setenv("PALUDIS_REDUCED_UID", stringify(params.environment()->reduced_uid()))
.with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
.with_setenv("PALUDIS_UTILITY_PATH_SUFFIXES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->utility_path_suffixes())
+ params.package_id()->eapi()->supported()->ebuild_options()->utility_path_suffixes())
.with_setenv("PALUDIS_EBUILD_MODULE_SUFFIXES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ebuild_module_suffixes())
+ params.package_id()->eapi()->supported()->ebuild_options()->ebuild_module_suffixes())
.with_setenv("PALUDIS_NON_EMPTY_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->non_empty_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->non_empty_variables())
.with_setenv("PALUDIS_DIRECTORY_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->directory_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->directory_variables())
.with_setenv("PALUDIS_EBUILD_MUST_NOT_SET_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ebuild_must_not_set_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->ebuild_must_not_set_variables())
.with_setenv("PALUDIS_ECLASS_MUST_NOT_SET_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->eclass_must_not_set_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->eclass_must_not_set_variables())
.with_setenv("PALUDIS_SAVE_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->save_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->save_variables())
.with_setenv("PALUDIS_SAVE_BASE_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->save_base_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->save_base_variables())
.with_setenv("PALUDIS_SAVE_UNMODIFIABLE_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->save_unmodifiable_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->save_unmodifiable_variables())
.with_setenv("PALUDIS_DIRECTORY_IF_EXISTS_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->directory_if_exists_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->directory_if_exists_variables())
.with_setenv("PALUDIS_SOURCE_MERGED_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->source_merged_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->source_merged_variables())
.with_setenv("PALUDIS_BRACKET_MERGED_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->bracket_merged_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->bracket_merged_variables())
.with_setenv("PALUDIS_MUST_NOT_CHANGE_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->must_not_change_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->must_not_change_variables())
.with_setenv("PALUDIS_RDEPEND_DEFAULTS_TO_DEPEND",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->rdepend_defaults_to_depend() ? "yes" : "")
+ params.package_id()->eapi()->supported()->ebuild_options()->rdepend_defaults_to_depend() ? "yes" : "")
.with_setenv("PALUDIS_F_FUNCTION_PREFIX",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->f_function_prefix())
+ params.package_id()->eapi()->supported()->ebuild_options()->f_function_prefix())
.with_setenv("PALUDIS_IGNORE_PIVOT_ENV_FUNCTIONS",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ignore_pivot_env_functions())
+ params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_functions())
.with_setenv("PALUDIS_IGNORE_PIVOT_ENV_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
.with_setenv("PALUDIS_BINARY_DISTDIR_VARIABLE",
- params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_distdir())
+ params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_distdir())
.with_setenv("PALUDIS_UNPACK_UNRECOGNISED_IS_FATAL",
- params[k::package_id()]->eapi()->supported()->tools_options()->unpack_unrecognised_is_fatal() ? "yes" : "")
+ params.package_id()->eapi()->supported()->tools_options()->unpack_unrecognised_is_fatal() ? "yes" : "")
.with_setenv("PALUDIS_UNPACK_FIX_PERMISSIONS",
- params[k::package_id()]->eapi()->supported()->tools_options()->unpack_fix_permissions() ? "yes" : "")
+ params.package_id()->eapi()->supported()->tools_options()->unpack_fix_permissions() ? "yes" : "")
.with_setenv("PALUDIS_DOSYM_NO_MKDIR",
- params[k::package_id()]->eapi()->supported()->tools_options()->dosym_mkdir() ? "" : "yes")
+ params.package_id()->eapi()->supported()->tools_options()->dosym_mkdir() ? "" : "yes")
.with_setenv("PALUDIS_FAILURE_IS_FATAL",
- params[k::package_id()]->eapi()->supported()->tools_options()->failure_is_fatal() ? "yes" : "")
+ params.package_id()->eapi()->supported()->tools_options()->failure_is_fatal() ? "yes" : "")
.with_setenv("PALUDIS_UNPACK_FROM_VAR",
- params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_distdir())
+ params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_distdir())
.with_setenv("PALUDIS_PIPE_COMMANDS_SUPPORTED", "yes")
)
.with_setenv("SLOT", "")
.with_setenv("PALUDIS_PROFILE_DIR", "")
.with_setenv("PALUDIS_PROFILE_DIRS", "");
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_kv().empty())
- cmd.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_kv(), kernel_version());
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_portdir().empty())
- cmd.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_portdir(),
- stringify(params[k::portdir()]));
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_distdir().empty())
- cmd.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_distdir(),
- stringify(params[k::distdir()]));
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_kv().empty())
+ cmd.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_kv(), kernel_version());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_portdir().empty())
+ cmd.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_portdir(),
+ stringify(params.portdir()));
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_distdir().empty())
+ cmd.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_distdir(),
+ stringify(params.distdir()));
- if (params[k::package_id()]->eapi()->supported()->ebuild_options()->support_eclasses())
+ if (params.package_id()->eapi()->supported()->ebuild_options()->support_eclasses())
cmd
- .with_setenv("ECLASSDIR", stringify(*params[k::eclassdirs()]->begin()))
- .with_setenv("ECLASSDIRS", join(params[k::eclassdirs()]->begin(),
- params[k::eclassdirs()]->end(), " "));
+ .with_setenv("ECLASSDIR", stringify(*params.eclassdirs()->begin()))
+ .with_setenv("ECLASSDIRS", join(params.eclassdirs()->begin(),
+ params.eclassdirs()->end(), " "));
- if (params[k::package_id()]->eapi()->supported()->ebuild_options()->support_exlibs())
+ if (params.package_id()->eapi()->supported()->ebuild_options()->support_exlibs())
cmd
- .with_setenv("EXLIBSDIRS", join(params[k::exlibsdirs()]->begin(),
- params[k::exlibsdirs()]->end(), " "));
+ .with_setenv("EXLIBSDIRS", join(params.exlibsdirs()->begin(),
+ params.exlibsdirs()->end(), " "));
- if (params[k::package_id()]->eapi()->supported()->ebuild_options()->want_portage_emulation_vars())
+ if (params.package_id()->eapi()->supported()->ebuild_options()->want_portage_emulation_vars())
cmd = add_portage_vars(cmd);
if (do_run_command(cmd))
@@ -223,26 +222,26 @@ EbuildCommand::operator() ()
std::string
EbuildCommand::ebuild_file() const
{
- return stringify(params[k::ebuild_file()]);
+ return stringify(params.ebuild_file());
}
Command
EbuildCommand::add_portage_vars(const Command & cmd) const
{
return Command(cmd)
- .with_setenv("PORTAGE_ACTUAL_DISTDIR", stringify(params[k::distdir()]))
+ .with_setenv("PORTAGE_ACTUAL_DISTDIR", stringify(params.distdir()))
.with_setenv("PORTAGE_BASHRC", "/dev/null")
- .with_setenv("PORTAGE_BUILDDIR", stringify(params[k::builddir()]) + "/" +
- stringify(params[k::package_id()]->name().category) + "-" +
- stringify(params[k::package_id()]->name().package) + "-" +
- stringify(params[k::package_id()]->version()))
- .with_setenv("PORTAGE_CALLER", params[k::environment()]->paludis_command())
+ .with_setenv("PORTAGE_BUILDDIR", stringify(params.builddir()) + "/" +
+ stringify(params.package_id()->name().category) + "-" +
+ stringify(params.package_id()->name().package) + "-" +
+ stringify(params.package_id()->version()))
+ .with_setenv("PORTAGE_CALLER", params.environment()->paludis_command())
.with_setenv("PORTAGE_GID", "0")
.with_setenv("PORTAGE_INST_GID", "0")
.with_setenv("PORTAGE_INST_UID", "0")
.with_setenv("PORTAGE_MASTER_PID", stringify(::getpid()))
.with_setenv("PORTAGE_NICENCESS", stringify(::getpriority(PRIO_PROCESS, 0)))
- .with_setenv("PORTAGE_TMPDIR", stringify(params[k::builddir()]))
+ .with_setenv("PORTAGE_TMPDIR", stringify(params.builddir()))
.with_setenv("PORTAGE_TMPFS", "/dev/shm")
.with_setenv("PORTAGE_WORKDIR_MODE", "0700");
}
@@ -265,7 +264,7 @@ EbuildMetadataCommand::~EbuildMetadataCommand()
std::string
EbuildMetadataCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
@@ -278,9 +277,9 @@ Command
EbuildMetadataCommand::extend_command(const Command & cmd)
{
return Command(cmd)
- .with_uid_gid(params[k::environment()]->reduced_uid(), params[k::environment()]->reduced_gid())
- .with_stderr_prefix(stringify(params[k::package_id()]->name().package) + "-" +
- stringify(params[k::package_id()]->version()) + "> ");
+ .with_uid_gid(params.environment()->reduced_uid(), params.environment()->reduced_gid())
+ .with_stderr_prefix(stringify(params.package_id()->name().package) + "-" +
+ stringify(params.package_id()->version()) + "> ");
}
namespace
@@ -302,7 +301,7 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
std::string input;
try
{
- Context context("When running ebuild command to generate metadata for '" + stringify(*params[k::package_id()]) + "':");
+ Context context("When running ebuild command to generate metadata for '" + stringify(*params.package_id()) + "':");
std::stringstream prog;
Command real_cmd(cmd);
@@ -326,7 +325,7 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
{
Log::get_instance()->message("e.ebuild.cache_failure", ll_warning, lc_context) << "Caught exception '"
<< e.message() << "' (" << e.what() << ") when generating cache for '"
- << *params[k::package_id()] << "', input is '" << purdy(input) << "'";
+ << *params.package_id() << "', input is '" << purdy(input) << "'";
}
if (ok)
@@ -334,7 +333,7 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
else
{
Log::get_instance()->message("e.ebuild.cache_failure", ll_warning, lc_context) << "Could not generate cache for '"
- << *params[k::package_id()] << "'";
+ << *params.package_id() << "'";
keys.reset(new Map<std::string, std::string>);
keys->insert("EAPI", EAPIData::get_instance()->unknown_eapi()->name());
@@ -356,7 +355,7 @@ namespace
void
EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
{
- Context context("When loading generated metadata for '" + stringify(*params[k::package_id()]) + "':");
+ Context context("When loading generated metadata for '" + stringify(*params.package_id()) + "':");
if (! keys)
throw InternalError(PALUDIS_HERE, "keys is 0");
@@ -398,7 +397,7 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.dependencies().name().empty())
{
DependenciesRewriter rewriter;
- parse_depend(get(keys, m.dependencies().name()), params[k::environment()], id, *id->eapi())->accept(rewriter);
+ parse_depend(get(keys, m.dependencies().name()), params.environment(), id, *id->eapi())->accept(rewriter);
id->load_build_depend(m.dependencies().name() + ".DEPEND", m.dependencies().description() + " (build)", rewriter.depend());
id->load_run_depend(m.dependencies().name() + ".RDEPEND", m.dependencies().description() + " (run)", rewriter.rdepend());
id->load_post_depend(m.dependencies().name() + ".PDEPEND", m.dependencies().description() + " (post)", rewriter.pdepend());
@@ -480,7 +479,7 @@ EbuildVariableCommand::EbuildVariableCommand(const EbuildCommandParams & p,
std::string
EbuildVariableCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
@@ -494,7 +493,7 @@ EbuildVariableCommand::extend_command(const Command & cmd)
{
return Command(cmd)
.with_setenv("PALUDIS_VARIABLE", _var)
- .with_uid_gid(params[k::environment()]->reduced_uid(), params[k::environment()]->reduced_gid());
+ .with_uid_gid(params.environment()->reduced_uid(), params.environment()->reduced_gid());
}
bool
@@ -513,38 +512,38 @@ EbuildVariableCommand::do_run_command(const Command & cmd)
std::string
EbuildNoFetchCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
EbuildNoFetchCommand::failure()
{
- throw FetchActionError("Fetch failed for '" + stringify(*params[k::package_id()]) + "'");
+ throw FetchActionError("Fetch failed for '" + stringify(*params.package_id()) + "'");
}
Command
EbuildNoFetchCommand::extend_command(const Command & cmd)
{
Command result(Command(cmd)
- .with_setenv("A", fetch_params[k::a()])
- .with_setenv("ROOT", fetch_params[k::root()])
- .with_setenv("PALUDIS_PROFILE_DIR", stringify(*fetch_params[k::profiles()]->begin()))
- .with_setenv("PALUDIS_PROFILE_DIRS", join(fetch_params[k::profiles()]->begin(),
- fetch_params[k::profiles()]->end(), " ")));
-
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_aa().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_aa(),
- fetch_params[k::aa()]);
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use(),
- fetch_params[k::use()]);
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
- fetch_params[k::use_expand()]);
+ .with_setenv("A", fetch_params.a())
+ .with_setenv("ROOT", fetch_params.root())
+ .with_setenv("PALUDIS_PROFILE_DIR", stringify(*fetch_params.profiles()->begin()))
+ .with_setenv("PALUDIS_PROFILE_DIRS", join(fetch_params.profiles()->begin(),
+ fetch_params.profiles()->end(), " ")));
+
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_aa().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_aa(),
+ fetch_params.aa());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use(),
+ fetch_params.use());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
+ fetch_params.use_expand());
for (Map<std::string, std::string>::ConstIterator
- i(fetch_params[k::expand_vars()]->begin()),
- j(fetch_params[k::expand_vars()]->end()) ; i != j ; ++i)
+ i(fetch_params.expand_vars()->begin()),
+ j(fetch_params.expand_vars()->end()) ; i != j ; ++i)
result.with_setenv(i->first, i->second);
return result;
@@ -560,42 +559,42 @@ EbuildNoFetchCommand::EbuildNoFetchCommand(const EbuildCommandParams & p,
std::string
EbuildInstallCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
EbuildInstallCommand::failure()
{
- throw InstallActionError("Install failed for '" + stringify(*params[k::package_id()]) + "'");
+ throw InstallActionError("Install failed for '" + stringify(*params.package_id()) + "'");
}
Command
EbuildInstallCommand::extend_command(const Command & cmd)
{
Command result(Command(cmd)
- .with_setenv("A", install_params[k::a()])
- .with_setenv("ROOT", install_params[k::root()])
- .with_setenv("PALUDIS_LOADSAVEENV_DIR", stringify(install_params[k::loadsaveenv_dir()]))
- .with_setenv("PALUDIS_CONFIG_PROTECT", install_params[k::config_protect()])
- .with_setenv("PALUDIS_CONFIG_PROTECT_MASK", install_params[k::config_protect_mask()])
- .with_setenv("PALUDIS_PROFILE_DIR", stringify(*install_params[k::profiles()]->begin()))
- .with_setenv("PALUDIS_PROFILE_DIRS", join(install_params[k::profiles()]->begin(),
- install_params[k::profiles()]->end(), " "))
- .with_setenv("SLOT", stringify(install_params[k::slot()])));
-
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_aa().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_aa(),
- install_params[k::aa()]);
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use(),
- install_params[k::use()]);
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
- install_params[k::use_expand()]);
+ .with_setenv("A", install_params.a())
+ .with_setenv("ROOT", install_params.root())
+ .with_setenv("PALUDIS_LOADSAVEENV_DIR", stringify(install_params.loadsaveenv_dir()))
+ .with_setenv("PALUDIS_CONFIG_PROTECT", install_params.config_protect())
+ .with_setenv("PALUDIS_CONFIG_PROTECT_MASK", install_params.config_protect_mask())
+ .with_setenv("PALUDIS_PROFILE_DIR", stringify(*install_params.profiles()->begin()))
+ .with_setenv("PALUDIS_PROFILE_DIRS", join(install_params.profiles()->begin(),
+ install_params.profiles()->end(), " "))
+ .with_setenv("SLOT", stringify(install_params.slot())));
+
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_aa().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_aa(),
+ install_params.aa());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use(),
+ install_params.use());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
+ install_params.use_expand());
for (Map<std::string, std::string>::ConstIterator
- i(install_params[k::expand_vars()]->begin()),
- j(install_params[k::expand_vars()]->end()) ; i != j ; ++i)
+ i(install_params.expand_vars()->begin()),
+ j(install_params.expand_vars()->end()) ; i != j ; ++i)
result.with_setenv(i->first, i->second);
return result;
@@ -611,7 +610,7 @@ EbuildInstallCommand::EbuildInstallCommand(const EbuildCommandParams & p,
std::string
EbuildUninstallCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
std::string
@@ -623,20 +622,20 @@ EbuildUninstallCommand::ebuild_file() const
bool
EbuildUninstallCommand::failure()
{
- throw UninstallActionError("Uninstall failed for '" + stringify(*params[k::package_id()]) + "'");
+ throw UninstallActionError("Uninstall failed for '" + stringify(*params.package_id()) + "'");
}
Command
EbuildUninstallCommand::extend_command(const Command & cmd)
{
Command result(Command(cmd)
- .with_setenv("ROOT", uninstall_params[k::root()])
- .with_setenv("PALUDIS_LOADSAVEENV_DIR", stringify(uninstall_params[k::loadsaveenv_dir()]))
+ .with_setenv("ROOT", uninstall_params.root())
+ .with_setenv("PALUDIS_LOADSAVEENV_DIR", stringify(uninstall_params.loadsaveenv_dir()))
);
- if (uninstall_params[k::load_environment()])
+ if (uninstall_params.load_environment())
result
- .with_setenv("PALUDIS_LOAD_ENVIRONMENT", stringify(*uninstall_params[k::load_environment()]))
+ .with_setenv("PALUDIS_LOAD_ENVIRONMENT", stringify(*uninstall_params.load_environment()))
.with_setenv("PALUDIS_SKIP_INHERIT", "yes");
return result;
@@ -658,24 +657,24 @@ EbuildConfigCommand::ebuild_file() const
std::string
EbuildConfigCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
EbuildConfigCommand::failure()
{
- throw ConfigActionError("Configure failed for '" + stringify(*params[k::package_id()]) + "'");
+ throw ConfigActionError("Configure failed for '" + stringify(*params.package_id()) + "'");
}
Command
EbuildConfigCommand::extend_command(const Command & cmd)
{
Command result(Command(cmd)
- .with_setenv("ROOT", config_params[k::root()]));
+ .with_setenv("ROOT", config_params.root()));
- if (config_params[k::load_environment()])
+ if (config_params.load_environment())
result
- .with_setenv("PALUDIS_LOAD_ENVIRONMENT", stringify(*config_params[k::load_environment()]))
+ .with_setenv("PALUDIS_LOAD_ENVIRONMENT", stringify(*config_params.load_environment()))
.with_setenv("PALUDIS_SKIP_INHERIT", "yes");
return result;
@@ -700,13 +699,13 @@ WriteVDBEntryCommand::operator() ()
std::string ebuild_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
"/write_vdb_entry.bash '" +
- stringify(params[k::output_directory()]) + "' '" +
- stringify(params[k::environment_file()]) + "'");
+ stringify(params.output_directory()) + "' '" +
+ stringify(params.environment_file()) + "'");
- std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(params[k::environment()]->syncers_dirs());
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(params[k::environment()]->bashrc_files());
- std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(params[k::environment()]->fetchers_dirs());
- std::tr1::shared_ptr<const FSEntrySequence> hook_dirs(params[k::environment()]->hook_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(params.environment()->syncers_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(params.environment()->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(params.environment()->fetchers_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> hook_dirs(params.environment()->hook_dirs());
Command cmd(Command(ebuild_cmd)
.with_setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
@@ -714,26 +713,26 @@ WriteVDBEntryCommand::operator() ()
stringify(PALUDIS_VERSION_MICRO) +
(std::string(PALUDIS_GIT_HEAD).empty() ?
std::string("") : "-git-" + std::string(PALUDIS_GIT_HEAD)))
- .with_setenv("EAPI", stringify(params[k::package_id()]->eapi()->exported_name()))
+ .with_setenv("EAPI", stringify(params.package_id()->eapi()->exported_name()))
.with_setenv("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
.with_setenv("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "))
.with_setenv("PALUDIS_HOOK_DIRS", join(hook_dirs->begin(), hook_dirs->end(), " "))
.with_setenv("PALUDIS_FETCHERS_DIRS", join(fetchers_dirs->begin(), fetchers_dirs->end(), " "))
.with_setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " "))
- .with_setenv("PALUDIS_COMMAND", params[k::environment()]->paludis_command())
+ .with_setenv("PALUDIS_COMMAND", params.environment()->paludis_command())
.with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
.with_setenv("PALUDIS_VDB_FROM_ENV_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->vdb_from_env_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->vdb_from_env_variables())
.with_setenv("PALUDIS_VDB_FROM_ENV_UNLESS_EMPTY_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->vdb_from_env_unless_empty_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->vdb_from_env_unless_empty_variables())
.with_setenv("PALUDIS_F_FUNCTION_PREFIX",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->f_function_prefix())
+ params.package_id()->eapi()->supported()->ebuild_options()->f_function_prefix())
.with_setenv("PALUDIS_IGNORE_PIVOT_ENV_FUNCTIONS",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ignore_pivot_env_functions())
+ params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_functions())
.with_setenv("PALUDIS_IGNORE_PIVOT_ENV_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
- .with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params[k::environment()], params[k::package_id()], _1))
+ params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
+ .with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params.environment(), params.package_id(), _1))
);
if (0 != (run_command(cmd)))
@@ -752,7 +751,7 @@ VDBPostMergeCommand::operator() ()
return;
Command cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
- "/utils/wrapped_ldconfig '" + stringify(params[k::root()]) + "'");
+ "/utils/wrapped_ldconfig '" + stringify(params.root()) + "'");
if (0 != (run_command(cmd)))
throw InstallActionError("VDB Entry post merge commands failed");
@@ -761,7 +760,7 @@ VDBPostMergeCommand::operator() ()
std::string
EbuildPretendCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
@@ -774,30 +773,30 @@ Command
EbuildPretendCommand::extend_command(const Command & cmd)
{
Command result(Command(cmd)
- .with_stdout_prefix(stringify(params[k::package_id()]->name().package) + "-" +
- stringify(params[k::package_id()]->version()) + "> ")
- .with_stderr_prefix(stringify(params[k::package_id()]->name().package) + "-" +
- stringify(params[k::package_id()]->version()) + "> ")
+ .with_stdout_prefix(stringify(params.package_id()->name().package) + "-" +
+ stringify(params.package_id()->version()) + "> ")
+ .with_stderr_prefix(stringify(params.package_id()->name().package) + "-" +
+ stringify(params.package_id()->version()) + "> ")
.with_prefix_discard_blank_output()
.with_prefix_blank_lines()
- .with_setenv("ROOT", pretend_params[k::root()])
- .with_setenv("PALUDIS_PROFILE_DIR", stringify(*pretend_params[k::profiles()]->begin()))
- .with_setenv("PALUDIS_PROFILE_DIRS", join(pretend_params[k::profiles()]->begin(),
- pretend_params[k::profiles()]->end(), " ")));
-
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use(),
- pretend_params[k::use()]);
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
- pretend_params[k::use_expand()]);
+ .with_setenv("ROOT", pretend_params.root())
+ .with_setenv("PALUDIS_PROFILE_DIR", stringify(*pretend_params.profiles()->begin()))
+ .with_setenv("PALUDIS_PROFILE_DIRS", join(pretend_params.profiles()->begin(),
+ pretend_params.profiles()->end(), " ")));
+
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use(),
+ pretend_params.use());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
+ pretend_params.use_expand());
for (Map<std::string, std::string>::ConstIterator
- i(pretend_params[k::expand_vars()]->begin()),
- j(pretend_params[k::expand_vars()]->end()) ; i != j ; ++i)
+ i(pretend_params.expand_vars()->begin()),
+ j(pretend_params.expand_vars()->end()) ; i != j ; ++i)
result.with_setenv(i->first, i->second);
- result.with_uid_gid(params[k::environment()]->reduced_uid(), params[k::environment()]->reduced_gid());
+ result.with_uid_gid(params.environment()->reduced_uid(), params.environment()->reduced_gid());
return result;
}
@@ -812,8 +811,8 @@ EbuildPretendCommand::EbuildPretendCommand(const EbuildCommandParams & p,
std::string
EbuildInfoCommand::ebuild_file() const
{
- if (info_params[k::use_ebuild_file()])
- return stringify(params[k::ebuild_file()]);
+ if (info_params.use_ebuild_file())
+ return stringify(params.ebuild_file());
else
return "-";
}
@@ -821,7 +820,7 @@ EbuildInfoCommand::ebuild_file() const
std::string
EbuildInfoCommand::commands() const
{
- return params[k::commands()];
+ return params.commands();
}
bool
@@ -833,37 +832,37 @@ EbuildInfoCommand::failure()
Command
EbuildInfoCommand::extend_command(const Command & cmd)
{
- std::string info_vars(join(info_params[k::info_vars()]->begin(), info_params[k::info_vars()]->end(), " "));
+ std::string info_vars(join(info_params.info_vars()->begin(), info_params.info_vars()->end(), " "));
Command result(Command(cmd)
.with_stdout_prefix(" ")
.with_stderr_prefix(" ")
.with_prefix_discard_blank_output()
.with_prefix_blank_lines()
- .with_setenv("ROOT", info_params[k::root()])
+ .with_setenv("ROOT", info_params.root())
.with_setenv("PALUDIS_INFO_VARS", info_vars)
.with_setenv("PALUDIS_PROFILE_DIR",
- info_params[k::profiles()]->empty() ? std::string("") : stringify(*info_params[k::profiles()]->begin()))
- .with_setenv("PALUDIS_PROFILE_DIRS", join(info_params[k::profiles()]->begin(),
- info_params[k::profiles()]->end(), " ")));
+ info_params.profiles()->empty() ? std::string("") : stringify(*info_params.profiles()->begin()))
+ .with_setenv("PALUDIS_PROFILE_DIRS", join(info_params.profiles()->begin(),
+ info_params.profiles()->end(), " ")));
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use(),
- info_params[k::use()]);
- if (! params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
- result.with_setenv(params[k::package_id()]->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
- info_params[k::use_expand()]);
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use(),
+ info_params.use());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand(),
+ info_params.use_expand());
for (Map<std::string, std::string>::ConstIterator
- i(info_params[k::expand_vars()]->begin()),
- j(info_params[k::expand_vars()]->end()) ; i != j ; ++i)
+ i(info_params.expand_vars()->begin()),
+ j(info_params.expand_vars()->end()) ; i != j ; ++i)
result.with_setenv(i->first, i->second);
- result.with_uid_gid(params[k::environment()]->reduced_uid(), params[k::environment()]->reduced_gid());
+ result.with_uid_gid(params.environment()->reduced_uid(), params.environment()->reduced_gid());
- if (info_params[k::load_environment()])
+ if (info_params.load_environment())
result
- .with_setenv("PALUDIS_LOAD_ENVIRONMENT", stringify(*info_params[k::load_environment()]))
+ .with_setenv("PALUDIS_LOAD_ENVIRONMENT", stringify(*info_params.load_environment()))
.with_setenv("PALUDIS_SKIP_INHERIT", "yes");
return result;
@@ -886,25 +885,25 @@ WriteBinaryEbuildCommand::operator() ()
{
using namespace std::tr1::placeholders;
- if (! EAPIData::get_instance()->eapi_from_string("pbin-1+" + params[k::package_id()]->eapi()->exported_name())->supported())
+ if (! EAPIData::get_instance()->eapi_from_string("pbin-1+" + params.package_id()->eapi()->exported_name())->supported())
throw InstallActionError("Don't know how to write binary ebuilds using EAPI 'pbin-1+" +
- params[k::package_id()]->eapi()->exported_name());
+ params.package_id()->eapi()->exported_name());
- std::string bindistfile(stringify(params[k::destination_repository()]->name()) + "--" + stringify(params[k::package_id()]->name().category)
- + "--" + stringify(params[k::package_id()]->name().package) + "-" + stringify(params[k::package_id()]->version())
+ std::string bindistfile(stringify(params.destination_repository()->name()) + "--" + stringify(params.package_id()->name().category)
+ + "--" + stringify(params.package_id()->name().package) + "-" + stringify(params.package_id()->version())
+ "--" + cookie());
std::string ebuild_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
"/write_binary_ebuild.bash '" +
- stringify(params[k::binary_ebuild_location()]) + "' '" +
- stringify(params[k::binary_distdir()] / bindistfile) + "' '" +
- stringify(params[k::environment_file()]) + "' '" +
- stringify(params[k::image()]) + "'");
+ stringify(params.binary_ebuild_location()) + "' '" +
+ stringify(params.binary_distdir() / bindistfile) + "' '" +
+ stringify(params.environment_file()) + "' '" +
+ stringify(params.image()) + "'");
- std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(params[k::environment()]->syncers_dirs());
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(params[k::environment()]->bashrc_files());
- std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(params[k::environment()]->fetchers_dirs());
- std::tr1::shared_ptr<const FSEntrySequence> hook_dirs(params[k::environment()]->hook_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(params.environment()->syncers_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(params.environment()->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(params.environment()->fetchers_dirs());
+ std::tr1::shared_ptr<const FSEntrySequence> hook_dirs(params.environment()->hook_dirs());
Command cmd(Command(ebuild_cmd)
.with_setenv("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
@@ -912,31 +911,31 @@ WriteBinaryEbuildCommand::operator() ()
stringify(PALUDIS_VERSION_MICRO) +
(std::string(PALUDIS_GIT_HEAD).empty() ?
std::string("") : "-git-" + std::string(PALUDIS_GIT_HEAD)))
- .with_setenv("EAPI", stringify(params[k::package_id()]->eapi()->exported_name()))
+ .with_setenv("EAPI", stringify(params.package_id()->eapi()->exported_name()))
.with_setenv("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
- .with_setenv("PALUDIS_TMPDIR", stringify(params[k::builddir()]))
+ .with_setenv("PALUDIS_TMPDIR", stringify(params.builddir()))
.with_setenv("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "))
.with_setenv("PALUDIS_HOOK_DIRS", join(hook_dirs->begin(), hook_dirs->end(), " "))
.with_setenv("PALUDIS_FETCHERS_DIRS", join(fetchers_dirs->begin(), fetchers_dirs->end(), " "))
.with_setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " "))
- .with_setenv("PALUDIS_COMMAND", params[k::environment()]->paludis_command())
+ .with_setenv("PALUDIS_COMMAND", params.environment()->paludis_command())
.with_setenv("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
.with_setenv("PALUDIS_BINARY_FROM_ENV_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->binary_from_env_variables())
+ params.package_id()->eapi()->supported()->ebuild_options()->binary_from_env_variables())
.with_setenv("PALUDIS_F_FUNCTION_PREFIX",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->f_function_prefix())
+ params.package_id()->eapi()->supported()->ebuild_options()->f_function_prefix())
.with_setenv("PALUDIS_IGNORE_PIVOT_ENV_FUNCTIONS",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ignore_pivot_env_functions())
+ params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_functions())
.with_setenv("PALUDIS_IGNORE_PIVOT_ENV_VARIABLES",
- params[k::package_id()]->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
- .with_setenv("PALUDIS_BINARY_URI_PREFIX", params[k::destination_repository()]->params().binary_uri_prefix)
- .with_setenv("PALUDIS_BINARY_KEYWORDS", params[k::destination_repository()]->params().binary_keywords)
+ params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
+ .with_setenv("PALUDIS_BINARY_URI_PREFIX", params.destination_repository()->params().binary_uri_prefix)
+ .with_setenv("PALUDIS_BINARY_KEYWORDS", params.destination_repository()->params().binary_keywords)
.with_setenv("PALUDIS_BINARY_KEYWORDS_VARIABLE", EAPIData::get_instance()->eapi_from_string("pbin-1+"
- + params[k::package_id()]->eapi()->exported_name())->supported()->ebuild_metadata_variables()->keywords().name())
+ + params.package_id()->eapi()->exported_name())->supported()->ebuild_metadata_variables()->keywords().name())
.with_setenv("PALUDIS_BINARY_DISTDIR_VARIABLE", EAPIData::get_instance()->eapi_from_string("pbin-1+"
- + params[k::package_id()]->eapi()->exported_name())->supported()->ebuild_environment_variables()->env_distdir())
- .with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params[k::environment()], params[k::package_id()], _1))
+ + params.package_id()->eapi()->exported_name())->supported()->ebuild_environment_variables()->env_distdir())
+ .with_pipe_command_handler(std::tr1::bind(&pipe_command_handler, params.environment(), params.package_id(), _1))
);
if (0 != (run_command(cmd)))
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index ebc7ac6..ad27411 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -24,8 +24,6 @@
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/map-fwd.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
#include <paludis/package_database.hh>
#include <paludis/action-fwd.hh>
#include <paludis/merger-fwd.hh>
@@ -43,6 +41,45 @@ namespace paludis
class Command;
class ERepository;
+ namespace n
+ {
+ struct a;
+ struct aa;
+ struct binary_distdir;
+ struct binary_ebuild_location;
+ struct builddir;
+ struct commands;
+ struct config_protect;
+ struct config_protect_mask;
+ struct destination_repository;
+ struct distdir;
+ struct ebuild_dir;
+ struct ebuild_file;
+ struct eclassdirs;
+ struct environment;
+ struct environment_file;
+ struct exlibsdirs;
+ struct expand_vars;
+ struct files_dir;
+ struct image;
+ struct info_vars;
+ struct load_environment;
+ struct loadsaveenv_dir;
+ struct merger_options;
+ struct output_directory;
+ struct package_id;
+ struct portdir;
+ struct profiles;
+ struct root;
+ struct sandbox;
+ struct slot;
+ struct unmerge_only;
+ struct use;
+ struct use_ebuild_file;
+ struct use_expand;
+ struct userpriv;
+ }
+
namespace erepository
{
class EbuildID;
@@ -55,21 +92,22 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::environment, const Environment *>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const erepository::ERepositoryID> >,
- kc::Field<k::ebuild_dir, FSEntry>,
- kc::Field<k::ebuild_file, FSEntry>,
- kc::Field<k::files_dir, FSEntry>,
- kc::Field<k::eclassdirs, std::tr1::shared_ptr<const FSEntrySequence> >,
- kc::Field<k::exlibsdirs, std::tr1::shared_ptr<const FSEntrySequence> >,
- kc::Field<k::portdir, FSEntry>,
- kc::Field<k::distdir, FSEntry>,
- kc::Field<k::builddir, FSEntry>,
- kc::Field<k::userpriv, bool>,
- kc::Field<k::sandbox, bool>,
- kc::Field<k::commands, std::string>
- > EbuildCommandParams;
+ struct EbuildCommandParams
+ {
+ NamedValue<n::builddir, FSEntry> builddir;
+ NamedValue<n::commands, std::string> commands;
+ NamedValue<n::distdir, FSEntry> distdir;
+ NamedValue<n::ebuild_dir, FSEntry> ebuild_dir;
+ NamedValue<n::ebuild_file, FSEntry> ebuild_file;
+ NamedValue<n::eclassdirs, std::tr1::shared_ptr<const FSEntrySequence> > eclassdirs;
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::exlibsdirs, std::tr1::shared_ptr<const FSEntrySequence> > exlibsdirs;
+ NamedValue<n::files_dir, FSEntry> files_dir;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const erepository::ERepositoryID> > package_id;
+ NamedValue<n::portdir, FSEntry> portdir;
+ NamedValue<n::sandbox, bool> sandbox;
+ NamedValue<n::userpriv, bool> userpriv;
+ };
/**
* Parameters for an EbuildNoFetchCommand.
@@ -78,15 +116,16 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::a, std::string>,
- kc::Field<k::aa, std::string>,
- kc::Field<k::use, std::string>,
- kc::Field<k::use_expand, std::string>,
- kc::Field<k::root, std::string>,
- kc::Field<k::profiles, std::tr1::shared_ptr<const FSEntrySequence> >,
- kc::Field<k::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > >
- > EbuildNoFetchCommandParams;
+ struct EbuildNoFetchCommandParams
+ {
+ NamedValue<n::a, std::string> a;
+ NamedValue<n::aa, std::string> aa;
+ NamedValue<n::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > > expand_vars;
+ NamedValue<n::profiles, std::tr1::shared_ptr<const FSEntrySequence> > profiles;
+ NamedValue<n::root, std::string> root;
+ NamedValue<n::use, std::string> use;
+ NamedValue<n::use_expand, std::string> use_expand;
+ };
/**
* Parameters for an EbuildInstallCommand.
@@ -95,19 +134,20 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::a, std::string>,
- kc::Field<k::aa, std::string>,
- kc::Field<k::use, std::string>,
- kc::Field<k::use_expand, std::string>,
- kc::Field<k::root, std::string>,
- kc::Field<k::profiles, std::tr1::shared_ptr<const FSEntrySequence> >,
- kc::Field<k::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > >,
- kc::Field<k::slot, SlotName>,
- kc::Field<k::config_protect, std::string>,
- kc::Field<k::config_protect_mask, std::string>,
- kc::Field<k::loadsaveenv_dir, FSEntry>
- > EbuildInstallCommandParams;
+ struct EbuildInstallCommandParams
+ {
+ NamedValue<n::a, std::string> a;
+ NamedValue<n::aa, std::string> aa;
+ NamedValue<n::config_protect, std::string> config_protect;
+ NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > > expand_vars;
+ NamedValue<n::loadsaveenv_dir, FSEntry> loadsaveenv_dir;
+ NamedValue<n::profiles, std::tr1::shared_ptr<const FSEntrySequence> > profiles;
+ NamedValue<n::root, std::string> root;
+ NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::use, std::string> use;
+ NamedValue<n::use_expand, std::string> use_expand;
+ };
/**
* Parameters for an EbuildPretendCommand.
@@ -116,13 +156,14 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::use, std::string>,
- kc::Field<k::use_expand, std::string>,
- kc::Field<k::root, std::string>,
- kc::Field<k::profiles, std::tr1::shared_ptr<const FSEntrySequence> >,
- kc::Field<k::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > >
- > EbuildPretendCommandParams;
+ struct EbuildPretendCommandParams
+ {
+ NamedValue<n::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > > expand_vars;
+ NamedValue<n::profiles, std::tr1::shared_ptr<const FSEntrySequence> > profiles;
+ NamedValue<n::root, std::string> root;
+ NamedValue<n::use, std::string> use;
+ NamedValue<n::use_expand, std::string> use_expand;
+ };
/**
* Parameters for an EbuildUninstallCommand.
@@ -131,12 +172,13 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::root, std::string>,
- kc::Field<k::unmerge_only, bool>,
- kc::Field<k::load_environment, const FSEntry *>,
- kc::Field<k::loadsaveenv_dir, FSEntry>
- > EbuildUninstallCommandParams;
+ struct EbuildUninstallCommandParams
+ {
+ NamedValue<n::load_environment, const FSEntry *> load_environment;
+ NamedValue<n::loadsaveenv_dir, FSEntry> loadsaveenv_dir;
+ NamedValue<n::root, std::string> root;
+ NamedValue<n::unmerge_only, bool> unmerge_only;
+ };
/**
* Parameters for an EbuildConfigCommand.
@@ -145,10 +187,11 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::root, std::string>,
- kc::Field<k::load_environment, const FSEntry *>
- > EbuildConfigCommandParams;
+ struct EbuildConfigCommandParams
+ {
+ NamedValue<n::load_environment, const FSEntry *> load_environment;
+ NamedValue<n::root, std::string> root;
+ };
/**
* Parameters for an EbuildInfoCommand.
@@ -157,16 +200,17 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::use, std::string>,
- kc::Field<k::use_expand, std::string>,
- kc::Field<k::root, std::string>,
- kc::Field<k::profiles, std::tr1::shared_ptr<const FSEntrySequence> >,
- kc::Field<k::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > >,
- kc::Field<k::load_environment, const FSEntry *>,
- kc::Field<k::info_vars, std::tr1::shared_ptr<const Set<std::string> > >,
- kc::Field<k::use_ebuild_file, bool>
- > EbuildInfoCommandParams;
+ struct EbuildInfoCommandParams
+ {
+ NamedValue<n::expand_vars, std::tr1::shared_ptr<const Map<std::string, std::string> > > expand_vars;
+ NamedValue<n::info_vars, std::tr1::shared_ptr<const Set<std::string> > > info_vars;
+ NamedValue<n::load_environment, const FSEntry *> load_environment;
+ NamedValue<n::profiles, std::tr1::shared_ptr<const FSEntrySequence> > profiles;
+ NamedValue<n::root, std::string> root;
+ NamedValue<n::use, std::string> use;
+ NamedValue<n::use_ebuild_file, bool> use_ebuild_file;
+ NamedValue<n::use_expand, std::string> use_expand;
+ };
/**
* Parameters for writing a VDB entry.
@@ -175,12 +219,13 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::environment, const Environment *>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const erepository::ERepositoryID> >,
- kc::Field<k::output_directory, FSEntry>,
- kc::Field<k::environment_file, FSEntry>
- > WriteVDBEntryParams;
+ struct WriteVDBEntryParams
+ {
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::environment_file, FSEntry> environment_file;
+ NamedValue<n::output_directory, FSEntry> output_directory;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const erepository::ERepositoryID> > package_id;
+ };
/**
* Parameters for writing a binary ebuild.
@@ -189,17 +234,18 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::environment, const Environment *>,
- kc::Field<k::destination_repository, const ERepository *>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const erepository::ERepositoryID> >,
- kc::Field<k::binary_ebuild_location, FSEntry>,
- kc::Field<k::binary_distdir, FSEntry>,
- kc::Field<k::environment_file, FSEntry>,
- kc::Field<k::image, FSEntry>,
- kc::Field<k::merger_options, MergerOptions>,
- kc::Field<k::builddir, FSEntry>
- > WriteBinaryEbuildCommandParams;
+ struct WriteBinaryEbuildCommandParams
+ {
+ NamedValue<n::binary_distdir, FSEntry> binary_distdir;
+ NamedValue<n::binary_ebuild_location, FSEntry> binary_ebuild_location;
+ NamedValue<n::builddir, FSEntry> builddir;
+ NamedValue<n::destination_repository, const ERepository *> destination_repository;
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::environment_file, FSEntry> environment_file;
+ NamedValue<n::image, FSEntry> image;
+ NamedValue<n::merger_options, MergerOptions> merger_options;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const erepository::ERepositoryID> > package_id;
+ };
/**
* Parameters for a VDBPostMergeCommand.
@@ -208,9 +254,10 @@ namespace paludis
* \ingroup grpebuildinterface
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::root, FSEntry>
- > VDBPostMergeCommandParams;
+ struct VDBPostMergeCommandParams
+ {
+ NamedValue<n::root, FSEntry> root;
+ };
/**
* An EbuildCommand is the base class from which specific ebuild
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 6f60fe9..4295107 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -49,10 +49,10 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/instantiation_policy-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <fstream>
#include <list>
@@ -431,10 +431,10 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
stringify(_imp->e_repository->params().master_repository->name()) :
stringify(_imp->e_repository->name()));
FetchVisitor f(_imp->params.environment, id, *id->eapi(),
- _imp->e_repository->params().distdir, o[k::fetch_unneeded()], fetch_userpriv_ok, mirrors_name,
- id->fetches_key()->initial_label(), o[k::safe_resume()]);
+ _imp->e_repository->params().distdir, o.fetch_unneeded(), fetch_userpriv_ok, mirrors_name,
+ id->fetches_key()->initial_label(), o.safe_resume());
id->fetches_key()->value()->accept(f);
- CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o[k::fetch_unneeded()], fetch_restrict,
+ CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir, o.fetch_unneeded(), fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
_imp->e_repository->params().use_manifest);
id->fetches_key()->value()->accept(c);
@@ -454,31 +454,32 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
- EbuildCommandParams command_params(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), _imp->e_repository->layout()->package_directory(id->name()))
- (k::ebuild_file(), id->fs_location_key()->value())
- (k::files_dir(), _imp->e_repository->layout()->package_directory(id->name()) / "files")
- (k::eclassdirs(), _imp->params.eclassdirs)
- (k::exlibsdirs(), exlibsdirs)
- (k::portdir(), _imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- (k::distdir(), _imp->params.distdir)
- (k::userpriv(), phase->option("userpriv") && userpriv_ok)
- (k::sandbox(), phase->option("sandbox"))
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::builddir(), _imp->params.builddir));
+ EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(_imp->params.distdir),
+ value_for<n::ebuild_dir>(_imp->e_repository->layout()->package_directory(id->name())),
+ value_for<n::ebuild_file>(id->fs_location_key()->value()),
+ value_for<n::eclassdirs>(_imp->params.eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(exlibsdirs),
+ value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
+ ));
EbuildNoFetchCommand nofetch_cmd(command_params,
- EbuildNoFetchCommandParams::named_create()
- (k::a(), archives)
- (k::aa(), all_archives)
- (k::use(), use)
- (k::use_expand(), join(p->begin_use_expand(), p->end_use_expand(), " "))
- (k::expand_vars(), expand_vars)
- (k::root(), "/")
- (k::profiles(), _imp->params.profiles));
+ make_named_values<EbuildNoFetchCommandParams>(
+ value_for<n::a>(archives),
+ value_for<n::aa>(all_archives),
+ value_for<n::expand_vars>(expand_vars),
+ value_for<n::profiles>(_imp->params.profiles),
+ value_for<n::root>("/"),
+ value_for<n::use>(use),
+ value_for<n::use_expand>(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ ));
if (! nofetch_cmd())
throw FetchActionError("Fetch of '" + stringify(*id) + "' failed", c.failures());
@@ -501,7 +502,7 @@ EbuildEntries::pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> & i
if (id->fetches_key())
{
PretendFetchVisitor f(_imp->params.environment, id, *id->eapi(),
- _imp->e_repository->params().distdir, a.options[k::fetch_unneeded()],
+ _imp->e_repository->params().distdir, a.options.fetch_unneeded(),
id->fetches_key()->initial_label(), a);
id->fetches_key()->value()->accept(f);
}
@@ -609,28 +610,28 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
{
if (phase->option("merge"))
{
- if (! (*o[k::destination()])[k::destination_interface()])
+ if (! (*o.destination()).destination_interface())
throw InstallActionError("Can't install '" + stringify(*id)
- + "' to destination '" + stringify(o[k::destination()]->name())
+ + "' to destination '" + stringify(o.destination()->name())
+ "' because destination does not provide destination_interface");
- (*o[k::destination()])[k::destination_interface()]->merge(
- MergeParams::named_create()
- (k::package_id(), id)
- (k::image_dir(), _imp->params.builddir / (stringify(id->name().category) + "-" + stringify(id->name().package) + "-"
- + stringify(id->version())) / "image")
- (k::environment_file(), _imp->params.builddir / (stringify(id->name().category) + "-" + stringify(id->name().package) + "-"
- + stringify(id->version())) / "temp" / "loadsaveenv")
- (k::options(), id->eapi()->supported()->merger_options())
- );
+ (*o.destination()).destination_interface()->merge(
+ make_named_values<MergeParams>(
+ value_for<n::environment_file>(_imp->params.builddir / (stringify(id->name().category) + "-" +
+ stringify(id->name().package) + "-" + stringify(id->version())) / "temp" / "loadsaveenv"),
+ value_for<n::image_dir>(_imp->params.builddir / (stringify(id->name().category) + "-" +
+ stringify(id->name().package) + "-" + stringify(id->version())) / "image"),
+ value_for<n::options>(id->eapi()->supported()->merger_options()),
+ value_for<n::package_id>(id)
+ ));
}
else if (phase->option("strip"))
{
if (! strip_restrict)
{
std::string libdir("lib");
- FSEntry root(o[k::destination()]->installed_root_key() ?
- stringify(o[k::destination()]->installed_root_key()->value()) : "/");
+ FSEntry root(o.destination()->installed_root_key() ?
+ stringify(o.destination()->installed_root_key()->value()) : "/");
if ((root / "usr" / "lib").is_symbolic_link())
{
libdir = (root / "usr" / "lib").readlink();
@@ -640,27 +641,27 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
Log::get_instance()->message("e.ebuild.libdir", ll_debug, lc_context) << "Using '" << libdir << "' for libdir";
- EStripper stripper(EStripperOptions::named_create()
- (k::package_id(), id)
- (k::image_dir(), _imp->params.builddir / (stringify(id->name().category) + "-" + stringify(id->name().package) + "-"
- + stringify(id->version())) / "image")
- (k::debug_dir(), _imp->params.builddir / (stringify(id->name().category) + "-" + stringify(id->name().package) + "-"
- + stringify(id->version())) / "image" / "usr" / libdir / "debug")
- (k::debug_build(), o[k::debug_build()])
- );
+ EStripper stripper(make_named_values<EStripperOptions>(
+ value_for<n::debug_build>(o.debug_build()),
+ value_for<n::debug_dir>(_imp->params.builddir / (stringify(id->name().category) + "-" +
+ stringify(id->name().package) + "-" + stringify(id->version())) / "image" / "usr" / libdir / "debug"),
+ value_for<n::image_dir>(_imp->params.builddir / (stringify(id->name().category) + "-" +
+ stringify(id->name().package) + "-" + stringify(id->version())) / "image"),
+ value_for<n::package_id>(id)
+ ));
stripper.strip();
}
}
else if ((! phase->option("prepost")) ||
- ((*o[k::destination()])[k::destination_interface()] &&
- (*o[k::destination()])[k::destination_interface()]->want_pre_post_phases()))
+ ((*o.destination()).destination_interface() &&
+ (*o.destination()).destination_interface()->want_pre_post_phases()))
{
if (phase->option("checkphase"))
{
if (test_restrict)
continue;
- switch (o[k::checks()])
+ switch (o.checks())
{
case iaco_none:
if (! phase->option("checks=none"))
@@ -682,37 +683,36 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
}
}
- EbuildCommandParams command_params(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), _imp->e_repository->layout()->package_directory(id->name()))
- (k::ebuild_file(), id->fs_location_key()->value())
- (k::files_dir(), _imp->e_repository->layout()->package_directory(id->name()) / "files")
- (k::eclassdirs(), _imp->params.eclassdirs)
- (k::exlibsdirs(), exlibsdirs)
- (k::portdir(), _imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- (k::distdir(), _imp->params.distdir)
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::sandbox(), phase->option("sandbox"))
- (k::userpriv(), phase->option("userpriv") && userpriv_ok)
- (k::builddir(), _imp->params.builddir));
+ EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(_imp->params.distdir),
+ value_for<n::ebuild_dir>(_imp->e_repository->layout()->package_directory(id->name())),
+ value_for<n::ebuild_file>(id->fs_location_key()->value()),
+ value_for<n::eclassdirs>(_imp->params.eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(exlibsdirs),
+ value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
+ ));
EbuildInstallCommandParams install_params(
- EbuildInstallCommandParams::named_create()
- (k::use(), use)
- (k::a(), archives)
- (k::aa(), all_archives)
- (k::use_expand(), join(p->begin_use_expand(), p->end_use_expand(), " "))
- (k::expand_vars(), expand_vars)
- (k::root(), o[k::destination()]->installed_root_key() ?
- stringify(o[k::destination()]->installed_root_key()->value()) : "/")
- (k::profiles(), _imp->params.profiles)
- (k::config_protect(), _imp->e_repository->profile_variable("CONFIG_PROTECT"))
- (k::config_protect_mask(), _imp->e_repository->profile_variable("CONFIG_PROTECT_MASK"))
- (k::loadsaveenv_dir(), _imp->params.builddir / (stringify(id->name().category) + "-" +
- stringify(id->name().package) + "-" + stringify(id->version())) / "temp")
- (k::slot(), SlotName(id->slot())));
+ make_named_values<EbuildInstallCommandParams>(
+ value_for<n::a>(archives),
+ value_for<n::aa>(all_archives),
+ value_for<n::config_protect>(_imp->e_repository->profile_variable("CONFIG_PROTECT")),
+ value_for<n::config_protect_mask>(_imp->e_repository->profile_variable("CONFIG_PROTECT_MASK")),
+ value_for<n::expand_vars>(expand_vars),
+ value_for<n::loadsaveenv_dir>(_imp->params.builddir / (stringify(id->name().category) + "-" + stringify(id->name().package) + "-" + stringify(id->version())) / "temp"),
+ value_for<n::profiles>(_imp->params.profiles),
+ value_for<n::root>(o.destination()->installed_root_key() ? stringify(o.destination()->installed_root_key()->value()) : "/"),
+ value_for<n::slot>(SlotName(id->slot())),
+ value_for<n::use>(use),
+ value_for<n::use_expand>(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ ));
EbuildInstallCommand cmd(command_params, install_params);
cmd();
@@ -761,35 +761,34 @@ EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (phase->option("installed=true"))
continue;
- EbuildCommandParams command_params(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), _imp->e_repository->layout()->package_directory(id->name()))
- (k::ebuild_file(), id->fs_location_key()->value())
- (k::files_dir(), _imp->e_repository->layout()->package_directory(id->name()) / "files")
- (k::eclassdirs(), _imp->params.eclassdirs)
- (k::exlibsdirs(), exlibsdirs)
- (k::portdir(), _imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- (k::distdir(), _imp->params.distdir)
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::sandbox(), phase->option("sandbox"))
- (k::userpriv(), phase->option("userpriv") && userpriv_ok)
- (k::builddir(), _imp->params.builddir));
+ EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(_imp->params.distdir),
+ value_for<n::ebuild_dir>(_imp->e_repository->layout()->package_directory(id->name())),
+ value_for<n::ebuild_file>(id->fs_location_key()->value()),
+ value_for<n::eclassdirs>(_imp->params.eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(exlibsdirs),
+ value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
+ ));
EbuildInfoCommandParams info_params(
- EbuildInfoCommandParams::named_create()
- (k::use(), use)
- (k::use_expand(), join(p->begin_use_expand(), p->end_use_expand(), " "))
- (k::expand_vars(), expand_vars)
- (k::root(), stringify(_imp->params.environment->root()))
- (k::profiles(), _imp->params.profiles)
- (k::load_environment(), static_cast<const FSEntry *>(0))
- (k::info_vars(), _imp->e_repository->info_vars_key() ?
- _imp->e_repository->info_vars_key()->value() :
- make_shared_ptr(new const Set<std::string>))
- (k::use_ebuild_file(), true)
- );
+ make_named_values<EbuildInfoCommandParams>(
+ value_for<n::expand_vars>(expand_vars),
+ value_for<n::info_vars>(_imp->e_repository->info_vars_key() ?
+ _imp->e_repository->info_vars_key()->value() : make_shared_ptr(new const Set<std::string>)),
+ value_for<n::load_environment>(static_cast<const FSEntry *>(0)),
+ value_for<n::profiles>(_imp->params.profiles),
+ value_for<n::root>(stringify(_imp->params.environment->root())),
+ value_for<n::use>(use),
+ value_for<n::use_ebuild_file>(true),
+ value_for<n::use_expand>(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ ));
EbuildInfoCommand cmd(command_params, info_params);
cmd();
@@ -826,21 +825,21 @@ EbuildEntries::get_environment_variable(const std::tr1::shared_ptr<const EReposi
std::tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
- EbuildVariableCommand cmd(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), _imp->e_repository->layout()->package_directory(id->name()))
- (k::ebuild_file(), id->fs_location_key()->value())
- (k::files_dir(), _imp->e_repository->layout()->package_directory(id->name()) / "files")
- (k::eclassdirs(), _imp->params.eclassdirs)
- (k::exlibsdirs(), exlibsdirs)
- (k::portdir(), _imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- (k::distdir(), _imp->params.distdir)
- (k::sandbox(), phases.begin_phases()->option("sandbox"))
- (k::userpriv(), phases.begin_phases()->option("userpriv") && userpriv_ok)
- (k::commands(), join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "))
- (k::builddir(), _imp->params.builddir),
+ EbuildVariableCommand cmd(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " ")),
+ value_for<n::distdir>(_imp->params.distdir),
+ value_for<n::ebuild_dir>(_imp->e_repository->layout()->package_directory(id->name())),
+ value_for<n::ebuild_file>(id->fs_location_key()->value()),
+ value_for<n::eclassdirs>(_imp->params.eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(exlibsdirs),
+ value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::sandbox>(phases.begin_phases()->option("sandbox")),
+ value_for<n::userpriv>(phases.begin_phases()->option("userpriv") && userpriv_ok)
+ ),
var);
@@ -860,31 +859,31 @@ EbuildEntries::make_ebuild_entries(
void
EbuildEntries::merge(const MergeParams & m)
{
- Context context("When merging '" + stringify(*m[k::package_id()]) + "' at '" + stringify(m[k::image_dir()])
+ Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
+ "' to E repository '" + stringify(_imp->e_repository->name()) + "':");
- if (! _imp->e_repository->is_suitable_destination_for(*m[k::package_id()]))
- throw InstallActionError("Not a suitable destination for '" + stringify(*m[k::package_id()]) + "'");
+ if (! _imp->e_repository->is_suitable_destination_for(*m.package_id()))
+ throw InstallActionError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
FSEntry binary_ebuild_location(_imp->e_repository->layout()->binary_ebuild_location(
- m[k::package_id()]->name(), m[k::package_id()]->version(),
- "pbin-1+" + std::tr1::static_pointer_cast<const ERepositoryID>(m[k::package_id()])->eapi()->name()));
+ m.package_id()->name(), m.package_id()->version(),
+ "pbin-1+" + std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id())->eapi()->name()));
binary_ebuild_location.dirname().dirname().mkdir();
binary_ebuild_location.dirname().mkdir();
WriteBinaryEbuildCommand write_binary_ebuild_command(
- WriteBinaryEbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), std::tr1::static_pointer_cast<const ERepositoryID>(m[k::package_id()]))
- (k::binary_ebuild_location(), binary_ebuild_location)
- (k::binary_distdir(), _imp->params.binary_distdir)
- (k::environment_file(), m[k::environment_file()])
- (k::image(), m[k::image_dir()])
- (k::destination_repository(), _imp->e_repository)
- (k::builddir(), _imp->params.builddir)
- (k::merger_options(), std::tr1::static_pointer_cast<const ERepositoryID>(m[k::package_id()])->eapi()->supported()->merger_options())
- );
+ make_named_values<WriteBinaryEbuildCommandParams>(
+ value_for<n::binary_distdir>(_imp->params.binary_distdir),
+ value_for<n::binary_ebuild_location>(binary_ebuild_location),
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::destination_repository>(_imp->e_repository),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::environment_file>(m.environment_file()),
+ value_for<n::image>(m.image_dir()),
+ value_for<n::merger_options>(std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id())->eapi()->supported()->merger_options()),
+ value_for<n::package_id>(std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id()))
+ ));
write_binary_ebuild_command();
}
@@ -954,29 +953,30 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
- EbuildCommandParams command_params(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), _imp->e_repository->layout()->package_directory(id->name()))
- (k::ebuild_file(), id->fs_location_key()->value())
- (k::files_dir(), _imp->e_repository->layout()->package_directory(id->name()) / "files")
- (k::eclassdirs(), _imp->params.eclassdirs)
- (k::exlibsdirs(), exlibsdirs)
- (k::portdir(), _imp->params.master_repository ? _imp->params.master_repository->params().location :
- _imp->params.location)
- (k::distdir(), _imp->params.distdir)
- (k::userpriv(), phase->option("userpriv") && userpriv_ok)
- (k::sandbox(), phase->option("sandbox"))
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::builddir(), _imp->params.builddir));
+ EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(_imp->params.distdir),
+ value_for<n::ebuild_dir>(_imp->e_repository->layout()->package_directory(id->name())),
+ value_for<n::ebuild_file>(id->fs_location_key()->value()),
+ value_for<n::eclassdirs>(_imp->params.eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(exlibsdirs),
+ value_for<n::files_dir>(_imp->e_repository->layout()->package_directory(id->name()) / "files"),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.master_repository ? _imp->params.master_repository->params().location : _imp->params.location),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv") && userpriv_ok)
+ ));
EbuildPretendCommand pretend_cmd(command_params,
- EbuildPretendCommandParams::named_create()
- (k::use(), use)
- (k::use_expand(), join(p->begin_use_expand(), p->end_use_expand(), " "))
- (k::expand_vars(), expand_vars)
- (k::root(), stringify(_imp->params.environment->root()))
- (k::profiles(), _imp->params.profiles));
+ make_named_values<EbuildPretendCommandParams>(
+ value_for<n::expand_vars>(expand_vars),
+ value_for<n::profiles>(_imp->params.profiles),
+ value_for<n::root>(stringify(_imp->params.environment->root())),
+ value_for<n::use>(use),
+ value_for<n::use_expand>(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ ));
if (! pretend_cmd())
return false;
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index c0b6d26..a633b20 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -44,6 +44,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/save.hh>
+#include <paludis/util/make_named_values.hh>
#include <iterator>
#include <fstream>
@@ -214,21 +215,22 @@ EbuildID::need_keys_added() const
throw EAPIConfigurationError("EAPI '" + _imp->eapi->name() + "' defines "
+ (count == 0 ? "no" : stringify(count)) + " ebuild variable phases but expected exactly one");
- EbuildMetadataCommand cmd(EbuildCommandParams::named_create()
- (k::environment(), _imp->environment)
- (k::package_id(), shared_from_this())
- (k::ebuild_dir(), _imp->repository->layout()->package_directory(name()))
- (k::ebuild_file(), _imp->ebuild)
- (k::files_dir(), _imp->repository->layout()->package_directory(name()) / "files")
- (k::eclassdirs(), _imp->repository->params().eclassdirs)
- (k::exlibsdirs(), _imp->repository->layout()->exlibsdirs(name()))
- (k::portdir(), _imp->repository->params().master_repository ? _imp->repository->params().master_repository->params().location :
- _imp->repository->params().location)
- (k::distdir(), _imp->repository->params().distdir)
- (k::builddir(), _imp->repository->params().builddir)
- (k::commands(), join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " "))
- (k::sandbox(), phases.begin_phases()->option("sandbox"))
- (k::userpriv(), phases.begin_phases()->option("userpriv")));
+ EbuildMetadataCommand cmd(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->repository->params().builddir),
+ value_for<n::commands>(join(phases.begin_phases()->begin_commands(), phases.begin_phases()->end_commands(), " ")),
+ value_for<n::distdir>(_imp->repository->params().distdir),
+ value_for<n::ebuild_dir>(_imp->repository->layout()->package_directory(name())),
+ value_for<n::ebuild_file>(_imp->ebuild),
+ value_for<n::eclassdirs>(_imp->repository->params().eclassdirs),
+ value_for<n::environment>(_imp->environment),
+ value_for<n::exlibsdirs>(_imp->repository->layout()->exlibsdirs(name())),
+ value_for<n::files_dir>(_imp->repository->layout()->package_directory(name()) / "files"),
+ value_for<n::package_id>(shared_from_this()),
+ value_for<n::portdir>(_imp->repository->params().master_repository ?
+ _imp->repository->params().master_repository->params().location : _imp->repository->params().location),
+ value_for<n::sandbox>(phases.begin_phases()->option("sandbox")),
+ value_for<n::userpriv>(phases.begin_phases()->option("userpriv"))
+ ));
if (! cmd())
Log::get_instance()->message("e.ebuild.metadata.unusable", ll_warning, lc_no_context) << "No usable metadata for '" +
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 4324c6e..cb65e70 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -31,9 +31,9 @@
#include <paludis/util/cookie.hh>
#include <paludis/util/set.hh>
#include <paludis/util/dir_iterator.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/system.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
#include <paludis/ndbam.hh>
@@ -95,20 +95,22 @@ ExndbamRepository::ExndbamRepository(const RepositoryName & n, const ExndbamRepo
.environment(p.environment)
.builddir(p.builddir)
.root(p.root),
- n, RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), this)
- (k::environment_variable_interface(), this)
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::destination_interface(), this)
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), this)
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ n,
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(this),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(this),
+ value_for<n::hook_interface>(this),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(this),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<ExndbamRepository>(new Implementation<ExndbamRepository>(p)),
_imp(PrivateImplementationPattern<ExndbamRepository>::_imp)
{
@@ -150,7 +152,7 @@ ExndbamRepository::make_exndbam_repository(
builddir = f("buildroot");
if (builddir.empty())
builddir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_builddir()];
+ env->distribution())).default_ebuild_builddir();
else
Log::get_instance()->message("e.exndbam.configuration.deprecated", ll_warning, lc_context)
<< "Key 'buildroot' is deprecated, use 'builddir' instead";
@@ -200,11 +202,11 @@ ExndbamRepository::package_ids(const QualifiedPackageName & q) const
for (IndirectIterator<NDBAMEntrySequence::ConstIterator> e(entries->begin()), e_end(entries->end()) ;
e != e_end ; ++e)
{
- Lock l(*(*e)[k::mutex()]);
- if (! (*e)[k::package_id()])
- (*e)[k::package_id()].reset(new ExndbamID((*e)[k::name()], (*e)[k::version()], _imp->params.environment,
- shared_from_this(), (*e)[k::fs_location()], &_imp->ndbam));
- result->push_back((*e)[k::package_id()]);
+ Lock l(*(*e).mutex());
+ if (! (*e).package_id())
+ (*e).package_id().reset(new ExndbamID((*e).name(), (*e).version(), _imp->params.environment,
+ shared_from_this(), (*e).fs_location(), &_imp->ndbam));
+ result->push_back((*e).package_id());
}
return result;
@@ -279,20 +281,20 @@ namespace
void
ExndbamRepository::merge(const MergeParams & m)
{
- Context context("When merging '" + stringify(*m[k::package_id()]) + "' at '" + stringify(m[k::image_dir()])
+ Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
+ "' to Exndbam repository '" + stringify(name()) + "':");
- if (! is_suitable_destination_for(*m[k::package_id()]))
- throw InstallActionError("Not a suitable destination for '" + stringify(*m[k::package_id()]) + "'");
+ if (! is_suitable_destination_for(*m.package_id()))
+ throw InstallActionError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
std::tr1::shared_ptr<const PackageID> if_overwritten_id, if_same_name_id;
{
- std::tr1::shared_ptr<const PackageIDSequence> ids(package_ids(m[k::package_id()]->name()));
+ std::tr1::shared_ptr<const PackageIDSequence> ids(package_ids(m.package_id()->name()));
for (PackageIDSequence::ConstIterator v(ids->begin()), v_end(ids->end()) ;
v != v_end ; ++v)
{
if_same_name_id = *v;
- if ((*v)->version() == m[k::package_id()]->version() && (*v)->slot() == m[k::package_id()]->slot())
+ if ((*v)->version() == m.package_id()->version() && (*v)->slot() == m.package_id()->slot())
{
if_overwritten_id = *v;
break;
@@ -305,7 +307,7 @@ ExndbamRepository::merge(const MergeParams & m)
uid_dir = if_same_name_id->fs_location_key()->value().dirname();
else
{
- std::string uid(stringify(m[k::package_id()]->name().category) + "---" + stringify(m[k::package_id()]->name().package));
+ std::string uid(stringify(m.package_id()->name().category) + "---" + stringify(m.package_id()->name().package));
uid_dir /= "data";
uid_dir.mkdir();
uid_dir /= uid;
@@ -313,7 +315,7 @@ ExndbamRepository::merge(const MergeParams & m)
}
FSEntry target_ver_dir(uid_dir);
- target_ver_dir /= (stringify(m[k::package_id()]->version()) + ":" + stringify(m[k::package_id()]->slot()) + ":" + cookie());
+ target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot()) + ":" + cookie());
if (target_ver_dir.exists())
throw InstallActionError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably "
@@ -321,11 +323,12 @@ ExndbamRepository::merge(const MergeParams & m)
target_ver_dir.mkdir();
WriteVDBEntryCommand write_vdb_entry_command(
- WriteVDBEntryParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), std::tr1::static_pointer_cast<const ERepositoryID>(m[k::package_id()]))
- (k::output_directory(), target_ver_dir)
- (k::environment_file(), m[k::environment_file()]));
+ make_named_values<WriteVDBEntryParams>(
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::environment_file>(m.environment_file()),
+ value_for<n::output_directory>(target_ver_dir),
+ value_for<n::package_id>(std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id()))
+ ));
write_vdb_entry_command();
@@ -340,18 +343,18 @@ ExndbamRepository::merge(const MergeParams & m)
}
NDBAMMerger merger(
- NDBAMMergerParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::image(), m[k::image_dir()])
- (k::root(), installed_root_key()->value())
- (k::install_under(), FSEntry("/"))
- (k::contents_file(), target_ver_dir / "contents")
- (k::config_protect(), config_protect)
- (k::config_protect_mask(), config_protect_mask)
- (k::package_id(), m[k::package_id()])
- (k::get_new_ids_or_minus_one(), std::tr1::bind(&get_new_ids_or_minus_one, _imp->params.environment,
- std::tr1::placeholders::_1))
- (k::options(), m[k::options()]));
+ make_named_values<NDBAMMergerParams>(
+ value_for<n::config_protect>(config_protect),
+ value_for<n::config_protect_mask>(config_protect_mask),
+ value_for<n::contents_file>(target_ver_dir / "contents"),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::get_new_ids_or_minus_one>(std::tr1::bind(&get_new_ids_or_minus_one, _imp->params.environment, std::tr1::placeholders::_1)),
+ value_for<n::image>(m.image_dir()),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::options>(m.options()),
+ value_for<n::package_id>(m.package_id()),
+ value_for<n::root>(installed_root_key()->value())
+ ));
if (! merger.check())
{
@@ -364,7 +367,7 @@ ExndbamRepository::merge(const MergeParams & m)
merger.merge();
- _imp->ndbam.index(m[k::package_id()]->name(), uid_dir.basename());
+ _imp->ndbam.index(m.package_id()->name(), uid_dir.basename());
if (if_overwritten_id)
{
@@ -372,8 +375,9 @@ ExndbamRepository::merge(const MergeParams & m)
}
VDBPostMergeCommand post_merge_command(
- VDBPostMergeCommandParams::named_create()
- (k::root(), installed_root_key()->value()));
+ make_named_values<VDBPostMergeCommandParams>(
+ value_for<n::root>(installed_root_key()->value())
+ ));
post_merge_command();
}
@@ -426,39 +430,44 @@ ExndbamRepository::perform_uninstall(const std::tr1::shared_ptr<const ERepositor
/* unmerge */
NDBAMUnmerger unmerger(
- NDBAMUnmergerOptions::named_create()
- (k::environment(), _imp->params.environment)
- (k::root(), installed_root_key()->value())
- (k::contents_file(), ver_dir / "contents")
- (k::config_protect(), config_protect)
- (k::config_protect_mask(), config_protect_mask)
- (k::ndbam(), &_imp->ndbam)
- (k::package_id(), id));
+ make_named_values<NDBAMUnmergerOptions>(
+ value_for<n::config_protect>(config_protect),
+ value_for<n::config_protect_mask>(config_protect_mask),
+ value_for<n::contents_file>(ver_dir / "contents"),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::ndbam>(&_imp->ndbam),
+ value_for<n::package_id>(id),
+ value_for<n::root>(installed_root_key()->value())
+ ));
unmerger.unmerge();
}
else
{
- EbuildCommandParams params(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), ver_dir)
- (k::ebuild_file(), ver_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild"))
- (k::files_dir(), ver_dir)
- (k::eclassdirs(), eclassdirs)
- (k::exlibsdirs(), make_shared_ptr(new FSEntrySequence))
- (k::portdir(), _imp->params.location)
- (k::distdir(), ver_dir)
- (k::sandbox(), phase->option("sandbox"))
- (k::userpriv(), phase->option("userpriv"))
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::builddir(), _imp->params.builddir));
-
- EbuildUninstallCommandParams uninstall_params(EbuildUninstallCommandParams::named_create()
- (k::root(), stringify(_imp->params.root))
- (k::unmerge_only(), false)
- (k::loadsaveenv_dir(), ver_dir)
- (k::load_environment(), load_env.get()));
+ EbuildCommandParams params(
+ make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(ver_dir),
+ value_for<n::ebuild_dir>(ver_dir),
+ value_for<n::ebuild_file>(ver_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild")),
+ value_for<n::eclassdirs>(eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(make_shared_ptr(new FSEntrySequence)),
+ value_for<n::files_dir>(ver_dir),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.location),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv"))
+ ));
+
+ EbuildUninstallCommandParams uninstall_params(
+ make_named_values<EbuildUninstallCommandParams>(
+ value_for<n::load_environment>(load_env.get()),
+ value_for<n::loadsaveenv_dir>(ver_dir),
+ value_for<n::root>(stringify(_imp->params.root)),
+ value_for<n::unmerge_only>(false)
+ ));
EbuildUninstallCommand uninstall_cmd_pre(params, uninstall_params);
uninstall_cmd_pre();
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index 87fad67..f61ae7b 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -27,7 +27,6 @@
#include <paludis/util/options.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/join.hh>
diff --git a/paludis/repositories/e/make_ebuild_repository.cc b/paludis/repositories/e/make_ebuild_repository.cc
index 022643d..c796b25 100644
--- a/paludis/repositories/e/make_ebuild_repository.cc
+++ b/paludis/repositories/e/make_ebuild_repository.cc
@@ -28,7 +28,6 @@
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/options.hh>
#include <paludis/util/config_file.hh>
-#include <paludis/util/kc.hh>
#include <paludis/repositories/e/e_repository_exceptions.hh>
#include <paludis/environment.hh>
#include <paludis/distribution.hh>
@@ -111,7 +110,7 @@ paludis::make_ebuild_repository(
else
{
distdir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_distdir()];
+ env->distribution())).default_ebuild_distdir();
if (distdir.empty())
distdir = location + "/distfiles";
else if ('/' != distdir.at(0))
@@ -142,7 +141,7 @@ paludis::make_ebuild_repository(
std::string write_cache(f("write_cache"));
if (write_cache.empty())
write_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_write_cache()];
+ env->distribution())).default_ebuild_write_cache();
bool append_repository_name_to_write_cache(true);
if (! f("append_repository_name_to_write_cache").empty())
@@ -164,7 +163,7 @@ paludis::make_ebuild_repository(
if (! layout_conf
|| (eapi_when_unknown = layout_conf->get("eapi_when_unknown")).empty())
eapi_when_unknown = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_eapi_when_unknown()];
+ env->distribution())).default_ebuild_eapi_when_unknown();
}
std::string eapi_when_unspecified(f("eapi_when_unspecified"));
@@ -173,7 +172,7 @@ paludis::make_ebuild_repository(
if (! layout_conf
|| (eapi_when_unspecified = layout_conf->get("eapi_when_unspecified")).empty())
eapi_when_unspecified = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_eapi_when_unspecified()];
+ env->distribution())).default_ebuild_eapi_when_unspecified();
}
std::string profile_eapi(f("profile_eapi"));
@@ -182,14 +181,14 @@ paludis::make_ebuild_repository(
if (! layout_conf
|| (profile_eapi = layout_conf->get("eapi_when_unspecified")).empty())
profile_eapi = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_profile_eapi()];
+ env->distribution())).default_ebuild_profile_eapi();
}
std::string names_cache(f("names_cache"));
if (names_cache.empty())
{
names_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_names_cache()];
+ env->distribution())).default_ebuild_names_cache();
if (names_cache.empty())
{
Log::get_instance()->message("e.ebuild.configuration.no_names_cache", ll_warning, lc_no_context)
@@ -221,7 +220,7 @@ paludis::make_ebuild_repository(
builddir = stringify(master_repository->params().builddir);
else
builddir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_builddir()];
+ env->distribution())).default_ebuild_builddir();
}
else
Log::get_instance()->message("e.ebuild.configuration.deprecated", ll_warning, lc_context)
@@ -234,7 +233,7 @@ paludis::make_ebuild_repository(
if (! layout_conf
|| (layout = layout_conf->get("layout")).empty())
layout = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_layout()];
+ env->distribution())).default_ebuild_layout();
}
erepository::UseManifest use_manifest(erepository::manifest_use);
diff --git a/paludis/repositories/e/qa/eapi_supported.cc b/paludis/repositories/e/qa/eapi_supported.cc
index d449753..10d1e73 100644
--- a/paludis/repositories/e/qa/eapi_supported.cc
+++ b/paludis/repositories/e/qa/eapi_supported.cc
@@ -23,7 +23,6 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/kc.hh>
bool
paludis::erepository::eapi_supported_check(
diff --git a/paludis/repositories/e/qa/fetches_key.cc b/paludis/repositories/e/qa/fetches_key.cc
index a3779dd..91f96ae 100644
--- a/paludis/repositories/e/qa/fetches_key.cc
+++ b/paludis/repositories/e/qa/fetches_key.cc
@@ -145,7 +145,7 @@ namespace
else
{
mirror_host.erase(pos);
- RepositoryMirrorsInterface * m((*id->repository())[k::mirrors_interface()]);
+ RepositoryMirrorsInterface * m((*id->repository()).mirrors_interface());
if (! m->is_mirror(mirror_host))
reporter.message(QAMessage(entry, qaml_normal, name,
"Unknown mirror '" + mirror_host + "' for '" +
diff --git a/paludis/repositories/e/qa/iuse_key.cc b/paludis/repositories/e/qa/iuse_key.cc
index 4074bb8..eaf78fe 100644
--- a/paludis/repositories/e/qa/iuse_key.cc
+++ b/paludis/repositories/e/qa/iuse_key.cc
@@ -94,7 +94,7 @@ paludis::erepository::iuse_key_check(
.with_associated_id(id)
.with_associated_key(id, id->iuse_key()));
- if ("" == (*repo)[k::use_interface()]->describe_use_flag(it->flag, *id))
+ if ("" == (*repo).use_interface()->describe_use_flag(it->flag, *id))
reporter.message(QAMessage(entry, qaml_minor, name,
"Flag '" + stringify(it->flag) + "' in '" + id->iuse_key()->raw_name() + "' has no description")
.with_associated_id(id)
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 9a421e6..9c3f737 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -190,7 +190,7 @@ namespace
.with_associated_id(id)
.with_associated_key(id, key));
- if ((*id->repository())[k::use_interface()]->arch_flags()->count(elike_conditional_dep_spec_flag(u)))
+ if ((*id->repository()).use_interface()->arch_flags()->count(elike_conditional_dep_spec_flag(u)))
{
if (forbid_arch_flags)
reporter.message(QAMessage(entry, qaml_normal, name,
@@ -209,14 +209,14 @@ namespace
if (iuse_flags.end() == iuse_flags.find(elike_conditional_dep_spec_flag(u)))
{
std::tr1::shared_ptr<const UseFlagNameSet> c(
- (*id->repository())[k::use_interface()]->use_expand_hidden_prefixes());
+ (*id->repository()).use_interface()->use_expand_hidden_prefixes());
std::string flag(stringify(elike_conditional_dep_spec_flag(u)));
bool is_hidden(false);
for (UseFlagNameSet::ConstIterator i(c->begin()), i_end(c->end()) ;
i != i_end ; ++i)
{
- std::string prefix(stringify(*i) + (*id->repository())[k::use_interface()]->use_expand_separator(*id));
+ std::string prefix(stringify(*i) + (*id->repository()).use_interface()->use_expand_separator(*id));
if (0 == flag.compare(0, prefix.length(), prefix))
{
is_hidden = true;
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index 96b8d98..33fd739 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -117,8 +117,8 @@ namespace
/* rewrite virtuals to avoid problems later on */
if (p->package_ptr())
{
- ERepositoryProfile::VirtualsConstIterator v((*profile)[k::profile()]->find_virtual(*p->package_ptr()));
- if ((*profile)[k::profile()]->end_virtuals() != v)
+ ERepositoryProfile::VirtualsConstIterator v((*profile).profile()->find_virtual(*p->package_ptr()));
+ if ((*profile).profile()->end_virtuals() != v)
{
PartiallyMadePackageDepSpec pp;
@@ -148,8 +148,8 @@ namespace
if (reporter)
reporter->message(QAMessage(entry, qaml_normal, name, "No packages matching '"
+ stringify(orig_p) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
- + stringify((*profile)[k::path()]) + "' (" + stringify((*profile)[k::arch()]) + "."
- + stringify((*profile)[k::status()])
+ + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "."
+ + stringify((*profile).status())
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
.with_associated_key(id, key));
@@ -162,13 +162,13 @@ namespace
/* can't use the usual masked rules here, so this gets a bit complicated... */
if ((*i)->repository() == repo)
{
- if (repo->repository_masked(**i) || (*profile)[k::profile()]->profile_masked(**i) || ! (*i)->keywords_key())
+ if (repo->repository_masked(**i) || (*profile).profile()->profile_masked(**i) || ! (*i)->keywords_key())
continue;
}
else if ((*i)->repository() == repo->params().master_repository)
{
if (repo->params().master_repository->repository_masked(**i) ||
- (*profile)[k::profile()]->profile_masked(**i) || ! (*i)->keywords_key())
+ (*profile).profile()->profile_masked(**i) || ! (*i)->keywords_key())
continue;
}
else
@@ -196,7 +196,7 @@ namespace
if (reporter)
reporter->message(QAMessage(entry, qaml_normal, name, "No visible packages matching '"
+ stringify(orig_p) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
- + stringify((*profile)[k::path()]) + "' (" + stringify((*profile)[k::arch()]) + "." + stringify((*profile)[k::status()])
+ + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status())
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
.with_associated_key(id, key));
@@ -208,8 +208,8 @@ namespace
DependencySpecTree::ConstSequenceIterator end)
{
viable =
- ((! elike_conditional_dep_spec_is_inverse(u)) && (! (*profile)[k::profile()]->use_masked(elike_conditional_dep_spec_flag(u), *id))) ||
- ((elike_conditional_dep_spec_is_inverse(u)) && (! (*profile)[k::profile()]->use_forced(elike_conditional_dep_spec_flag(u), *id)));
+ ((! elike_conditional_dep_spec_is_inverse(u)) && (! (*profile).profile()->use_masked(elike_conditional_dep_spec_flag(u), *id))) ||
+ ((elike_conditional_dep_spec_is_inverse(u)) && (! (*profile).profile()->use_forced(elike_conditional_dep_spec_flag(u), *id)));
if (viable)
std::for_each(cur, end, accept_visitor(*this));
@@ -243,7 +243,7 @@ namespace
std::for_each(begin, end, accept_visitor(printer));
reporter->message(QAMessage(entry, qaml_normal, name, "No item in block '|| ( "
+ stringify(printer) + " )' visible for profile '"
- + stringify((*profile)[k::path()]) + "' (" + stringify((*profile)[k::arch()]) + "." + stringify((*profile)[k::status()])
+ + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status())
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
.with_associated_key(id, key));
@@ -281,11 +281,11 @@ paludis::erepository::visibility_check(
for (ERepository::ProfilesConstIterator p(repo->begin_profiles()), p_end(repo->end_profiles()) ;
p != p_end ; ++p)
{
- if ((*p)[k::profile()]->profile_masked(*id))
+ if ((*p).profile()->profile_masked(*id))
continue;
std::set<KeywordName> accepted_keywords, overlap;
- tokenise_whitespace((*p)[k::profile()]->environment_variable(
+ tokenise_whitespace((*p).profile()->environment_variable(
repo->accept_keywords_variable()), create_inserter<KeywordName>(std::inserter(accepted_keywords, accepted_keywords.begin())));
std::set_intersection(accepted_keywords.begin(), accepted_keywords.end(),
diff --git a/paludis/repositories/e/source_uri_finder.cc b/paludis/repositories/e/source_uri_finder.cc
index dcdc60a..47b8f50 100644
--- a/paludis/repositories/e/source_uri_finder.cc
+++ b/paludis/repositories/e/source_uri_finder.cc
@@ -158,9 +158,9 @@ SourceURIFinder::add_mirrors()
{
Context local_context("When adding repository mirrors '" + _imp->mirrors_name + "':");
- if ((*_imp->repo)[k::mirrors_interface()])
- for (RepositoryMirrorsInterface::MirrorsConstIterator m((*_imp->repo)[k::mirrors_interface()]->begin_mirrors(_imp->mirrors_name)),
- m_end((*_imp->repo)[k::mirrors_interface()]->end_mirrors(_imp->mirrors_name)) ;
+ if ((*_imp->repo).mirrors_interface())
+ for (RepositoryMirrorsInterface::MirrorsConstIterator m((*_imp->repo).mirrors_interface()->begin_mirrors(_imp->mirrors_name)),
+ m_end((*_imp->repo).mirrors_interface()->end_mirrors(_imp->mirrors_name)) ;
m != m_end ; ++m)
{
Log::get_instance()->message("e.source_uri_finder.adding_mirror", ll_debug, lc_context)
@@ -199,9 +199,9 @@ SourceURIFinder::add_listed()
{
Context local_context("When adding from repository for listed mirror '" + mirror + "':");
- if ((*_imp->repo)[k::mirrors_interface()])
- for (RepositoryMirrorsInterface::MirrorsConstIterator m((*_imp->repo)[k::mirrors_interface()]->begin_mirrors(mirror)),
- m_end((*_imp->repo)[k::mirrors_interface()]->end_mirrors(mirror)) ;
+ if ((*_imp->repo).mirrors_interface())
+ for (RepositoryMirrorsInterface::MirrorsConstIterator m((*_imp->repo).mirrors_interface()->begin_mirrors(mirror)),
+ m_end((*_imp->repo).mirrors_interface()->end_mirrors(mirror)) ;
m != m_end ; ++m)
{
Log::get_instance()->message("e.source_uri_finder.adding_mirror", ll_debug, lc_context)
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 2d30cf4..6848cf6 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -28,6 +28,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/util/md5.hh>
@@ -54,10 +55,10 @@ namespace paludis
Implementation(const VDBMergerParams & p) :
params(p),
- realroot(params[k::root()].realpath())
+ realroot(params.root().realpath())
{
- tokenise_whitespace(params[k::config_protect()], std::back_inserter(config_protect));
- tokenise_whitespace(params[k::config_protect_mask()], std::back_inserter(config_protect_mask));
+ tokenise_whitespace(params.config_protect(), std::back_inserter(config_protect));
+ tokenise_whitespace(params.config_protect_mask(), std::back_inserter(config_protect_mask));
}
};
}
@@ -75,14 +76,15 @@ namespace
}
VDBMerger::VDBMerger(const VDBMergerParams & p) :
- Merger(MergerParams::named_create()
- (k::environment(), p[k::environment()])
- (k::image(), p[k::image()])
- (k::install_under(), FSEntry("/"))
- (k::root(), p[k::root()])
- (k::no_chown(), ! getenv_with_default("PALUDIS_NO_CHOWN", "").empty())
- (k::get_new_ids_or_minus_one(), std::tr1::bind(&get_new_ids_or_minus_one, p[k::environment()], std::tr1::placeholders::_1))
- (k::options(), p[k::options()])),
+ Merger(make_named_values<MergerParams>(
+ value_for<n::environment>(p.environment()),
+ value_for<n::get_new_ids_or_minus_one>(std::tr1::bind(&get_new_ids_or_minus_one, p.environment(), std::tr1::placeholders::_1)),
+ value_for<n::image>(p.image()),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::no_chown>(! getenv_with_default("PALUDIS_NO_CHOWN", "").empty()),
+ value_for<n::options>(p.options()),
+ value_for<n::root>(p.root())
+ )),
PrivateImplementationPattern<VDBMerger>(new Implementation<VDBMerger>(p)),
_imp(PrivateImplementationPattern<VDBMerger>::_imp)
{
@@ -95,33 +97,33 @@ VDBMerger::~VDBMerger()
Hook
VDBMerger::extend_hook(const Hook & h)
{
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->params[k::environment()]->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->params.environment()->bashrc_files());
- if (_imp->params[k::package_id()])
+ if (_imp->params.package_id())
{
- std::string cat(stringify(_imp->params[k::package_id()]->name().category));
- std::string pn(stringify(_imp->params[k::package_id()]->name().package));
- std::string pvr(stringify(_imp->params[k::package_id()]->version()));
- std::string pv(stringify(_imp->params[k::package_id()]->version().remove_revision()));
- std::string slot(stringify(_imp->params[k::package_id()]->slot()));
+ std::string cat(stringify(_imp->params.package_id()->name().category));
+ std::string pn(stringify(_imp->params.package_id()->name().package));
+ std::string pvr(stringify(_imp->params.package_id()->version()));
+ std::string pv(stringify(_imp->params.package_id()->version().remove_revision()));
+ std::string slot(stringify(_imp->params.package_id()->slot()));
return Merger::extend_hook(h)
("P", pn + "-" + pv)
("PN", pn)
("CATEGORY", cat)
- ("PR", _imp->params[k::package_id()]->version().revision_only())
+ ("PR", _imp->params.package_id()->version().revision_only())
("PV", pv)
("PVR", pvr)
("PF", pn + "-" + pvr)
("SLOT", slot)
- ("CONFIG_PROTECT", _imp->params[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->params[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->params.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->params.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "));
}
else
return Merger::extend_hook(h)
- ("CONFIG_PROTECT", _imp->params[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->params[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->params.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->params.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "));
}
@@ -257,15 +259,15 @@ VDBMerger::make_config_protect_name(const FSEntry & src, const FSEntry & dst)
void
VDBMerger::merge()
{
- display_override(">>> Merging to " + stringify(_imp->params[k::root()]));
- _imp->contents_file.reset(new std::ofstream(stringify(_imp->params[k::contents_file()]).c_str()));
+ display_override(">>> Merging to " + stringify(_imp->params.root()));
+ _imp->contents_file.reset(new std::ofstream(stringify(_imp->params.contents_file()).c_str()));
Merger::merge();
}
bool
VDBMerger::check()
{
- std::cout << ">>> Checking whether we can merge to " << _imp->params[k::root()] << " ";
+ std::cout << ">>> Checking whether we can merge to " << _imp->params.root() << " ";
bool result(Merger::check());
std::cout << std::endl;
return result;
diff --git a/paludis/repositories/e/vdb_merger.hh b/paludis/repositories/e/vdb_merger.hh
index 9d27d8b..ab694b9 100644
--- a/paludis/repositories/e/vdb_merger.hh
+++ b/paludis/repositories/e/vdb_merger.hh
@@ -23,13 +23,23 @@
#include <paludis/merger.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
namespace paludis
{
class Hook;
+ namespace n
+ {
+ struct config_protect;
+ struct config_protect_mask;
+ struct contents_file;
+ struct environment;
+ struct image;
+ struct options;
+ struct package_id;
+ struct root;
+ }
+
/**
* Parameters for a VDBMerger.
*
@@ -39,16 +49,17 @@ namespace paludis
* \nosubgrouping
* \since 0.26
*/
- typedef kc::KeyedClass<
- kc::Field<k::environment, Environment *>,
- kc::Field<k::image, FSEntry>,
- kc::Field<k::root, FSEntry>,
- kc::Field<k::contents_file, FSEntry>,
- kc::Field<k::config_protect, std::string>,
- kc::Field<k::config_protect_mask, std::string>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >,
- kc::Field<k::options, MergerOptions>
- > VDBMergerParams;
+ struct VDBMergerParams
+ {
+ NamedValue<n::config_protect, std::string> config_protect;
+ NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::contents_file, FSEntry> contents_file;
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::image, FSEntry> image;
+ NamedValue<n::options, MergerOptions> options;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ NamedValue<n::root, FSEntry> root;
+ };
/**
* Merger for VDBRepository.
diff --git a/paludis/repositories/e/vdb_merger_TEST.cc b/paludis/repositories/e/vdb_merger_TEST.cc
index 71347b3..01d2a82 100644
--- a/paludis/repositories/e/vdb_merger_TEST.cc
+++ b/paludis/repositories/e/vdb_merger_TEST.cc
@@ -21,6 +21,7 @@
#include "vdb_merger.hh"
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <fstream>
@@ -75,15 +76,16 @@ namespace
TestCase("merge '" + what + "' test"),
root_dir(FSEntry::cwd() / "vdb_merger_TEST_dir" / what / "root"),
target(what),
- merger(VDBMergerParams::named_create()
- (k::environment(), &env)
- (k::image(), FSEntry::cwd() / "vdb_merger_TEST_dir" / what / "image")
- (k::root(), root_dir)
- (k::contents_file(), FSEntry::cwd() / "vdb_merger_TEST_dir/CONTENTS" / what)
- (k::config_protect(), "/protected_file /protected_dir")
- (k::config_protect_mask(), "/protected_dir/unprotected_file /protected_dir/unprotected_dir")
- (k::package_id(), std::tr1::shared_ptr<PackageID>())
- (k::options(), MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs))
+ merger(make_named_values<VDBMergerParams>(
+ value_for<n::config_protect>("/protected_file /protected_dir"),
+ value_for<n::config_protect_mask>("/protected_dir/unprotected_file /protected_dir/unprotected_dir"),
+ value_for<n::contents_file>(FSEntry::cwd() / "vdb_merger_TEST_dir/CONTENTS" / what),
+ value_for<n::environment>(&env),
+ value_for<n::image>(FSEntry::cwd() / "vdb_merger_TEST_dir" / what / "image"),
+ value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
+ value_for<n::package_id>(std::tr1::shared_ptr<PackageID>()),
+ value_for<n::root>(root_dir)
+ ))
{
}
};
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 6b717fc..0019e0c 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -65,9 +65,10 @@
#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
+
#include <tr1/unordered_map>
#include <tr1/functional>
#include <fstream>
@@ -153,20 +154,21 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
.builddir(p.builddir)
.deprecated_world(p.deprecated_world),
p.name,
- RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), this)
- (k::environment_variable_interface(), this)
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::provides_interface(), this)
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::destination_interface(), this)
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), this)
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(this),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(this),
+ value_for<n::hook_interface>(this),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(this),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(this),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<VDBRepository>(new Implementation<VDBRepository>(this, p)),
_imp(PrivateImplementationPattern<VDBRepository>::_imp)
{
@@ -304,7 +306,7 @@ VDBRepository::make_vdb_repository(
if (provides_cache.empty())
{
provides_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_vdb_provides_cache()];
+ env->distribution())).default_vdb_provides_cache();
if (provides_cache.empty())
{
Log::get_instance()->message("e.vdb.configuration.no_provides_cache", ll_warning, lc_no_context)
@@ -318,7 +320,7 @@ VDBRepository::make_vdb_repository(
if (names_cache.empty())
{
names_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_vdb_names_cache()];
+ env->distribution())).default_vdb_names_cache();
if (names_cache.empty())
{
Log::get_instance()->message("e.vdb.configuration.no_names_cache", ll_warning, lc_no_context)
@@ -334,7 +336,7 @@ VDBRepository::make_vdb_repository(
builddir = f("buildroot");
if (builddir.empty())
builddir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::default_ebuild_builddir()];
+ env->distribution())).default_ebuild_builddir();
else
Log::get_instance()->message("e.vdb.configuration.deprecated", ll_warning, lc_context)
<< "Key 'buildroot' is deprecated, use 'builddir' instead";
@@ -407,38 +409,41 @@ VDBRepository::perform_uninstall(const std::tr1::shared_ptr<const ERepositoryID>
/* unmerge */
VDBUnmerger unmerger(
- VDBUnmergerOptions::named_create()
- (k::environment(), _imp->params.environment)
- (k::root(), installed_root_key()->value())
- (k::contents_file(), pkg_dir / "CONTENTS")
- (k::config_protect(), config_protect)
- (k::config_protect_mask(), config_protect_mask)
- (k::package_id(), id));
+ make_named_values<VDBUnmergerOptions>(
+ value_for<n::config_protect>(config_protect),
+ value_for<n::config_protect_mask>(config_protect_mask),
+ value_for<n::contents_file>(pkg_dir / "CONTENTS"),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::package_id>(id),
+ value_for<n::root>(installed_root_key()->value())
+ ));
unmerger.unmerge();
}
else
{
- EbuildCommandParams params(EbuildCommandParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), id)
- (k::ebuild_dir(), pkg_dir)
- (k::ebuild_file(), pkg_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild"))
- (k::files_dir(), pkg_dir)
- (k::eclassdirs(), eclassdirs)
- (k::exlibsdirs(), make_shared_ptr(new FSEntrySequence))
- (k::portdir(), _imp->params.location)
- (k::distdir(), pkg_dir)
- (k::sandbox(), phase->option("sandbox"))
- (k::userpriv(), phase->option("userpriv"))
- (k::commands(), join(phase->begin_commands(), phase->end_commands(), " "))
- (k::builddir(), _imp->params.builddir));
-
- EbuildUninstallCommandParams uninstall_params(EbuildUninstallCommandParams::named_create()
- (k::root(), stringify(_imp->params.root))
- (k::unmerge_only(), false)
- (k::loadsaveenv_dir(), pkg_dir)
- (k::load_environment(), load_env.get()));
+ EbuildCommandParams params(make_named_values<EbuildCommandParams>(
+ value_for<n::builddir>(_imp->params.builddir),
+ value_for<n::commands>(join(phase->begin_commands(), phase->end_commands(), " ")),
+ value_for<n::distdir>(pkg_dir),
+ value_for<n::ebuild_dir>(pkg_dir),
+ value_for<n::ebuild_file>(pkg_dir / (stringify(id->name().package) + "-" + stringify(id->version()) + ".ebuild")),
+ value_for<n::eclassdirs>(eclassdirs),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::exlibsdirs>(make_shared_ptr(new FSEntrySequence)),
+ value_for<n::files_dir>(pkg_dir),
+ value_for<n::package_id>(id),
+ value_for<n::portdir>(_imp->params.location),
+ value_for<n::sandbox>(phase->option("sandbox")),
+ value_for<n::userpriv>(phase->option("userpriv"))
+ ));
+
+ EbuildUninstallCommandParams uninstall_params(make_named_values<EbuildUninstallCommandParams>(
+ value_for<n::load_environment>(load_env.get()),
+ value_for<n::loadsaveenv_dir>(pkg_dir),
+ value_for<n::root>(stringify(_imp->params.root)),
+ value_for<n::unmerge_only>(false)
+ ));
EbuildUninstallCommand uninstall_cmd_pre(params, uninstall_params);
uninstall_cmd_pre();
@@ -516,9 +521,10 @@ VDBRepository::provided_packages() const
for (Sequence<QualifiedPackageName>::ConstIterator it2(it->second->begin()),
it2_end(it->second->end()); it2_end != it2; ++it2)
- _imp->provides->push_back(RepositoryProvidesEntry::named_create()
- (k::virtual_name(), *it2)
- (k::provided_by(), id));
+ _imp->provides->push_back(make_named_values<RepositoryProvidesEntry>(
+ value_for<n::provided_by>(id),
+ value_for<n::virtual_name>(*it2)
+ ));
}
return _imp->provides;
@@ -763,29 +769,30 @@ VDBRepository::category_names_containing_package(const PackageNamePart & p) cons
void
VDBRepository::merge(const MergeParams & m)
{
- Context context("When merging '" + stringify(*m[k::package_id()]) + "' at '" + stringify(m[k::image_dir()])
+ Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
+ "' to VDB repository '" + stringify(name()) + "':");
- if (! is_suitable_destination_for(*m[k::package_id()]))
- throw InstallActionError("Not a suitable destination for '" + stringify(*m[k::package_id()]) + "'");
+ if (! is_suitable_destination_for(*m.package_id()))
+ throw InstallActionError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
- std::tr1::shared_ptr<const ERepositoryID> is_replace(package_id_if_exists(m[k::package_id()]->name(), m[k::package_id()]->version()));
+ std::tr1::shared_ptr<const ERepositoryID> is_replace(package_id_if_exists(m.package_id()->name(), m.package_id()->version()));
FSEntry tmp_vdb_dir(_imp->params.location);
if (! tmp_vdb_dir.exists())
tmp_vdb_dir.mkdir();
- tmp_vdb_dir /= stringify(m[k::package_id()]->name().category);
+ tmp_vdb_dir /= stringify(m.package_id()->name().category);
if (! tmp_vdb_dir.exists())
tmp_vdb_dir.mkdir();
- tmp_vdb_dir /= ("-checking-" + stringify(m[k::package_id()]->name().package) + "-" + stringify(m[k::package_id()]->version()));
+ tmp_vdb_dir /= ("-checking-" + stringify(m.package_id()->name().package) + "-" + stringify(m.package_id()->version()));
tmp_vdb_dir.mkdir();
WriteVDBEntryCommand write_vdb_entry_command(
- WriteVDBEntryParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::package_id(), std::tr1::static_pointer_cast<const ERepositoryID>(m[k::package_id()]))
- (k::output_directory(), tmp_vdb_dir)
- (k::environment_file(), m[k::environment_file()]));
+ make_named_values<WriteVDBEntryParams>(
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::environment_file>(m.environment_file()),
+ value_for<n::output_directory>(tmp_vdb_dir),
+ value_for<n::package_id>(std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id()))
+ ));
write_vdb_entry_command();
@@ -800,19 +807,20 @@ VDBRepository::merge(const MergeParams & m)
}
FSEntry vdb_dir(_imp->params.location);
- vdb_dir /= stringify(m[k::package_id()]->name().category);
- vdb_dir /= (stringify(m[k::package_id()]->name().package) + "-" + stringify(m[k::package_id()]->version()));
+ vdb_dir /= stringify(m.package_id()->name().category);
+ vdb_dir /= (stringify(m.package_id()->name().package) + "-" + stringify(m.package_id()->version()));
VDBMerger merger(
- VDBMergerParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::image(), m[k::image_dir()])
- (k::root(), installed_root_key()->value())
- (k::contents_file(), vdb_dir / "CONTENTS")
- (k::config_protect(), config_protect)
- (k::config_protect_mask(), config_protect_mask)
- (k::package_id(), m[k::package_id()])
- (k::options(), m[k::options()]));
+ make_named_values<VDBMergerParams>(
+ value_for<n::config_protect>(config_protect),
+ value_for<n::config_protect_mask>(config_protect_mask),
+ value_for<n::contents_file>(vdb_dir / "CONTENTS"),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::image>(m.image_dir()),
+ value_for<n::options>(m.options()),
+ value_for<n::package_id>(m.package_id()),
+ value_for<n::root>(installed_root_key()->value())
+ ));
if (! merger.check())
{
@@ -844,15 +852,16 @@ VDBRepository::merge(const MergeParams & m)
perform_uninstall(is_replace, true);
VDBPostMergeCommand post_merge_command(
- VDBPostMergeCommandParams::named_create()
- (k::root(), installed_root_key()->value()));
+ make_named_values<VDBPostMergeCommandParams>(
+ value_for<n::root>(installed_root_key()->value())
+ ));
post_merge_command();
- _imp->names_cache->add(m[k::package_id()]->name());
+ _imp->names_cache->add(m.package_id()->name());
if (_imp->used_provides_cache || (! _imp->tried_provides_cache && load_provided_using_cache()))
{
- provides_from_package_id(*m[k::package_id()]);
+ provides_from_package_id(*m.package_id());
write_provides_cache();
_imp->provides.reset();
}
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 817239a..159cc5b 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -28,6 +28,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/options.hh>
#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
@@ -130,9 +131,9 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
&env, UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK((*repo)[k::use_interface()]->query_use(UseFlagName("flag1"), *e1) == use_enabled);
- TEST_CHECK((*repo)[k::use_interface()]->query_use(UseFlagName("flag2"), *e1) == use_enabled);
- TEST_CHECK((*repo)[k::use_interface()]->query_use(UseFlagName("flag3"), *e1) == use_disabled);
+ TEST_CHECK(repo->use_interface()->query_use(UseFlagName("flag1"), *e1) == use_enabled);
+ TEST_CHECK(repo->use_interface()->query_use(UseFlagName("flag2"), *e1) == use_enabled);
+ TEST_CHECK(repo->use_interface()->query_use(UseFlagName("flag3"), *e1) == use_disabled);
}
} test_vdb_repository_query_use;
@@ -334,11 +335,11 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(0, vdb_repo);
- InstallAction install_action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), vdb_repo)
- );
+ InstallAction install_action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(vdb_repo)
+ ));
UninstallAction uninstall_action;
@@ -448,11 +449,11 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(0, vdb_repo);
- InstallAction install_action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), vdb_repo)
- );
+ InstallAction install_action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(vdb_repo)
+ ));
UninstallAction uninstall_action;
@@ -562,11 +563,11 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(0, vdb_repo);
- InstallAction install_action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), vdb_repo)
- );
+ InstallAction install_action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(vdb_repo)
+ ));
UninstallAction uninstall_action;
@@ -806,20 +807,20 @@ namespace test_cases
TEST_CHECK(! provides_cache.exists());
{
- std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> seq((*vdb_repo)[k::provides_interface()]->provided_packages());
+ std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> seq(vdb_repo->provides_interface()->provided_packages());
TEST_CHECK_EQUAL(std::distance(seq->begin(), seq->end()), 5U);
RepositoryProvidesInterface::ProvidesSequence::ConstIterator it(seq->begin());
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg1-1::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg1-2::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg2-1::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg2-1::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg2-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-2::installed");
}
vdb_repo->regenerate_cache();
@@ -827,20 +828,20 @@ namespace test_cases
vdb_repo->invalidate();
{
- std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> seq((*vdb_repo)[k::provides_interface()]->provided_packages());
+ std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> seq(vdb_repo->provides_interface()->provided_packages());
TEST_CHECK_EQUAL(std::distance(seq->begin(), seq->end()), 5U);
RepositoryProvidesInterface::ProvidesSequence::ConstIterator it(seq->begin());
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg1-1::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg1-2::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/foo");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg2-1::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg2-1::installed");
- TEST_CHECK_STRINGIFY_EQUAL((*it)[k::virtual_name()], "virtual/bar");
- TEST_CHECK_STRINGIFY_EQUAL(*(*it++)[k::provided_by()], "cat1/pkg2-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg1-2::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/foo");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-1::installed");
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name(), "virtual/bar");
+ TEST_CHECK_STRINGIFY_EQUAL(*(*it++).provided_by(), "cat1/pkg2-2::installed");
}
}
@@ -921,11 +922,11 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(0, vdb_repo);
- InstallAction install_action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), vdb_repo)
- );
+ InstallAction install_action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(vdb_repo)
+ ));
UninstallAction uninstall_action;
@@ -1134,11 +1135,11 @@ namespace test_cases
std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
env.package_database()->add_repository(0, vdb_repo);
- InstallAction install_action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), vdb_repo)
- );
+ InstallAction install_action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(vdb_repo)
+ ));
TEST_CHECK(vdb_repo->package_ids(QualifiedPackageName("cat/pkg"))->empty());
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index a313075..bd40b20 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -37,6 +37,7 @@ using namespace paludis;
#include <paludis/util/sequence.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/make_named_values.hh>
#include <list>
#include <map>
@@ -57,8 +58,8 @@ namespace paludis
Implementation(const VDBUnmergerOptions & o) :
options(o)
{
- tokenise_whitespace(o[k::config_protect()], std::back_inserter(config_protect));
- tokenise_whitespace(o[k::config_protect_mask()], std::back_inserter(config_protect_mask));
+ tokenise_whitespace(o.config_protect(), std::back_inserter(config_protect));
+ tokenise_whitespace(o.config_protect_mask(), std::back_inserter(config_protect_mask));
}
};
}
@@ -116,9 +117,10 @@ class VDBUnmerger::MiscExtraInfo :
};
VDBUnmerger::VDBUnmerger(const VDBUnmergerOptions & o) :
- Unmerger(UnmergerOptions::named_create()
- (k::environment(), o[k::environment()])
- (k::root(), o[k::root()])),
+ Unmerger(make_named_values<UnmergerOptions>(
+ value_for<n::environment>(o.environment()),
+ value_for<n::root>(o.root())
+ )),
PrivateImplementationPattern<VDBUnmerger>(new Implementation<VDBUnmerger>(o)),
_imp(PrivateImplementationPattern<VDBUnmerger>::_imp.get())
{
@@ -131,29 +133,29 @@ VDBUnmerger::~VDBUnmerger()
Hook
VDBUnmerger::extend_hook(const Hook & h) const
{
- std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options[k::environment()]->bashrc_files());
+ std::tr1::shared_ptr<const FSEntrySequence> bashrc_files(_imp->options.environment()->bashrc_files());
Hook result(Unmerger::extend_hook(h)
- ("CONFIG_PROTECT", _imp->options[k::config_protect()])
- ("CONFIG_PROTECT_MASK", _imp->options[k::config_protect_mask()])
+ ("CONFIG_PROTECT", _imp->options.config_protect())
+ ("CONFIG_PROTECT_MASK", _imp->options.config_protect_mask())
("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " ")));
- if (_imp->options[k::package_id()])
+ if (_imp->options.package_id())
{
- std::string cat(stringify(_imp->options[k::package_id()]->name().category));
- std::string pn(stringify(_imp->options[k::package_id()]->name().package));
- std::string pvr(stringify(_imp->options[k::package_id()]->version()));
- std::string pv(stringify(_imp->options[k::package_id()]->version().remove_revision()));
+ std::string cat(stringify(_imp->options.package_id()->name().category));
+ std::string pn(stringify(_imp->options.package_id()->name().package));
+ std::string pvr(stringify(_imp->options.package_id()->version()));
+ std::string pv(stringify(_imp->options.package_id()->version().remove_revision()));
return result
("P", pn + "-" + pv)
("PN", pn)
("CATEGORY", cat)
- ("PR", _imp->options[k::package_id()]->version().revision_only())
+ ("PR", _imp->options.package_id()->version().revision_only())
("PV", pv)
("PVR", pvr)
("PF", pn + "-" + pvr)
- ("SLOT", stringify(_imp->options[k::package_id()]->slot()));
+ ("SLOT", stringify(_imp->options.package_id()->slot()));
}
return result;
@@ -187,7 +189,7 @@ VDBUnmerger::config_protected(const FSEntry & f) const
std::string
VDBUnmerger::make_tidy(const FSEntry & f) const
{
- std::string root_str(stringify(_imp->options[k::root()])), f_str(stringify(f));
+ std::string root_str(stringify(_imp->options.root())), f_str(stringify(f));
if (root_str == "/")
root_str.clear();
if (0 != f_str.compare(0, root_str.length(), root_str))
@@ -198,9 +200,9 @@ VDBUnmerger::make_tidy(const FSEntry & f) const
void
VDBUnmerger::populate_unmerge_set()
{
- std::ifstream c(stringify(_imp->options[k::contents_file()]).c_str());
+ std::ifstream c(stringify(_imp->options.contents_file()).c_str());
if (! c)
- throw VDBUnmergerError("Cannot read '" + stringify(_imp->options[k::contents_file()]) + "'");
+ throw VDBUnmergerError("Cannot read '" + stringify(_imp->options.contents_file()) + "'");
std::string line;
while (std::getline(c, line))
@@ -251,22 +253,22 @@ VDBUnmerger::check_file(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
{
std::tr1::shared_ptr<FileExtraInfo> fie(std::tr1::static_pointer_cast<FileExtraInfo>(ei));
- if (! (_imp->options[k::root()] / f).is_regular_file())
+ if (! (_imp->options.root() / f).is_regular_file())
display("--- [!type] " + stringify(f));
- else if ((_imp->options[k::root()] / f).mtime() != fie->_mtime)
+ else if ((_imp->options.root() / f).mtime() != fie->_mtime)
display("--- [!time] " + stringify(f));
else
{
- std::ifstream md5_file(stringify(_imp->options[k::root()] / f).c_str());
+ std::ifstream md5_file(stringify(_imp->options.root() / f).c_str());
if (! md5_file)
{
Log::get_instance()->message("e.vdb.contents.md5_failed", ll_warning, lc_no_context)
- << "Cannot get md5 for '" << (_imp->options[k::root()] / f) << "'";
+ << "Cannot get md5 for '" << (_imp->options.root() / f) << "'";
display("--- [!md5?] " + stringify(f));
}
else if (MD5(md5_file).hexsum() != fie->_md5sum)
display("--- [!md5 ] " + stringify(f));
- else if (config_protected(_imp->options[k::root()] / f))
+ else if (config_protected(_imp->options.root() / f))
display("--- [cfgpr] " + stringify(f));
else
return true;
@@ -280,11 +282,11 @@ VDBUnmerger::check_sym(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) co
{
std::tr1::shared_ptr<SymlinkExtraInfo> sie(std::tr1::static_pointer_cast<SymlinkExtraInfo>(ei));
- if (! (_imp->options[k::root()] / f).is_symbolic_link())
+ if (! (_imp->options.root() / f).is_symbolic_link())
display("--- [!type] " + stringify(f));
- else if ((_imp->options[k::root()] / f).mtime() != sie->_mtime)
+ else if ((_imp->options.root() / f).mtime() != sie->_mtime)
display("--- [!time] " + stringify(f));
- else if ((_imp->options[k::root()] / f).readlink() != sie->_dest)
+ else if ((_imp->options.root() / f).readlink() != sie->_dest)
display("--- [!dest] " + stringify(f));
else
return true;
@@ -297,9 +299,9 @@ VDBUnmerger::check_misc(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
{
std::tr1::shared_ptr<MiscExtraInfo> mie(std::tr1::static_pointer_cast<MiscExtraInfo>(ei));
- if ("fif" == mie->_type && ! (_imp->options[k::root()] / f).is_fifo())
+ if ("fif" == mie->_type && ! (_imp->options.root() / f).is_fifo())
display("--- [!type] " + stringify(f));
- else if ("dev" == mie->_type && ! (_imp->options[k::root()] / f).is_device())
+ else if ("dev" == mie->_type && ! (_imp->options.root() / f).is_device())
display("--- [!type] " + stringify(f));
else
return true;
@@ -310,9 +312,9 @@ VDBUnmerger::check_misc(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) c
bool
VDBUnmerger::check_dir(const FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (! (_imp->options[k::root()] / f).is_directory())
+ if (! (_imp->options.root() / f).is_directory())
display("--- [!type] " + stringify(f));
- else if (DirIterator(_imp->options[k::root()] / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
+ else if (DirIterator(_imp->options.root() / f, DirIteratorOptions() + dio_include_dotfiles + dio_first_only) != DirIterator())
display("--- [!empt] " + stringify(f));
else
return true;
diff --git a/paludis/repositories/e/vdb_unmerger.hh b/paludis/repositories/e/vdb_unmerger.hh
index d06971f..5d2b262 100644
--- a/paludis/repositories/e/vdb_unmerger.hh
+++ b/paludis/repositories/e/vdb_unmerger.hh
@@ -22,8 +22,6 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GENTOO_VDB_UNMERGER_HH 1
#include <paludis/repository.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/unmerger.hh>
@@ -32,6 +30,16 @@ namespace paludis
{
class Environment;
+ namespace n
+ {
+ struct config_protect;
+ struct config_protect_mask;
+ struct contents_file;
+ struct environment;
+ struct package_id;
+ struct root;
+ }
+
/**
* Options for a VDBUnmerger.
*
@@ -39,14 +47,15 @@ namespace paludis
* \ingroup grpvdbrepository
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::environment, Environment *>,
- kc::Field<k::root, FSEntry>,
- kc::Field<k::contents_file, FSEntry>,
- kc::Field<k::config_protect, std::string>,
- kc::Field<k::config_protect_mask, std::string>,
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >
- > VDBUnmergerOptions;
+ struct VDBUnmergerOptions
+ {
+ NamedValue<n::config_protect, std::string> config_protect;
+ NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::contents_file, FSEntry> contents_file;
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ NamedValue<n::root, FSEntry> root;
+ };
/**
* Thrown if an unmerge from a VDBRepository using VDBUnmerger fails.
diff --git a/paludis/repositories/e/vdb_unmerger_TEST.cc b/paludis/repositories/e/vdb_unmerger_TEST.cc
index a887df1..7ca2b45 100644
--- a/paludis/repositories/e/vdb_unmerger_TEST.cc
+++ b/paludis/repositories/e/vdb_unmerger_TEST.cc
@@ -20,6 +20,7 @@
#include "vdb_unmerger.hh"
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -66,13 +67,14 @@ namespace
TestCase("unmerge '" + what + "' test"),
root_dir("vdb_unmerger_TEST_dir/root"),
target(what),
- unmerger(VDBUnmergerOptions::named_create()
- (k::environment(), &env)
- (k::root(), root_dir)
- (k::contents_file(), "vdb_unmerger_TEST_dir/CONTENTS/" + what)
- (k::config_protect(), "/protected_file /protected_dir")
- (k::config_protect_mask(), "/protected_dir/unprotected_file /protected_dir/unprotected_dir")
- (k::package_id(), std::tr1::shared_ptr<PackageID>()))
+ unmerger(make_named_values<VDBUnmergerOptions>(
+ value_for<n::config_protect>("/protected_file /protected_dir"),
+ value_for<n::config_protect_mask>("/protected_dir/unprotected_file /protected_dir/unprotected_dir"),
+ value_for<n::contents_file>("vdb_unmerger_TEST_dir/CONTENTS/" + what),
+ value_for<n::environment>(&env),
+ value_for<n::package_id>(std::tr1::shared_ptr<PackageID>()),
+ value_for<n::root>(root_dir)
+ ))
{
}
};
diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc
index 3aeb5b0..16897a3 100644
--- a/paludis/repositories/fake/dep_parser.cc
+++ b/paludis/repositories/fake/dep_parser.cc
@@ -18,12 +18,11 @@
*/
#include <paludis/repositories/fake/dep_parser.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/options.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/elike_dep_parser.hh>
#include <paludis/elike_conditional_dep_spec.hh>
#include <paludis/elike_package_dep_spec.hh>
@@ -41,6 +40,15 @@ FakeDepParseError::FakeDepParseError(const std::string & s, const std::string &
{
}
+namespace paludis
+{
+ namespace n
+ {
+ struct add_handler;
+ struct item;
+ }
+}
+
namespace
{
template <typename T_>
@@ -48,10 +56,11 @@ namespace
{
typedef std::tr1::function<void (const std::tr1::shared_ptr<const typename T_::ConstItem> &)> AddHandler;
- typedef kc::KeyedClass<
- kc::Field<k::add_handler, AddHandler>,
- kc::Field<k::item, const std::tr1::shared_ptr<const typename T_::ConstItem> >
- > Item;
+ struct Item
+ {
+ NamedValue<n::add_handler, AddHandler> add_handler;
+ NamedValue<n::item, const std::tr1::shared_ptr<const typename T_::ConstItem> > item;
+ };
typedef std::list<Item> Stack;
};
@@ -64,7 +73,7 @@ namespace
+ epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps
+ epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps
+ epdso_strict_parsing, id));
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, PackageDepSpec>(make_shared_ptr(new PackageDepSpec(p)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PackageDepSpec>(make_shared_ptr(new PackageDepSpec(p)))));
}
template <typename T_>
@@ -79,7 +88,7 @@ namespace
+ epdso_allow_slot_star_deps + epdso_allow_slot_equal_deps + epdso_allow_repository_deps
+ epdso_allow_use_deps + epdso_allow_ranged_deps + epdso_allow_tilde_greater_deps
+ epdso_strict_parsing, id)))));
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, BlockDepSpec>(b)));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, BlockDepSpec>(b)));
}
else
package_dep_spec_string_handler<T_>(h, s, id);
@@ -88,19 +97,19 @@ namespace
template <typename T_>
void license_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, LicenseDepSpec>(make_shared_ptr(new LicenseDepSpec(s)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, LicenseDepSpec>(make_shared_ptr(new LicenseDepSpec(s)))));
}
template <typename T_>
void simple_uri_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, SimpleURIDepSpec>(make_shared_ptr(new SimpleURIDepSpec(s)))));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, SimpleURIDepSpec>(make_shared_ptr(new SimpleURIDepSpec(s)))));
}
template <typename T_>
void arrow_handler(const typename ParseStackTypes<T_>::Stack & h, const std::string & s, const std::string & t)
{
- (*h.begin())[k::add_handler()](make_shared_ptr(new TreeLeaf<T_, FetchableURIDepSpec>(make_shared_ptr(
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, FetchableURIDepSpec>(make_shared_ptr(
new FetchableURIDepSpec(t.empty() ? s : s + " -> " + t)))));
}
@@ -138,11 +147,11 @@ namespace
using namespace std::tr1::placeholders;
std::tr1::shared_ptr<ConstTreeSequence<T_, A_> > item(
new ConstTreeSequence<T_, A_>(make_shared_ptr(new A_)));
- (*stack.begin())[k::add_handler()](item);
- stack.push_front(ParseStackTypes<T_>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<T_, A_>::add, item.get(), _1))
- (k::item(), item)
- );
+ (*stack.begin()).add_handler()(item);
+ stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<T_, A_>::add, item.get(), _1)),
+ value_for<n::item>(item)
+ ));
}
template <typename T_>
@@ -153,11 +162,11 @@ namespace
std::tr1::shared_ptr<ConstTreeSequence<T_, ConditionalDepSpec> > item(
new ConstTreeSequence<T_, ConditionalDepSpec>(make_shared_ptr(new ConditionalDepSpec(
parse_elike_conditional_dep_spec(u, env, id)))));
- (*stack.begin())[k::add_handler()](item);
- stack.push_front(ParseStackTypes<T_>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<T_, ConditionalDepSpec>::add, item.get(), _1))
- (k::item(), item)
- );
+ (*stack.begin()).add_handler()(item);
+ stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<T_, ConditionalDepSpec>::add, item.get(), _1)),
+ value_for<n::item>(item)
+ ));
}
template <typename T_>
@@ -193,29 +202,29 @@ paludis::fakerepository::parse_depend(const std::string & s,
ParseStackTypes<DependencySpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<DependencySpecTree, AllDepSpec> > top(
new ConstTreeSequence<DependencySpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<DependencySpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<DependencySpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<DependencySpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::tr1::ref(stack), _1, id))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_all_handler<DependencySpecTree, AnyDepSpec>, std::tr1::ref(stack)))
- (k::on_all(), std::tr1::bind(&any_all_handler<DependencySpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<DependencySpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<DependencySpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<DependencySpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<DependencySpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_all_handler<DependencySpecTree, AnyDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<DependencySpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<DependencySpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&package_or_block_dep_spec_string_handler<DependencySpecTree>, std::tr1::ref(stack), _1, id)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<DependencySpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<ProvideSpecTree::ConstItem>
@@ -227,29 +236,29 @@ paludis::fakerepository::parse_provide(const std::string & s,
ParseStackTypes<ProvideSpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<ProvideSpecTree, AllDepSpec> > top(
new ConstTreeSequence<ProvideSpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<ProvideSpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<ProvideSpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<ProvideSpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<ProvideSpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, id))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<ProvideSpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<ProvideSpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<ProvideSpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<ProvideSpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<ProvideSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<ProvideSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&package_dep_spec_string_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, id)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<ProvideSpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<FetchableURISpecTree::ConstItem>
@@ -261,29 +270,29 @@ paludis::fakerepository::parse_fetchable_uri(const std::string & s,
ParseStackTypes<FetchableURISpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<FetchableURISpecTree, AllDepSpec> > top(
new ConstTreeSequence<FetchableURISpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<FetchableURISpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<FetchableURISpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<FetchableURISpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<FetchableURISpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, ""))
- (k::on_arrow(), std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, _2))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<FetchableURISpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<FetchableURISpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<FetchableURISpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<FetchableURISpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<FetchableURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<FetchableURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&arrow_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, "")),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<FetchableURISpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<SimpleURISpecTree::ConstItem>
@@ -295,29 +304,29 @@ paludis::fakerepository::parse_simple_uri(const std::string & s,
ParseStackTypes<SimpleURISpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<SimpleURISpecTree, AllDepSpec> > top(
new ConstTreeSequence<SimpleURISpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<SimpleURISpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<SimpleURISpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<SimpleURISpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<SimpleURISpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&simple_uri_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_not_allowed_handler, s))
- (k::on_all(), std::tr1::bind(&any_all_handler<SimpleURISpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<SimpleURISpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<SimpleURISpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<SimpleURISpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_not_allowed_handler, s)),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<SimpleURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<SimpleURISpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&simple_uri_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<SimpleURISpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
std::tr1::shared_ptr<LicenseSpecTree::ConstItem>
@@ -329,28 +338,28 @@ paludis::fakerepository::parse_license(const std::string & s,
ParseStackTypes<LicenseSpecTree>::Stack stack;
std::tr1::shared_ptr<ConstTreeSequence<LicenseSpecTree, AllDepSpec> > top(
new ConstTreeSequence<LicenseSpecTree, AllDepSpec>(make_shared_ptr(new AllDepSpec)));
- stack.push_front(ParseStackTypes<LicenseSpecTree>::Item::named_create()
- (k::add_handler(), std::tr1::bind(&ConstTreeSequence<LicenseSpecTree, AllDepSpec>::add, top.get(), _1))
- (k::item(), top)
- );
+ stack.push_front(make_named_values<ParseStackTypes<LicenseSpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<LicenseSpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top)
+ ));
ELikeDepParserCallbacks callbacks(
- ELikeDepParserCallbacks::named_create()
- (k::on_string(), std::tr1::bind(&license_handler<LicenseSpecTree>, std::tr1::ref(stack), _1))
- (k::on_arrow(), std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2))
- (k::on_any(), std::tr1::bind(&any_all_handler<LicenseSpecTree, AnyDepSpec>, std::tr1::ref(stack)))
- (k::on_all(), std::tr1::bind(&any_all_handler<LicenseSpecTree, AllDepSpec>, std::tr1::ref(stack)))
- (k::on_use(), std::tr1::bind(&use_handler<LicenseSpecTree>, std::tr1::ref(stack), _1, env, id))
- (k::on_label(), std::tr1::bind(&labels_not_allowed_handler, s, _1))
- (k::on_pop(), std::tr1::bind(&pop_handler<LicenseSpecTree>, std::tr1::ref(stack), s))
- (k::on_error(), std::tr1::bind(&error_handler, s, _1))
- (k::on_should_be_empty(), std::tr1::bind(&should_be_empty_handler<LicenseSpecTree>, std::tr1::ref(stack), s))
- (k::on_use_under_any(), &do_nothing)
- (k::on_annotations(), &discard_annotations)
- );
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<LicenseSpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(&discard_annotations),
+ value_for<n::on_any>(std::tr1::bind(&any_all_handler<LicenseSpecTree, AnyDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_arrow>(std::tr1::bind(&arrows_not_allowed_handler, s, _1, _2)),
+ value_for<n::on_error>(std::tr1::bind(&error_handler, s, _1)),
+ value_for<n::on_label>(std::tr1::bind(&labels_not_allowed_handler, s, _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<LicenseSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<LicenseSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&license_handler<LicenseSpecTree>, std::tr1::ref(stack), _1)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<LicenseSpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
parse_elike_dependencies(s, callbacks);
- return (*stack.begin())[k::item()];
+ return (*stack.begin()).item();
}
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index b8409ce..553ab36 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/environment.hh>
@@ -53,20 +54,21 @@ namespace paludis
}
FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, const RepositoryName & our_name) :
- FakeRepositoryBase(e, our_name, RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), this)
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), this)
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::destination_interface(), this)
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ FakeRepositoryBase(e, our_name, make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(this),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(this),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(this),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<FakeInstalledRepository>(new Implementation<FakeInstalledRepository>),
_imp(PrivateImplementationPattern<FakeInstalledRepository>::_imp)
{
@@ -108,9 +110,10 @@ FakeInstalledRepository::provided_packages() const
(*v)->provide_key()->value()->accept(f);
for (DepSpecFlattener<ProvideSpecTree, PackageDepSpec>::ConstIterator q(f.begin()), q_end(f.end()) ; q != q_end ; ++q)
- result->push_back(RepositoryProvidesEntry::named_create()
- (k::virtual_name(), QualifiedPackageName((*q)->text()))
- (k::provided_by(), *v));
+ result->push_back(make_named_values<RepositoryProvidesEntry>(
+ value_for<n::provided_by>(*v),
+ value_for<n::virtual_name>(QualifiedPackageName((*q)->text()))
+ ));
}
}
}
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 019dda3..d086986 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -1004,9 +1004,9 @@ FakeMetadataIUseSetKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
if (! result.empty())
result.append(" ");
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(i->flag, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(i->flag, *_imp->id))
result.append(f.format(*i, format::Masked()));
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(i->flag, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(i->flag, *_imp->id))
result.append(f.format(*i, format::Forced()));
else if (_imp->env->query_use(i->flag, *_imp->id))
result.append(f.format(*i, format::Enabled()));
@@ -1033,12 +1033,12 @@ FakeMetadataIUseSetKey::pretty_print_flat_with_comparison(
std::string l;
bool n;
- if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_mask(i->flag, *_imp->id))
+ if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_mask(i->flag, *_imp->id))
{
l = f.format(*i, format::Masked());
n = false;
}
- else if ((*_imp->id->repository())[k::use_interface()] && (*_imp->id->repository())[k::use_interface()]->query_use_force(i->flag, *_imp->id))
+ else if ((*_imp->id->repository()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(i->flag, *_imp->id))
{
l = f.format(*i, format::Forced());
n = true;
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 3e73df4..ba5a821 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -24,7 +24,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
@@ -60,21 +60,22 @@ namespace paludis
FakeRepository::FakeRepository(const Environment * const env, const RepositoryName & r) :
PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>),
- FakeRepositoryBase(env, r, RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), this)
- (k::mirrors_interface(), this)
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), (*DistributionData::get_instance()->distribution_from_string(
- env->distribution()))[k::support_old_style_virtuals()] ? this : 0)
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ FakeRepositoryBase(env, r, make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(this),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(this),
+ value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string(
+ env->distribution())).support_old_style_virtuals() ? this : 0)
+ )),
_imp(PrivateImplementationPattern<FakeRepository>::_imp)
{
add_metadata_key(_imp->format_key);
@@ -82,21 +83,22 @@ FakeRepository::FakeRepository(const Environment * const env, const RepositoryNa
FakeRepository::FakeRepository(const FakeRepositoryParams & params) :
PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>),
- FakeRepositoryBase(params.environment, params.name, RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), this)
- (k::mirrors_interface(), this)
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), (*DistributionData::get_instance()->distribution_from_string(
- params.environment->distribution()))[k::support_old_style_virtuals()] ? this : 0)
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ FakeRepositoryBase(params.environment, params.name, make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(this),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(this),
+ value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string(
+ params.environment->distribution())).support_old_style_virtuals() ? this : 0)
+ )),
_imp(PrivateImplementationPattern<FakeRepository>::_imp)
{
add_metadata_key(_imp->format_key);
@@ -115,7 +117,10 @@ FakeRepository::virtual_packages() const
void
FakeRepository::add_virtual_package(const QualifiedPackageName & q, std::tr1::shared_ptr<const PackageDepSpec> p)
{
- _imp->virtual_packages->push_back(RepositoryVirtualsEntry(q, p));
+ _imp->virtual_packages->push_back(make_named_values<RepositoryVirtualsEntry>(
+ value_for<n::provided_by_spec>(p),
+ value_for<n::virtual_name>(q)
+ ));
}
namespace paludis
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index ed088e8..4b77049 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -31,6 +31,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
#include <paludis/literal_metadata_key.hh>
@@ -86,20 +87,21 @@ namespace paludis
GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
Repository(RepositoryName("gems"),
- RepositoryCapabilities::named_create()
- (k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<GemsRepository>(new Implementation<GemsRepository>(params)),
_imp(PrivateImplementationPattern<GemsRepository>::_imp)
{
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 199ba4c..1f5a968 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -36,6 +36,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <tr1/unordered_map>
@@ -86,20 +87,21 @@ namespace paludis
InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepositoryParams & params) :
Repository(RepositoryName("installed-gems"),
- RepositoryCapabilities::named_create()
- (k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::destination_interface(), this)
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(this),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<InstalledGemsRepository>(new Implementation<InstalledGemsRepository>(params)),
_imp(PrivateImplementationPattern<InstalledGemsRepository>::_imp)
{
diff --git a/paludis/repositories/gems/registration.cc b/paludis/repositories/gems/registration.cc
index f161ccb..1d2d54c 100644
--- a/paludis/repositories/gems/registration.cc
+++ b/paludis/repositories/gems/registration.cc
@@ -25,7 +25,6 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/kc.hh>
#include <paludis/distribution.hh>
#include <paludis/environment.hh>
@@ -52,7 +51,7 @@ namespace
std::string builddir(f("builddir"));
if (builddir.empty())
- builddir = (*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::default_ebuild_builddir()];
+ builddir = (*DistributionData::get_instance()->distribution_from_string(env->distribution())).default_ebuild_builddir();
return make_shared_ptr(new GemsRepository(gems::RepositoryParams::create()
.location(location)
@@ -74,7 +73,7 @@ namespace
std::string builddir(f("builddir"));
if (builddir.empty())
- builddir = (*DistributionData::get_instance()->distribution_from_string(env->distribution()))[k::default_ebuild_builddir()];
+ builddir = (*DistributionData::get_instance()->distribution_from_string(env->distribution())).default_ebuild_builddir();
std::string root(f("root"));
if (root.empty())
diff --git a/paludis/repositories/unavailable/registration.cc b/paludis/repositories/unavailable/registration.cc
index bc88d95..a408f10 100644
--- a/paludis/repositories/unavailable/registration.cc
+++ b/paludis/repositories/unavailable/registration.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/unavailable/unavailable_repository.hh>
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/make_named_values.hh>
using namespace paludis;
using namespace paludis::unavailable_repository;
@@ -52,13 +53,13 @@ namespace
std::string sync_options(f("sync_options"));
return std::tr1::shared_ptr<UnavailableRepository>(new UnavailableRepository(
- UnavailableRepositoryParams::named_create()
- (k::name(), RepositoryName(name_str))
- (k::location(), location)
- (k::sync(), sync)
- (k::sync_options(), sync_options)
- (k::environment(), env)
- ));
+ make_named_values<UnavailableRepositoryParams>(
+ value_for<n::environment>(env),
+ value_for<n::location>(location),
+ value_for<n::name>(RepositoryName(name_str)),
+ value_for<n::sync>(sync),
+ value_for<n::sync_options>(sync_options)
+ )));
}
}
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index ddade44..cf43057 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -20,7 +20,6 @@
#include <paludis/repositories/unavailable/unavailable_id.hh>
#include <paludis/repositories/unavailable/unavailable_repository.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/visitor_cast.hh>
@@ -52,15 +51,15 @@ namespace paludis
Implementation(
const UnavailableIDParams & e) :
- name(e[k::name()]),
- version(e[k::version()]),
- slot(e[k::slot()]),
- repo(e[k::repository()]),
- description_key(e[k::description()]),
- repository_homepage_key(e[k::repository_homepage()]),
- repository_description_key(e[k::repository_description()]),
- from_repositories_key(e[k::from_repositories()]),
- mask(e[k::mask()])
+ name(e.name()),
+ version(e.version()),
+ slot(e.slot()),
+ repo(e.repository()),
+ description_key(e.description()),
+ repository_homepage_key(e.repository_homepage()),
+ repository_description_key(e.repository_description()),
+ from_repositories_key(e.from_repositories()),
+ mask(e.mask())
{
}
};
diff --git a/paludis/repositories/unavailable/unavailable_id.hh b/paludis/repositories/unavailable/unavailable_id.hh
index aafa2b8..970e6b1 100644
--- a/paludis/repositories/unavailable/unavailable_id.hh
+++ b/paludis/repositories/unavailable/unavailable_id.hh
@@ -20,25 +20,40 @@
#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_ID_HH
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_ID_HH 1
+#include <paludis/util/named_value.hh>
#include <paludis/package_id.hh>
#include <paludis/repositories/unavailable/unavailable_repository_file-fwd.hh>
#include <paludis/repositories/unavailable/unavailable_repository-fwd.hh>
namespace paludis
{
+ namespace n
+ {
+ struct description;
+ struct from_repositories;
+ struct mask;
+ struct name;
+ struct repository;
+ struct repository_description;
+ struct repository_homepage;
+ struct slot;
+ struct version;
+ }
+
namespace unavailable_repository
{
- typedef kc::KeyedClass<
- kc::Field<k::name, QualifiedPackageName>,
- kc::Field<k::version, VersionSpec>,
- kc::Field<k::slot, SlotName>,
- kc::Field<k::repository, const UnavailableRepository *>,
- kc::Field<k::from_repositories, std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > >,
- kc::Field<k::repository_homepage, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
- kc::Field<k::repository_description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
- kc::Field<k::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >,
- kc::Field<k::mask, std::tr1::shared_ptr<const Mask> >
- > UnavailableIDParams;
+ struct UnavailableIDParams
+ {
+ NamedValue<n::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > description;
+ NamedValue<n::from_repositories, std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > > from_repositories;
+ NamedValue<n::mask, std::tr1::shared_ptr<const Mask> > mask;
+ NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::repository, const UnavailableRepository *> repository;
+ NamedValue<n::repository_description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > repository_description;
+ NamedValue<n::repository_homepage, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > repository_homepage;
+ NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::version, VersionSpec> version;
+ };
class PALUDIS_VISIBLE UnavailableID :
public PackageID,
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index d94f69c..42da646 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -25,6 +25,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/syncer.hh>
@@ -38,7 +39,7 @@ namespace
std::tr1::shared_ptr<UnavailableRepositoryStore>
make_store(const UnavailableRepository * const repo, const UnavailableRepositoryParams & p)
{
- return make_shared_ptr(new UnavailableRepositoryStore(p[k::environment()], repo, p[k::location()]));
+ return make_shared_ptr(new UnavailableRepositoryStore(p.environment(), repo, p.location()));
}
}
@@ -62,11 +63,11 @@ namespace paludis
format_key(new LiteralMetadataValueKey<std::string> ("format", "format",
mkt_significant, "unavailable")),
location_key(new LiteralMetadataValueKey<FSEntry> ("location", "location",
- mkt_significant, params[k::location()])),
+ mkt_significant, params.location())),
sync_key(new LiteralMetadataValueKey<std::string> (
- "sync", "sync", mkt_normal, params[k::sync()])),
+ "sync", "sync", mkt_normal, params.sync())),
sync_options_key(new LiteralMetadataValueKey<std::string> (
- "sync_options", "sync_options", mkt_normal, params[k::sync_options()])),
+ "sync_options", "sync_options", mkt_normal, params.sync_options())),
store(DeferredConstructionPtr<std::tr1::shared_ptr<UnavailableRepositoryStore> > (
std::tr1::bind(&make_store, repo, std::tr1::cref(params))))
{
@@ -82,22 +83,22 @@ UnavailableRepositoryConfigurationError::UnavailableRepositoryConfigurationError
UnavailableRepository::UnavailableRepository(const UnavailableRepositoryParams & p) :
PrivateImplementationPattern<UnavailableRepository>(new Implementation<UnavailableRepository>(this, p)),
Repository(
- p[k::name()],
- RepositoryCapabilities::named_create()
- (k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
- (k::syncable_interface(), this)
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))
- ),
+ p.name(),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
+ value_for<n::syncable_interface>(this),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
_imp(PrivateImplementationPattern<UnavailableRepository>::_imp)
{
_add_metadata_keys();
@@ -254,26 +255,26 @@ UnavailableRepository::sync() const
{
Context context("When syncing repository '" + stringify(name()) + "':");
- if (_imp->params[k::sync()].empty())
+ if (_imp->params.sync().empty())
return false;
std::list<std::string> sync_list;
- tokenise_whitespace(_imp->params[k::sync()], std::back_inserter(sync_list));
+ tokenise_whitespace(_imp->params.sync(), std::back_inserter(sync_list));
bool ok(false);
for (std::list<std::string>::const_iterator s(sync_list.begin()),
s_end(sync_list.end()) ; s != s_end ; ++s)
{
- DefaultSyncer syncer(SyncerParams::named_create()
- (k::environment(), _imp->params[k::environment()])
- (k::local(), stringify(_imp->params[k::location()]))
- (k::remote(), *s)
- );
- SyncOptions opts(
- _imp->params[k::sync_options()],
- FSEntry("/dev/null"),
- "sync " + stringify(name()) + "> "
- );
+ DefaultSyncer syncer(make_named_values<SyncerParams>(
+ value_for<n::environment>(_imp->params.environment()),
+ value_for<n::local>(stringify(_imp->params.location())),
+ value_for<n::remote>(*s)
+ ));
+ SyncOptions opts(make_named_values<SyncOptions>(
+ value_for<n::filter_file>(FSEntry("/dev/null")),
+ value_for<n::options>(_imp->params.sync_options()),
+ value_for<n::output_prefix>("sync " + stringify(name()) + "> ")
+ ));
try
{
syncer.sync(opts);
@@ -288,7 +289,7 @@ UnavailableRepository::sync() const
}
if (! ok)
- throw SyncFailedError(stringify(_imp->params[k::location()]), _imp->params[k::sync()]);
+ throw SyncFailedError(stringify(_imp->params.location()), _imp->params.sync());
return true;
}
diff --git a/paludis/repositories/unavailable/unavailable_repository.hh b/paludis/repositories/unavailable/unavailable_repository.hh
index cdcecab..95be501 100644
--- a/paludis/repositories/unavailable/unavailable_repository.hh
+++ b/paludis/repositories/unavailable/unavailable_repository.hh
@@ -27,6 +27,15 @@
namespace paludis
{
+ namespace n
+ {
+ struct environment;
+ struct location;
+ struct name;
+ struct sync;
+ struct sync_options;
+ }
+
namespace unavailable_repository
{
class PALUDIS_VISIBLE UnavailableRepositoryConfigurationError :
@@ -36,13 +45,14 @@ namespace paludis
UnavailableRepositoryConfigurationError(const std::string &) throw ();
};
- typedef kc::KeyedClass<
- kc::Field<k::environment, Environment *>,
- kc::Field<k::name, RepositoryName>,
- kc::Field<k::location, FSEntry>,
- kc::Field<k::sync, std::string>,
- kc::Field<k::sync_options, std::string>
- > UnavailableRepositoryParams;
+ struct UnavailableRepositoryParams
+ {
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::location, FSEntry> location;
+ NamedValue<n::name, RepositoryName> name;
+ NamedValue<n::sync, std::string> sync;
+ NamedValue<n::sync_options, std::string> sync_options;
+ };
class PALUDIS_VISIBLE UnavailableRepository :
private PrivateImplementationPattern<UnavailableRepository>,
diff --git a/paludis/repositories/unavailable/unavailable_repository_TEST.cc b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
index eca2373..41a96bc 100644
--- a/paludis/repositories/unavailable/unavailable_repository_TEST.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
@@ -24,6 +24,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
@@ -48,13 +49,13 @@ namespace test_cases
{
TestEnvironment env;
std::tr1::shared_ptr<UnavailableRepository> repo(new UnavailableRepository(
- UnavailableRepositoryParams::named_create()
- (k::name(), RepositoryName("unavailable"))
- (k::sync(), "")
- (k::sync_options(), "")
- (k::location(), FSEntry::cwd() / "unavailable_repository_TEST_dir" / "repo1")
- (k::environment(), &env)
- ));
+ make_named_values<UnavailableRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::location>(FSEntry::cwd() / "unavailable_repository_TEST_dir" / "repo1"),
+ value_for<n::name>(RepositoryName("unavailable")),
+ value_for<n::sync>(""),
+ value_for<n::sync_options>("")
+ )));
env.package_database()->add_repository(1, repo);
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "unavailable");
}
@@ -68,13 +69,13 @@ namespace test_cases
{
TestEnvironment env;
std::tr1::shared_ptr<UnavailableRepository> repo(new UnavailableRepository(
- UnavailableRepositoryParams::named_create()
- (k::name(), RepositoryName("unavailable"))
- (k::sync(), "")
- (k::sync_options(), "")
- (k::location(), FSEntry::cwd() / "unavailable_repository_TEST_dir" / "repo2")
- (k::environment(), &env)
- ));
+ make_named_values<UnavailableRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::location>(FSEntry::cwd() / "unavailable_repository_TEST_dir" / "repo2"),
+ value_for<n::name>(RepositoryName("unavailable")),
+ value_for<n::sync>(""),
+ value_for<n::sync_options>("")
+ )));
env.package_database()->add_repository(1, repo);
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "unavailable");
diff --git a/paludis/repositories/unavailable/unavailable_repository_file-fwd.hh b/paludis/repositories/unavailable/unavailable_repository_file-fwd.hh
index b779c32..8855064 100644
--- a/paludis/repositories/unavailable/unavailable_repository_file-fwd.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_file-fwd.hh
@@ -21,25 +21,33 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNAVAILABLE_UNAVAILABLE_REPOSITORY_FILE_FWD_HH 1
#include <paludis/util/attributes.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/version_spec-fwd.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/name.hh>
+#include <paludis/version_spec.hh>
#include <paludis/metadata_key-fwd.hh>
#include <tr1/memory>
namespace paludis
{
+ namespace n
+ {
+ struct description;
+ struct name;
+ struct slot;
+ struct version;
+ }
+
namespace unavailable_repository
{
class UnavailableRepositoryFile;
- typedef kc::KeyedClass<
- kc::Field<k::name, QualifiedPackageName>,
- kc::Field<k::version, VersionSpec>,
- kc::Field<k::slot, SlotName>,
- kc::Field<k::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > >
- > UnavailableRepositoryFileEntry;
+ struct UnavailableRepositoryFileEntry
+ {
+ NamedValue<n::description, std::tr1::shared_ptr<const MetadataValueKey<std::string> > > description;
+ NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::version, VersionSpec> version;
+ };
}
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_file.cc b/paludis/repositories/unavailable/unavailable_repository_file.cc
index d4f7548..dc406e0 100644
--- a/paludis/repositories/unavailable/unavailable_repository_file.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_file.cc
@@ -21,10 +21,10 @@
#include <paludis/repositories/unavailable/unavailable_repository.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/simple_parser.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
@@ -188,12 +188,12 @@ UnavailableRepositoryFile::_load(const FSEntry & f)
token));
for (std::list<VersionSpec>::const_iterator v(versions.begin()), v_end(versions.end()) ;
v != v_end ; ++v)
- _imp->entries.push_back(UnavailableRepositoryFileEntry::named_create()
- (k::name(), category + package)
- (k::version(), *v)
- (k::slot(), slot)
- (k::description(), desc)
- );
+ _imp->entries.push_back(make_named_values<UnavailableRepositoryFileEntry>(
+ value_for<n::description>(desc),
+ value_for<n::name>(category + package),
+ value_for<n::slot>(slot),
+ value_for<n::version>(*v)
+ ));
}
else
throw UnavailableRepositoryConfigurationError(
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index f47cc57..c5ee262 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -28,10 +28,10 @@
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/hashes.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/literal_metadata_key.hh>
@@ -141,40 +141,40 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
for (UnavailableRepositoryFile::ConstIterator i(file.begin()), i_end(file.end()) ;
i != i_end ; ++i)
{
- if (old_name.category != (*i)[k::name()].category)
+ if (old_name.category != (*i).name().category)
{
- _imp->categories->insert((*i)[k::name()].category);
- PackageNames::iterator p(_imp->package_names.find((*i)[k::name()].category));
+ _imp->categories->insert((*i).name().category);
+ PackageNames::iterator p(_imp->package_names.find((*i).name().category));
if (_imp->package_names.end() == p)
- p = _imp->package_names.insert(std::make_pair((*i)[k::name()].category,
+ p = _imp->package_names.insert(std::make_pair((*i).name().category,
make_shared_ptr(new QualifiedPackageNameSet))).first;
pkgs = p->second;
}
- if (old_name != (*i)[k::name()])
+ if (old_name != (*i).name())
{
- pkgs->insert((*i)[k::name()]);
- IDs::iterator p(_imp->ids.find((*i)[k::name()]));
+ pkgs->insert((*i).name());
+ IDs::iterator p(_imp->ids.find((*i).name()));
if (_imp->ids.end() == p)
- p = _imp->ids.insert(std::make_pair((*i)[k::name()],
+ p = _imp->ids.insert(std::make_pair((*i).name(),
make_shared_ptr(new PackageIDSequence))).first;
ids = p->second;
}
- ids->push_back(make_shared_ptr(new UnavailableID(UnavailableIDParams::named_create()
- (k::repository(), _imp->repo)
- (k::name(), (*i)[k::name()])
- (k::version(), (*i)[k::version()])
- (k::slot(), (*i)[k::slot()])
- (k::description(), (*i)[k::description()])
- (k::from_repositories(), from_repositories)
- (k::repository_homepage(), repository_homepage)
- (k::repository_description(), repository_description)
- (k::mask(), mask)
- )));
-
- old_name = (*i)[k::name()];
+ ids->push_back(make_shared_ptr(new UnavailableID(make_named_values<UnavailableIDParams>(
+ value_for<n::description>((*i).description()),
+ value_for<n::from_repositories>(from_repositories),
+ value_for<n::mask>(mask),
+ value_for<n::name>((*i).name()),
+ value_for<n::repository>(_imp->repo),
+ value_for<n::repository_description>(repository_description),
+ value_for<n::repository_homepage>(repository_homepage),
+ value_for<n::slot>((*i).slot()),
+ value_for<n::version>((*i).version())
+ ))));
+
+ old_name = (*i).name();
}
}
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index b4f7bd7..536fe7c 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -33,6 +33,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/package_database.hh>
@@ -748,14 +749,15 @@ InstalledUnpackagedID::uninstall(const bool replace) const
FSEntry ver_dir(fs_location_key()->value());
NDBAMUnmerger unmerger(
- NDBAMUnmergerOptions::named_create()
- (k::environment(), _imp->env)
- (k::root(), _imp->root)
- (k::contents_file(), ver_dir / "contents")
- (k::config_protect(), getenv_with_default("CONFIG_PROTECT", ""))
- (k::config_protect_mask(), getenv_with_default("CONFIG_PROTECT_MASK", ""))
- (k::ndbam(), _imp->ndbam)
- (k::package_id(), shared_from_this()));
+ make_named_values<NDBAMUnmergerOptions>(
+ value_for<n::config_protect>(getenv_with_default("CONFIG_PROTECT", "")),
+ value_for<n::config_protect_mask>(getenv_with_default("CONFIG_PROTECT_MASK", "")),
+ value_for<n::contents_file>(ver_dir / "contents"),
+ value_for<n::environment>(_imp->env),
+ value_for<n::ndbam>(_imp->ndbam),
+ value_for<n::package_id>(shared_from_this()),
+ value_for<n::root>(_imp->root)
+ ));
unmerger.unmerge();
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index acd6f33..9e9175a 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -30,8 +30,8 @@
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/system.hh>
#include <paludis/util/cookie.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/visitor_cast.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/action.hh>
#include <paludis/environment.hh>
@@ -84,20 +84,21 @@ namespace paludis
InstalledUnpackagedRepository::InstalledUnpackagedRepository(
const RepositoryName & n, const InstalledUnpackagedRepositoryParams & p) :
PrivateImplementationPattern<InstalledUnpackagedRepository>(new Implementation<InstalledUnpackagedRepository>(p)),
- Repository(n, RepositoryCapabilities::named_create()
- (k::sets_interface(), this)
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::destination_interface(), this)
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ Repository(n, make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(this),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(this),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
_imp(PrivateImplementationPattern<InstalledUnpackagedRepository>::_imp)
{
_add_metadata_keys();
@@ -125,11 +126,11 @@ InstalledUnpackagedRepository::package_ids(const QualifiedPackageName & q) const
for (IndirectIterator<NDBAMEntrySequence::ConstIterator> e(entries->begin()), e_end(entries->end()) ;
e != e_end ; ++e)
{
- Lock l(*(*e)[k::mutex()]);
- if (! (*e)[k::package_id()])
- (*e)[k::package_id()].reset(new InstalledUnpackagedID(_imp->params.environment, (*e)[k::name()], (*e)[k::version()],
- (*e)[k::slot()], name(), (*e)[k::fs_location()], (*e)[k::magic()], installed_root_key()->value(), &_imp->ndbam));
- result->push_back((*e)[k::package_id()]);
+ Lock l(*(*e).mutex());
+ if (! (*e).package_id())
+ (*e).package_id().reset(new InstalledUnpackagedID(_imp->params.environment, (*e).name(), (*e).version(),
+ (*e).slot(), name(), (*e).fs_location(), (*e).magic(), installed_root_key()->value(), &_imp->ndbam));
+ result->push_back((*e).package_id());
}
return result;
@@ -243,16 +244,16 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
{
using namespace std::tr1::placeholders;
- Context context("When merging '" + stringify(*m[k::package_id()]) + "' at '" + stringify(m[k::image_dir()])
+ Context context("When merging '" + stringify(*m.package_id()) + "' at '" + stringify(m.image_dir())
+ "' to InstalledUnpackagedRepository repository '" + stringify(name()) + "':");
- if (! is_suitable_destination_for(*m[k::package_id()]))
- throw InstallActionError("Not a suitable destination for '" + stringify(*m[k::package_id()]) + "'");
+ if (! is_suitable_destination_for(*m.package_id()))
+ throw InstallActionError("Not a suitable destination for '" + stringify(*m.package_id()) + "'");
FSEntry install_under("/");
{
- Repository::MetadataConstIterator k(m[k::package_id()]->repository()->find_metadata("install_under"));
- if (k == m[k::package_id()]->repository()->end_metadata())
+ Repository::MetadataConstIterator k(m.package_id()->repository()->find_metadata("install_under"));
+ if (k == m.package_id()->repository()->end_metadata())
throw InstallActionError("Could not fetch install_under key from owning repository");
const MetadataValueKey<FSEntry> * kk(visitor_cast<const MetadataValueKey<FSEntry> >(**k));
if (! kk)
@@ -262,8 +263,8 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
int rewrite_ids_over_to_root(-1);
{
- Repository::MetadataConstIterator k(m[k::package_id()]->repository()->find_metadata("rewrite_ids_over_to_root"));
- if (k == m[k::package_id()]->repository()->end_metadata())
+ Repository::MetadataConstIterator k(m.package_id()->repository()->find_metadata("rewrite_ids_over_to_root"));
+ if (k == m.package_id()->repository()->end_metadata())
throw InstallActionError("Could not fetch rewrite_ids_over_to_root key from owning repository");
const MetadataValueKey<long> * kk(visitor_cast<const MetadataValueKey<long> >(**k));
if (! kk)
@@ -273,12 +274,12 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
std::tr1::shared_ptr<const PackageID> if_overwritten_id, if_same_name_id;
{
- std::tr1::shared_ptr<const PackageIDSequence> ids(package_ids(m[k::package_id()]->name()));
+ std::tr1::shared_ptr<const PackageIDSequence> ids(package_ids(m.package_id()->name()));
for (PackageIDSequence::ConstIterator v(ids->begin()), v_end(ids->end()) ;
v != v_end ; ++v)
{
if_same_name_id = *v;
- if ((*v)->version() == m[k::package_id()]->version() && (*v)->slot() == m[k::package_id()]->slot())
+ if ((*v)->version() == m.package_id()->version() && (*v)->slot() == m.package_id()->slot())
{
if_overwritten_id = *v;
break;
@@ -291,7 +292,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
uid_dir = if_same_name_id->fs_location_key()->value().dirname();
else
{
- std::string uid(stringify(m[k::package_id()]->name().category) + "---" + stringify(m[k::package_id()]->name().package));
+ std::string uid(stringify(m.package_id()->name().category) + "---" + stringify(m.package_id()->name().package));
uid_dir /= "data";
uid_dir.mkdir();
uid_dir /= uid;
@@ -299,7 +300,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
}
FSEntry target_ver_dir(uid_dir);
- target_ver_dir /= (stringify(m[k::package_id()]->version()) + ":" + stringify(m[k::package_id()]->slot()) + ":" + cookie());
+ target_ver_dir /= (stringify(m.package_id()->version()) + ":" + stringify(m.package_id()->slot()) + ":" + cookie());
if (target_ver_dir.exists())
throw InstallActionError("Temporary merge directory '" + stringify(target_ver_dir) + "' already exists, probably "
@@ -308,50 +309,51 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
{
std::ofstream source_repository_file(stringify(target_ver_dir / "source_repository").c_str());
- source_repository_file << m[k::package_id()]->repository()->name() << std::endl;
+ source_repository_file << m.package_id()->repository()->name() << std::endl;
if (! source_repository_file)
throw InstallActionError("Could not write to '" + stringify(target_ver_dir / "source_repository") + "'");
}
- if (m[k::package_id()]->short_description_key())
+ if (m.package_id()->short_description_key())
{
std::ofstream description_file(stringify(target_ver_dir / "description").c_str());
- description_file << m[k::package_id()]->short_description_key()->value() << std::endl;
+ description_file << m.package_id()->short_description_key()->value() << std::endl;
if (! description_file)
throw InstallActionError("Could not write to '" + stringify(target_ver_dir / "description") + "'");
}
- if (m[k::package_id()]->build_dependencies_key())
+ if (m.package_id()->build_dependencies_key())
{
std::ofstream build_dependencies_file(stringify(target_ver_dir / "build_dependencies").c_str());
StringifyFormatter f;
- build_dependencies_file << m[k::package_id()]->build_dependencies_key()->pretty_print_flat(f) << std::endl;
+ build_dependencies_file << m.package_id()->build_dependencies_key()->pretty_print_flat(f) << std::endl;
if (! build_dependencies_file)
throw InstallActionError("Could not write to '" + stringify(target_ver_dir / "build_dependencies") + "'");
}
- if (m[k::package_id()]->run_dependencies_key())
+ if (m.package_id()->run_dependencies_key())
{
std::ofstream run_dependencies_file(stringify(target_ver_dir / "run_dependencies").c_str());
StringifyFormatter f;
- run_dependencies_file << m[k::package_id()]->run_dependencies_key()->pretty_print_flat(f) << std::endl;
+ run_dependencies_file << m.package_id()->run_dependencies_key()->pretty_print_flat(f) << std::endl;
if (! run_dependencies_file)
throw InstallActionError("Could not write to '" + stringify(target_ver_dir / "run_dependencies") + "'");
}
NDBAMMerger merger(
- NDBAMMergerParams::named_create()
- (k::environment(), _imp->params.environment)
- (k::image(), m[k::image_dir()])
- (k::install_under(), install_under)
- (k::root(), installed_root_key()->value())
- (k::contents_file(), target_ver_dir / "contents")
- (k::config_protect(), getenv_with_default("CONFIG_PROTECT", ""))
- (k::config_protect_mask(), getenv_with_default("CONFIG_PROTECT_MASK", ""))
- (k::package_id(), m[k::package_id()])
- (k::get_new_ids_or_minus_one(), std::tr1::bind(&get_new_ids_or_minus_one, _imp->params.environment,
- rewrite_ids_over_to_root, _1))
- (k::options(), MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs));
+ make_named_values<NDBAMMergerParams>(
+ value_for<n::config_protect>(getenv_with_default("CONFIG_PROTECT", "")),
+ value_for<n::config_protect_mask>(getenv_with_default("CONFIG_PROTECT_MASK", "")),
+ value_for<n::contents_file>(target_ver_dir / "contents"),
+ value_for<n::environment>(_imp->params.environment),
+ value_for<n::get_new_ids_or_minus_one>(std::tr1::bind(&get_new_ids_or_minus_one,
+ _imp->params.environment, rewrite_ids_over_to_root, _1)),
+ value_for<n::image>(m.image_dir()),
+ value_for<n::install_under>(install_under),
+ value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
+ value_for<n::package_id>(m.package_id()),
+ value_for<n::root>(installed_root_key()->value())
+ ));
if (! merger.check())
{
@@ -363,7 +365,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
merger.merge();
- _imp->ndbam.index(m[k::package_id()]->name(), uid_dir.basename());
+ _imp->ndbam.index(m.package_id()->name(), uid_dir.basename());
if (if_overwritten_id)
{
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index bd01732..d29355c 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -33,7 +33,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/options.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <algorithm>
@@ -363,18 +363,18 @@ namespace test_cases
std::tr1::shared_ptr<Repository> source_repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg4a"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("installed_repository_TEST_dir/src4a"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("installed_repository_TEST_dir/src4a")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg4a")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, source_repo);
{
@@ -385,10 +385,11 @@ namespace test_cases
TEST_CHECK(! FSEntry("installed_repository_TEST_dir/root4/dir").exists());
- InstallAction action(InstallActionOptions::named_create()
- (k::destination(), repo)
- (k::checks(), iaco_default)
- (k::debug_build(), iado_none));
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(repo)
+ ));
(*env[selection::RequireExactlyOne(generator::InRepository(RepositoryName("unpackaged")))]->begin())->perform_action(action);
TEST_CHECK(FSEntry("installed_repository_TEST_dir/root4/dir").is_directory());
@@ -418,18 +419,18 @@ namespace test_cases
std::tr1::shared_ptr<Repository> source_repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg4b"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("installed_repository_TEST_dir/src4b1"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("installed_repository_TEST_dir/src4b1")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg4b")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, source_repo);
{
@@ -439,10 +440,11 @@ namespace test_cases
"cat/pkg4a-1.0:foo::installed-unpackaged");
}
- InstallAction action(InstallActionOptions::named_create()
- (k::destination(), repo)
- (k::checks(), iaco_default)
- (k::debug_build(), iado_none));
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(repo)
+ ));
(*env[selection::RequireExactlyOne(generator::InRepository(RepositoryName("unpackaged")))]->begin())->perform_action(action);
TEST_CHECK(FSEntry("installed_repository_TEST_dir/root4/dir").is_directory());
@@ -475,18 +477,18 @@ namespace test_cases
std::tr1::shared_ptr<Repository> source_repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg4b"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("installed_repository_TEST_dir/src4b2"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::run_dependencies(), "")
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("installed_repository_TEST_dir/src4b2")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg4b")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, source_repo);
{
@@ -496,10 +498,11 @@ namespace test_cases
"cat/pkg4a-1.0:foo::installed-unpackaged cat/pkg4b-1.0:foo::installed-unpackaged");
}
- InstallAction action(InstallActionOptions::named_create()
- (k::destination(), repo)
- (k::checks(), iaco_default)
- (k::debug_build(), iado_none));
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(repo)
+ ));
(*env[selection::RequireExactlyOne(generator::InRepository(RepositoryName("unpackaged")))]->begin())->perform_action(action);
TEST_CHECK(FSEntry("installed_repository_TEST_dir/root4/dir").is_directory());
diff --git a/paludis/repositories/unpackaged/registration.cc b/paludis/repositories/unpackaged/registration.cc
index 115d391..74fb46b 100644
--- a/paludis/repositories/unpackaged/registration.cc
+++ b/paludis/repositories/unpackaged/registration.cc
@@ -22,6 +22,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/destringify.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/repositories/unpackaged/installed_repository.hh>
#include <paludis/repositories/unpackaged/unpackaged_repository.hh>
#include <paludis/repositories/unpackaged/exceptions.hh>
@@ -69,17 +70,18 @@ namespace
}
return make_shared_ptr(new UnpackagedRepository(RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), env)
- (k::location(), location)
- (k::install_under(), install_under)
- (k::name(), QualifiedPackageName(name))
- (k::version(), VersionSpec(version))
- (k::slot(), SlotName(slot))
- (k::build_dependencies(), build_dependencies)
- (k::run_dependencies(), run_dependencies)
- (k::rewrite_ids_over_to_root(), rewrite_ids_over_to_root)
- (k::description(), description)));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(build_dependencies),
+ value_for<n::description>(description),
+ value_for<n::environment>(env),
+ value_for<n::install_under>(install_under),
+ value_for<n::location>(location),
+ value_for<n::name>(QualifiedPackageName(name)),
+ value_for<n::rewrite_ids_over_to_root>(rewrite_ids_over_to_root),
+ value_for<n::run_dependencies>(run_dependencies),
+ value_for<n::slot>(SlotName(slot)),
+ value_for<n::version>(VersionSpec(version))
+ )));
}
std::tr1::shared_ptr<Repository>
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index fc132c8..d51bde3 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -28,9 +28,9 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/log.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
#include <paludis/package_database.hh>
@@ -290,14 +290,14 @@ UnpackagedID::perform_action(Action & action) const
if (! install_action)
throw UnsupportedActionError(*this, action);
- if (! (*install_action->options[k::destination()])[k::destination_interface()])
+ if (! (*install_action->options.destination()).destination_interface())
throw InstallActionError("Can't install '" + stringify(*this)
- + "' to destination '" + stringify(install_action->options[k::destination()]->name())
+ + "' to destination '" + stringify(install_action->options.destination()->name())
+ "' because destination does not provide destination_interface");
std::string libdir("lib");
- FSEntry root(install_action->options[k::destination()]->installed_root_key() ?
- stringify(install_action->options[k::destination()]->installed_root_key()->value()) : "/");
+ FSEntry root(install_action->options.destination()->installed_root_key() ?
+ stringify(install_action->options.destination()->installed_root_key()->value()) : "/");
if ((root / "usr" / "lib").is_symbolic_link())
{
libdir = (root / "usr" / "lib").readlink();
@@ -307,22 +307,22 @@ UnpackagedID::perform_action(Action & action) const
Log::get_instance()->message("unpackaged.libdir", ll_debug, lc_context) << "Using '" << libdir << "' for libdir";
- UnpackagedStripper stripper(UnpackagedStripperOptions::named_create()
- (k::image_dir(), fs_location_key()->value())
- (k::debug_dir(), fs_location_key()->value() / "usr" / libdir / "debug")
- (k::debug_build(), install_action->options[k::debug_build()])
- (k::package_id(), shared_from_this())
- );
+ UnpackagedStripper stripper(make_named_values<UnpackagedStripperOptions>(
+ value_for<n::debug_build>(install_action->options.debug_build()),
+ value_for<n::debug_dir>(fs_location_key()->value() / "usr" / libdir / "debug"),
+ value_for<n::image_dir>(fs_location_key()->value()),
+ value_for<n::package_id>(shared_from_this())
+ ));
stripper.strip();
- (*install_action->options[k::destination()])[k::destination_interface()]->merge(
- MergeParams::named_create()
- (k::package_id(), shared_from_this())
- (k::image_dir(), fs_location_key()->value())
- (k::environment_file(), FSEntry("/dev/null"))
- (k::options(), MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs)
- );
+ (*install_action->options.destination()).destination_interface()->merge(
+ make_named_values<MergeParams>(
+ value_for<n::environment_file>(FSEntry("/dev/null")),
+ value_for<n::image_dir>(fs_location_key()->value()),
+ value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
+ value_for<n::package_id>(shared_from_this())
+ ));
}
void
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index 410aeb9..73fa542 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
@@ -56,29 +57,29 @@ namespace paludis
Implementation(const RepositoryName & n,
const UnpackagedRepositoryParams & p) :
params(p),
- id(new UnpackagedID(params[k::environment()], params[k::name()], params[k::version()], params[k::slot()], n, params[k::location()],
- params[k::build_dependencies()], params[k::run_dependencies()], params[k::description()])),
+ id(new UnpackagedID(params.environment(), params.name(), params.version(), params.slot(), n, params.location(),
+ params.build_dependencies(), params.run_dependencies(), params.description())),
ids(new PackageIDSequence),
package_names(new QualifiedPackageNameSet),
category_names(new CategoryNamePartSet),
location_key(new LiteralMetadataValueKey<FSEntry> ("location", "location",
- mkt_significant, params[k::location()])),
+ mkt_significant, params.location())),
install_under_key(new LiteralMetadataValueKey<FSEntry> ("install_under", "install_under",
- mkt_significant, params[k::install_under()])),
+ mkt_significant, params.install_under())),
rewrite_ids_over_to_root_key(new LiteralMetadataValueKey<long> ("rewrite_ids_over_to_root", "rewrite_ids_over_to_root",
- mkt_normal, params[k::rewrite_ids_over_to_root()])),
+ mkt_normal, params.rewrite_ids_over_to_root())),
name_key(new LiteralMetadataValueKey<std::string> ("name", "name",
- mkt_normal, stringify(params[k::name()]))),
+ mkt_normal, stringify(params.name()))),
slot_key(new LiteralMetadataValueKey<std::string> ("slot", "slot",
- mkt_normal, stringify(params[k::slot()]))),
+ mkt_normal, stringify(params.slot()))),
format_key(new LiteralMetadataValueKey<std::string> (
"format", "format", mkt_significant, "unpackaged")),
build_dependencies_key(new LiteralMetadataValueKey<std::string> (
- "build_dependencies", "build_dependencies", mkt_normal, params[k::build_dependencies()])),
+ "build_dependencies", "build_dependencies", mkt_normal, params.build_dependencies())),
run_dependencies_key(new LiteralMetadataValueKey<std::string> (
- "run_dependencies", "run_dependencies", mkt_normal, params[k::run_dependencies()])),
+ "run_dependencies", "run_dependencies", mkt_normal, params.run_dependencies())),
description_key(new LiteralMetadataValueKey<std::string> (
- "description", "description", mkt_normal, params[k::description()]))
+ "description", "description", mkt_normal, params.description()))
{
ids->push_back(id);
package_names->insert(id->name());
@@ -90,20 +91,21 @@ namespace paludis
UnpackagedRepository::UnpackagedRepository(const RepositoryName & n,
const UnpackagedRepositoryParams & params) :
PrivateImplementationPattern<UnpackagedRepository>(new Implementation<UnpackagedRepository>(n, params)),
- Repository(n, RepositoryCapabilities::named_create()
- (k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ Repository(n, make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
_imp(PrivateImplementationPattern<UnpackagedRepository>::_imp)
{
_add_metadata_keys();
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.hh b/paludis/repositories/unpackaged/unpackaged_repository.hh
index 2f72592..7020f31 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.hh
+++ b/paludis/repositories/unpackaged/unpackaged_repository.hh
@@ -23,25 +23,38 @@
#include <paludis/repository.hh>
#include <paludis/util/map.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
namespace paludis
{
+ namespace n
+ {
+ struct build_dependencies;
+ struct description;
+ struct environment;
+ struct install_under;
+ struct location;
+ struct name;
+ struct rewrite_ids_over_to_root;
+ struct run_dependencies;
+ struct slot;
+ struct version;
+ }
+
namespace unpackaged_repositories
{
- typedef kc::KeyedClass<
- kc::Field<k::environment, Environment *>,
- kc::Field<k::location, FSEntry>,
- kc::Field<k::install_under, FSEntry>,
- kc::Field<k::name, QualifiedPackageName>,
- kc::Field<k::version, VersionSpec>,
- kc::Field<k::slot, SlotName>,
- kc::Field<k::build_dependencies, std::string>,
- kc::Field<k::run_dependencies, std::string>,
- kc::Field<k::description, std::string>,
- kc::Field<k::rewrite_ids_over_to_root, int>
- > UnpackagedRepositoryParams;
+ struct UnpackagedRepositoryParams
+ {
+ NamedValue<n::build_dependencies, std::string> build_dependencies;
+ NamedValue<n::description, std::string> description;
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::install_under, FSEntry> install_under;
+ NamedValue<n::location, FSEntry> location;
+ NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::rewrite_ids_over_to_root, int> rewrite_ids_over_to_root;
+ NamedValue<n::run_dependencies, std::string> run_dependencies;
+ NamedValue<n::slot, SlotName> slot;
+ NamedValue<n::version, VersionSpec> version;
+ };
}
class PALUDIS_VISIBLE UnpackagedRepository :
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 90bf59e..5cbddbd 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -33,7 +33,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -51,18 +51,18 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<Repository> repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("unpackaged_repository_TEST_dir/pkg"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::description(), "")
- (k::rewrite_ids_over_to_root(), -1)
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("unpackaged_repository_TEST_dir/pkg")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, repo);
const std::tr1::shared_ptr<const PackageIDSequence> ids(
@@ -81,18 +81,18 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<Repository> repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("unpackaged_repository_TEST_dir/pkg"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("unpackaged_repository_TEST_dir/pkg")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, repo);
const std::tr1::shared_ptr<const PackageID> id(
@@ -116,18 +116,18 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<Repository> repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("unpackaged_repository_TEST_dir/pkg"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("unpackaged_repository_TEST_dir/pkg")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, repo);
const std::tr1::shared_ptr<const PackageID> id(
@@ -146,18 +146,18 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<Repository> repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("unpackaged_repository_TEST_dir/pkg"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("unpackaged_repository_TEST_dir/pkg")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, repo);
TEST_CHECK(repo->some_ids_might_support_action(SupportsActionTest<InstallAction>()));
@@ -189,18 +189,18 @@ namespace test_cases
std::tr1::shared_ptr<Repository> repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("unpackaged_repository_TEST_dir/pkg"))
- (k::install_under(), FSEntry("/"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/")),
+ value_for<n::location>(FSEntry("unpackaged_repository_TEST_dir/pkg")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, repo);
std::tr1::shared_ptr<Repository> installed_repo(new InstalledUnpackagedRepository(
@@ -217,11 +217,11 @@ namespace test_cases
const std::tr1::shared_ptr<const PackageID> id(
*env[selection::RequireExactlyOne(generator::All())]->begin());
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
id->perform_action(action);
TEST_CHECK(FSEntry("unpackaged_repository_TEST_dir/root/first").is_regular_file());
@@ -243,18 +243,18 @@ namespace test_cases
std::tr1::shared_ptr<Repository> repo(new UnpackagedRepository(
RepositoryName("unpackaged"),
- unpackaged_repositories::UnpackagedRepositoryParams::named_create()
- (k::environment(), &env)
- (k::name(), QualifiedPackageName("cat/pkg"))
- (k::version(), VersionSpec("1.0"))
- (k::slot(), SlotName("foo"))
- (k::location(), FSEntry("unpackaged_repository_TEST_dir/under_pkg"))
- (k::install_under(), FSEntry("/magic/pixie"))
- (k::build_dependencies(), "")
- (k::run_dependencies(), "")
- (k::rewrite_ids_over_to_root(), -1)
- (k::description(), "")
- ));
+ make_named_values<unpackaged_repositories::UnpackagedRepositoryParams>(
+ value_for<n::build_dependencies>(""),
+ value_for<n::description>(""),
+ value_for<n::environment>(&env),
+ value_for<n::install_under>(FSEntry("/magic/pixie")),
+ value_for<n::location>(FSEntry("unpackaged_repository_TEST_dir/under_pkg")),
+ value_for<n::name>(QualifiedPackageName("cat/pkg")),
+ value_for<n::rewrite_ids_over_to_root>(-1),
+ value_for<n::run_dependencies>(""),
+ value_for<n::slot>(SlotName("foo")),
+ value_for<n::version>(VersionSpec("1.0"))
+ )));
env.package_database()->add_repository(1, repo);
std::tr1::shared_ptr<Repository> installed_repo(new InstalledUnpackagedRepository(
@@ -271,11 +271,11 @@ namespace test_cases
const std::tr1::shared_ptr<const PackageID> id(
*env[selection::RequireExactlyOne(generator::All())]->begin());
- InstallAction action(InstallActionOptions::named_create()
- (k::debug_build(), iado_none)
- (k::checks(), iaco_default)
- (k::destination(), installed_repo)
- );
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(iaco_default),
+ value_for<n::debug_build>(iado_none),
+ value_for<n::destination>(installed_repo)
+ ));
id->perform_action(action);
TEST_CHECK(FSEntry("unpackaged_repository_TEST_dir/under_root/magic/pixie/first").is_regular_file());
diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.cc b/paludis/repositories/unpackaged/unpackaged_stripper.cc
index 670c237..ec1313d 100644
--- a/paludis/repositories/unpackaged/unpackaged_stripper.cc
+++ b/paludis/repositories/unpackaged/unpackaged_stripper.cc
@@ -18,9 +18,9 @@
*/
#include <paludis/repositories/unpackaged/unpackaged_stripper.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/make_named_values.hh>
#include <iostream>
using namespace paludis;
@@ -41,11 +41,11 @@ namespace paludis
}
UnpackagedStripper::UnpackagedStripper(const UnpackagedStripperOptions & options) :
- Stripper(StripperOptions::named_create()
- (k::image_dir(), options[k::image_dir()])
- (k::debug_build(), options[k::debug_build()])
- (k::debug_dir(), options[k::debug_dir()])
- ),
+ Stripper(make_named_values<StripperOptions>(
+ value_for<n::debug_build>(options.debug_build()),
+ value_for<n::debug_dir>(options.debug_dir()),
+ value_for<n::image_dir>(options.image_dir())
+ )),
PrivateImplementationPattern<UnpackagedStripper>(new Implementation<UnpackagedStripper>(options)),
_imp(PrivateImplementationPattern<UnpackagedStripper>::_imp)
{
@@ -58,20 +58,20 @@ UnpackagedStripper::~UnpackagedStripper()
void
UnpackagedStripper::on_strip(const FSEntry & f)
{
- std::cout << "str " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+ std::cout << "str " << f.strip_leading(_imp->options.image_dir()) << std::endl;
}
void
UnpackagedStripper::on_split(const FSEntry & f, const FSEntry & g)
{
- std::cout << "spl " << f.strip_leading(_imp->options[k::image_dir()]) <<
- " -> " << g.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+ std::cout << "spl " << f.strip_leading(_imp->options.image_dir()) <<
+ " -> " << g.strip_leading(_imp->options.image_dir()) << std::endl;
}
void
UnpackagedStripper::on_unknown(const FSEntry & f)
{
- std::cout << "--- " << f.strip_leading(_imp->options[k::image_dir()]) << std::endl;
+ std::cout << "--- " << f.strip_leading(_imp->options.image_dir()) << std::endl;
}
void
@@ -87,7 +87,7 @@ UnpackagedStripper::on_leave_dir(const FSEntry &)
void
UnpackagedStripper::strip()
{
- std::cout << ">>> Stripping inside " << _imp->options[k::image_dir()] << std::endl;
+ std::cout << ">>> Stripping inside " << _imp->options.image_dir() << std::endl;
Stripper::strip();
}
diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.hh b/paludis/repositories/unpackaged/unpackaged_stripper.hh
index 13ad87d..d0c42de 100644
--- a/paludis/repositories/unpackaged/unpackaged_stripper.hh
+++ b/paludis/repositories/unpackaged/unpackaged_stripper.hh
@@ -21,17 +21,28 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_UNPACKAGED_STRIPPER_HH 1
#include <paludis/stripper.hh>
+#include <paludis/package_id-fwd.hh>
+#include <tr1/memory>
namespace paludis
{
+ namespace n
+ {
+ struct debug_build;
+ struct debug_dir;
+ struct image_dir;
+ struct package_id;
+ }
+
namespace unpackaged_repositories
{
- typedef kc::KeyedClass<
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >,
- kc::Field<k::image_dir, FSEntry>,
- kc::Field<k::debug_dir, FSEntry>,
- kc::Field<k::debug_build, InstallActionDebugOption>
- > UnpackagedStripperOptions;
+ struct UnpackagedStripperOptions
+ {
+ NamedValue<n::debug_build, InstallActionDebugOption> debug_build;
+ NamedValue<n::debug_dir, FSEntry> debug_dir;
+ NamedValue<n::image_dir, FSEntry> image_dir;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ };
class UnpackagedStripper :
public Stripper,
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index cc09b13..5b5147c 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -34,6 +34,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
@@ -107,20 +108,21 @@ namespace
InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * const env,
const FSEntry & r) :
- Repository(RepositoryName(make_name(r)), RepositoryCapabilities::named_create()
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), static_cast<RepositoryMakeVirtualsInterface *>(0))
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), this)
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ Repository(RepositoryName(make_name(r)), make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(this),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<InstalledVirtualsRepository>(
new Implementation<InstalledVirtualsRepository>(env, r)),
_imp(PrivateImplementationPattern<InstalledVirtualsRepository>::_imp)
@@ -147,21 +149,21 @@ InstalledVirtualsRepository::need_ids() const
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (! (**r)[k::provides_interface()])
+ if (! (**r).provides_interface())
continue;
std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> pp(
- (**r)[k::provides_interface()]->provided_packages());
+ (**r).provides_interface()->provided_packages());
for (RepositoryProvidesInterface::ProvidesSequence::ConstIterator p(
pp->begin()), p_end(pp->end()) ; p != p_end ; ++p)
{
- IDMap::iterator i(_imp->ids.find((*p)[k::virtual_name()]));
+ IDMap::iterator i(_imp->ids.find((*p).virtual_name()));
if (i == _imp->ids.end())
- i = _imp->ids.insert(std::make_pair((*p)[k::virtual_name()], make_shared_ptr(new PackageIDSequence))).first;
+ i = _imp->ids.insert(std::make_pair((*p).virtual_name(), make_shared_ptr(new PackageIDSequence))).first;
std::tr1::shared_ptr<const PackageID> id(new virtuals::VirtualsPackageID(
- _imp->env, shared_from_this(), (*p)[k::virtual_name()], (*p)[k::provided_by()], false));
+ _imp->env, shared_from_this(), (*p).virtual_name(), (*p).provided_by(), false));
i->second->push_back(id);
}
}
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index b0b0fb2..d5ece7a 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -40,6 +40,7 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_named_values.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
@@ -117,20 +118,21 @@ namespace
}
VirtualsRepository::VirtualsRepository(const Environment * const env) :
- Repository(RepositoryName("virtuals"), RepositoryCapabilities::named_create()
- (k::use_interface(), static_cast<RepositoryUseInterface *>(0))
- (k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
- (k::syncable_interface(), static_cast<RepositorySyncableInterface *>(0))
- (k::mirrors_interface(), static_cast<RepositoryMirrorsInterface *>(0))
- (k::environment_variable_interface(), static_cast<RepositoryEnvironmentVariableInterface *>(0))
- (k::provides_interface(), static_cast<RepositoryProvidesInterface *>(0))
- (k::virtuals_interface(), static_cast<RepositoryVirtualsInterface *>(0))
- (k::destination_interface(), static_cast<RepositoryDestinationInterface *>(0))
- (k::e_interface(), static_cast<RepositoryEInterface *>(0))
- (k::make_virtuals_interface(), this)
- (k::qa_interface(), static_cast<RepositoryQAInterface *>(0))
- (k::hook_interface(), static_cast<RepositoryHookInterface *>(0))
- (k::manifest_interface(), static_cast<RepositoryManifestInterface *>(0))),
+ Repository(RepositoryName("virtuals"), make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::hook_interface>(static_cast<RepositoryHookInterface *>(0)),
+ value_for<n::make_virtuals_interface>(this),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)),
+ value_for<n::sets_interface>(static_cast<RepositorySetsInterface *>(0)),
+ value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)),
+ value_for<n::use_interface>(static_cast<RepositoryUseInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
PrivateImplementationPattern<VirtualsRepository>(
new Implementation<VirtualsRepository>(env)),
_imp(PrivateImplementationPattern<VirtualsRepository>::_imp)
@@ -158,15 +160,15 @@ VirtualsRepository::need_names() const
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (! (**r)[k::provides_interface()])
+ if (! (**r).provides_interface())
continue;
std::tr1::shared_ptr<const RepositoryProvidesInterface::ProvidesSequence> provides(
- (**r)[k::provides_interface()]->provided_packages());
+ (**r).provides_interface()->provided_packages());
for (RepositoryProvidesInterface::ProvidesSequence::ConstIterator p(provides->begin()),
p_end(provides->end()) ; p != p_end ; ++p)
- _imp->names.push_back(std::make_pair((*p)[k::virtual_name()], std::tr1::shared_ptr<const PackageDepSpec>(
- new PackageDepSpec(make_package_dep_spec().package((*p)[k::provided_by()]->name())))));
+ _imp->names.push_back(std::make_pair((*p).virtual_name(), std::tr1::shared_ptr<const PackageDepSpec>(
+ new PackageDepSpec(make_package_dep_spec().package((*p).provided_by()->name())))));
}
std::sort(_imp->names.begin(), _imp->names.end(), NamesSortComparator());
@@ -177,11 +179,11 @@ VirtualsRepository::need_names() const
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (! (**r)[k::virtuals_interface()])
+ if (! (**r).virtuals_interface())
continue;
std::tr1::shared_ptr<const RepositoryVirtualsInterface::VirtualsSequence> virtuals(
- (**r)[k::virtuals_interface()]->virtual_packages());
+ (**r).virtuals_interface()->virtual_packages());
for (RepositoryVirtualsInterface::VirtualsSequence::ConstIterator v(virtuals->begin()),
v_end(virtuals->end()) ; v != v_end ; ++v)
{
@@ -189,11 +191,11 @@ VirtualsRepository::need_names() const
std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepSpec> > >::const_iterator,
std::vector<std::pair<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepSpec> > >::const_iterator> p(
std::equal_range(_imp->names.begin(), _imp->names.end(),
- std::make_pair((*v)[k::virtual_name()], std::tr1::shared_ptr<const PackageDepSpec>()),
+ std::make_pair((*v).virtual_name(), std::tr1::shared_ptr<const PackageDepSpec>()),
NamesNameComparator()));
if (p.first == p.second)
- new_names.push_back(std::make_pair((*v)[k::virtual_name()], (*v)[k::provided_by_spec()]));
+ new_names.push_back(std::make_pair((*v).virtual_name(), (*v).provided_by_spec()));
}
}
diff --git a/paludis/repositories/virtuals/virtuals_repository_TEST.cc b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
index 3750bd4..cc6da4e 100644
--- a/paludis/repositories/virtuals/virtuals_repository_TEST.cc
+++ b/paludis/repositories/virtuals/virtuals_repository_TEST.cc
@@ -53,7 +53,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
std::tr1::shared_ptr<FakeInstalledRepository> installed(new FakeInstalledRepository(&env, RepositoryName("installed")));
- TEST_CHECK((*repo)[k::virtuals_interface()]);
+ TEST_CHECK(repo->virtuals_interface());
env.package_database()->add_repository(2, virtuals);
env.package_database()->add_repository(3, repo);
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index 9008cf3..afe692a 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -21,13 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORY_FWD_HH 1
#include <paludis/util/set-fwd.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/fs_entry-fwd.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/merger-fwd.hh>
-#include <paludis/package_id-fwd.hh>
-#include <paludis/dep_spec-fwd.hh>
+#include <paludis/repository-fwd.hh>
#include <tr1/memory>
/** \file
@@ -70,84 +64,7 @@ namespace paludis
*/
typedef Set<std::tr1::shared_ptr<Repository> > DestinationsSet;
-
- /**
- * Optional interfaces that may be provided by a Repository.
- *
- * \see Repository
- * \ingroup g_repository
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::sets_interface, RepositorySetsInterface *>,
- kc::Field<k::syncable_interface, RepositorySyncableInterface *>,
- kc::Field<k::use_interface, RepositoryUseInterface *>,
- kc::Field<k::mirrors_interface, RepositoryMirrorsInterface *>,
- kc::Field<k::environment_variable_interface, RepositoryEnvironmentVariableInterface *>,
- kc::Field<k::provides_interface, RepositoryProvidesInterface *>,
- kc::Field<k::virtuals_interface, RepositoryVirtualsInterface *>,
- kc::Field<k::make_virtuals_interface, RepositoryMakeVirtualsInterface *>,
- kc::Field<k::destination_interface, RepositoryDestinationInterface *>,
- kc::Field<k::e_interface, RepositoryEInterface *>,
- kc::Field<k::hook_interface, RepositoryHookInterface *>,
- kc::Field<k::qa_interface, RepositoryQAInterface *>,
- kc::Field<k::manifest_interface, RepositoryManifestInterface *>
- > RepositoryCapabilities;
-
- /**
- * A profiles.desc line in a Repository implementing RepositoryEInterface.
- *
- * \see Repository
- * \see RepositoryEInterface
- * \ingroup g_repository
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::path, FSEntry>,
- kc::Field<k::arch, std::string>,
- kc::Field<k::status, std::string>,
- kc::Field<k::profile, std::tr1::shared_ptr<ERepositoryProfile> >
- >RepositoryEInterfaceProfilesDescLine;
-
- /**
- * A provides entry in a Repository implementing RepositoryProvidesInterface.
- *
- * \see Repository
- * \see RepositoryProvidesInterface
- * \ingroup g_repository
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::virtual_name, QualifiedPackageName>,
- kc::Field<k::provided_by, std::tr1::shared_ptr<const PackageID> >
- > RepositoryProvidesEntry;
-
- /**
- * A virtuals entry in a Repository implementing RepositoryVirtualsInterface.
- *
- * \see Repository
- * \see RepositoryVirtualsInterface
- * \ingroup g_repository
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::virtual_name, QualifiedPackageName>,
- kc::Field<k::provided_by_spec, std::tr1::shared_ptr<const PackageDepSpec> >
- > RepositoryVirtualsEntry;
-
- /**
- * Parameters for RepositoryDestinationInterface::merge.
- *
- * \see RepositoryDestinationInterface
- * \ingroup g_repository
- * \nosubgrouping
- */
- typedef kc::KeyedClass<
- kc::Field<k::package_id, std::tr1::shared_ptr<const PackageID> >,
- kc::Field<k::image_dir, FSEntry>,
- kc::Field<k::environment_file, FSEntry>,
- kc::Field<k::options, MergerOptions>
- > MergeParams;
+ struct MergeParams;
}
#endif
diff --git a/paludis/repository.hh b/paludis/repository.hh
index a16fa83..43a7e71 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -34,7 +34,7 @@
#include <paludis/util/virtual_constructor.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <paludis/util/options.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/version_spec.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/metadata_key_holder.hh>
@@ -53,6 +53,116 @@
namespace paludis
{
+ namespace n
+ {
+ struct arch;
+ struct destination_interface;
+ struct e_interface;
+ struct environment_file;
+ struct environment_variable_interface;
+ struct hook_interface;
+ struct image_dir;
+ struct make_virtuals_interface;
+ struct manifest_interface;
+ struct mirrors_interface;
+ struct options;
+ struct package_id;
+ struct path;
+ struct profile;
+ struct provided_by;
+ struct provided_by_spec;
+ struct provides_interface;
+ struct qa_interface;
+ struct sets_interface;
+ struct status;
+ struct syncable_interface;
+ struct use_interface;
+ struct virtual_name;
+ struct virtuals_interface;
+ }
+
+ /**
+ * Optional interfaces that may be provided by a Repository.
+ *
+ * \see Repository
+ * \ingroup g_repository
+ * \since 0.30
+ */
+ struct RepositoryCapabilities
+ {
+ NamedValue<n::destination_interface, RepositoryDestinationInterface *> destination_interface;
+ NamedValue<n::e_interface, RepositoryEInterface *> e_interface;
+ NamedValue<n::environment_variable_interface, RepositoryEnvironmentVariableInterface *> environment_variable_interface;
+ NamedValue<n::hook_interface, RepositoryHookInterface *> hook_interface;
+ NamedValue<n::make_virtuals_interface, RepositoryMakeVirtualsInterface *> make_virtuals_interface;
+ NamedValue<n::manifest_interface, RepositoryManifestInterface *> manifest_interface;
+ NamedValue<n::mirrors_interface, RepositoryMirrorsInterface *> mirrors_interface;
+ NamedValue<n::provides_interface, RepositoryProvidesInterface *> provides_interface;
+ NamedValue<n::qa_interface, RepositoryQAInterface *> qa_interface;
+ NamedValue<n::sets_interface, RepositorySetsInterface *> sets_interface;
+ NamedValue<n::syncable_interface, RepositorySyncableInterface *> syncable_interface;
+ NamedValue<n::use_interface, RepositoryUseInterface *> use_interface;
+ NamedValue<n::virtuals_interface, RepositoryVirtualsInterface *> virtuals_interface;
+ };
+
+ /**
+ * A profiles.desc line in a Repository implementing RepositoryEInterface.
+ *
+ * \see Repository
+ * \see RepositoryEInterface
+ * \ingroup g_repository
+ * \since 0.30
+ */
+ struct RepositoryEInterfaceProfilesDescLine
+ {
+ NamedValue<n::arch, std::string> arch;
+ NamedValue<n::path, FSEntry> path;
+ NamedValue<n::profile, std::tr1::shared_ptr<ERepositoryProfile> > profile;
+ NamedValue<n::status, std::string> status;
+ };
+
+ /**
+ * A provides entry in a Repository implementing RepositoryProvidesInterface.
+ *
+ * \see Repository
+ * \see RepositoryProvidesInterface
+ * \ingroup g_repository
+ * \since 0.30
+ */
+ struct RepositoryProvidesEntry
+ {
+ NamedValue<n::provided_by, std::tr1::shared_ptr<const PackageID> > provided_by;
+ NamedValue<n::virtual_name, QualifiedPackageName> virtual_name;
+ };
+
+ /**
+ * A virtuals entry in a Repository implementing RepositoryVirtualsInterface.
+ *
+ * \see Repository
+ * \see RepositoryVirtualsInterface
+ * \ingroup g_repository
+ * \since 0.30
+ */
+ struct RepositoryVirtualsEntry
+ {
+ NamedValue<n::provided_by_spec, std::tr1::shared_ptr<const PackageDepSpec> > provided_by_spec;
+ NamedValue<n::virtual_name, QualifiedPackageName> virtual_name;
+ };
+
+ /**
+ * Parameters for RepositoryDestinationInterface::merge.
+ *
+ * \see RepositoryDestinationInterface
+ * \ingroup g_repository
+ * \since 0.30
+ */
+ struct MergeParams
+ {
+ NamedValue<n::environment_file, FSEntry> environment_file;
+ NamedValue<n::image_dir, FSEntry> image_dir;
+ NamedValue<n::options, MergerOptions> options;
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ };
/**
* Thrown if a Set does not exist
diff --git a/paludis/stripper-fwd.hh b/paludis/stripper-fwd.hh
index 0dd0e3b..3cf5b20 100644
--- a/paludis/stripper-fwd.hh
+++ b/paludis/stripper-fwd.hh
@@ -20,19 +20,10 @@
#ifndef PALUDIS_GUARD_PALUDIS_STRIPPER_FWD_HH
#define PALUDIS_GUARD_PALUDIS_STRIPPER_FWD_HH 1
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
-#include <paludis/action-fwd.hh>
-
namespace paludis
{
class Stripper;
-
- typedef kc::KeyedClass<
- kc::Field<k::image_dir, FSEntry>,
- kc::Field<k::debug_dir, FSEntry>,
- kc::Field<k::debug_build, InstallActionDebugOption>
- > StripperOptions;
+ class StripperOptions;
}
#endif
diff --git a/paludis/stripper.cc b/paludis/stripper.cc
index 7adc97c..64b317f 100644
--- a/paludis/stripper.cc
+++ b/paludis/stripper.cc
@@ -19,7 +19,6 @@
#include <paludis/stripper.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/strip.hh>
@@ -64,12 +63,12 @@ Stripper::~Stripper()
void
Stripper::strip()
{
- Context context("When stripping image '" + stringify(_imp->options[k::image_dir()]) + "':");
+ Context context("When stripping image '" + stringify(_imp->options.image_dir()) + "':");
- if (_imp->options[k::debug_build()] == iado_internal)
+ if (_imp->options.debug_build() == iado_internal)
return;
- do_dir_recursive(_imp->options[k::image_dir()]);
+ do_dir_recursive(_imp->options.image_dir());
}
void
@@ -77,7 +76,7 @@ Stripper::do_dir_recursive(const FSEntry & f)
{
Context context("When stripping inside '" + stringify(f) + "':");
- if (f == _imp->options[k::debug_dir()])
+ if (f == _imp->options.debug_dir())
return;
on_enter_dir(f);
@@ -104,7 +103,7 @@ Stripper::do_dir_recursive(const FSEntry & f)
std::string t(file_type(*d));
if (std::string::npos != t.find("SB executable") || std::string::npos != t.find("SB shared object"))
{
- FSEntry target(_imp->options[k::debug_dir()] / d->strip_leading(_imp->options[k::image_dir()]));
+ FSEntry target(_imp->options.debug_dir() / d->strip_leading(_imp->options.image_dir()));
target = target.dirname() / (target.basename() + ".debug");
do_split(*d, target);
}
@@ -149,7 +148,7 @@ Stripper::do_split(const FSEntry & f, const FSEntry & g)
{
Context context("When splitting '" + stringify(f) + "' to '" + stringify(g) + "':");
- switch (_imp->options[k::debug_build()])
+ switch (_imp->options.debug_build())
{
case iado_internal:
case last_iado:
@@ -167,7 +166,7 @@ Stripper::do_split(const FSEntry & f, const FSEntry & g)
{
std::list<FSEntry> to_make;
- for (FSEntry d(g.dirname()) ; (! d.exists()) && (d != _imp->options[k::image_dir()]) ; d = d.dirname())
+ for (FSEntry d(g.dirname()) ; (! d.exists()) && (d != _imp->options.image_dir()) ; d = d.dirname())
to_make.push_front(d);
using namespace std::tr1::placeholders;
diff --git a/paludis/stripper.hh b/paludis/stripper.hh
index aef8a2d..4063175 100644
--- a/paludis/stripper.hh
+++ b/paludis/stripper.hh
@@ -21,11 +21,28 @@
#define PALUDIS_GUARD_PALUDIS_STRIPPER_HH 1
#include <paludis/stripper-fwd.hh>
+#include <paludis/action-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/named_value.hh>
namespace paludis
{
+ namespace n
+ {
+ struct debug_build;
+ struct debug_dir;
+ struct image_dir;
+ }
+
+ struct StripperOptions
+ {
+ NamedValue<n::debug_build, InstallActionDebugOption> debug_build;
+ NamedValue<n::debug_dir, FSEntry> debug_dir;
+ NamedValue<n::image_dir, FSEntry> image_dir;
+ };
+
class PALUDIS_VISIBLE Stripper :
private PrivateImplementationPattern<Stripper>
{
diff --git a/paludis/stripper_TEST.cc b/paludis/stripper_TEST.cc
index 81220a5..1b8b959 100644
--- a/paludis/stripper_TEST.cc
+++ b/paludis/stripper_TEST.cc
@@ -20,7 +20,7 @@
#include <paludis/stripper.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/fs_entry.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
@@ -68,11 +68,11 @@ namespace test_cases
void run()
{
- TestStripper s(StripperOptions::named_create()
- (k::image_dir(), FSEntry("stripper_TEST_dir/image").realpath())
- (k::debug_dir(), FSEntry("stripper_TEST_dir/image").realpath() / "usr" / "lib" / "debug")
- (k::debug_build(), iado_split)
- );
+ TestStripper s(make_named_values<StripperOptions>(
+ value_for<n::debug_build>(iado_split),
+ value_for<n::debug_dir>(FSEntry("stripper_TEST_dir/image").realpath() / "usr" / "lib" / "debug"),
+ value_for<n::image_dir>(FSEntry("stripper_TEST_dir/image").realpath())
+ ));
s.strip();
TEST_CHECK(FSEntry("stripper_TEST_dir/image/usr/lib/debug/usr/bin/stripper_TEST_binary.debug").is_regular_file());
diff --git a/paludis/sync_task.cc b/paludis/sync_task.cc
index 4a6847a..69faa86 100644
--- a/paludis/sync_task.cc
+++ b/paludis/sync_task.cc
@@ -112,7 +112,7 @@ namespace
}
std::tr1::shared_ptr<const Repository> rr(env->package_database()->fetch_repository(r));
- if ((*rr)[k::syncable_interface()] && (*rr)[k::syncable_interface()]->sync())
+ if ((*rr).syncable_interface() && (*rr).syncable_interface()->sync())
{
Lock l(mutex);
task->on_sync_succeed(r);
diff --git a/paludis/syncer.cc b/paludis/syncer.cc
index 2ba0f9b..085f043 100644
--- a/paludis/syncer.cc
+++ b/paludis/syncer.cc
@@ -28,7 +28,6 @@
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/kc.hh>
#include <list>
using namespace paludis;
@@ -49,9 +48,9 @@ SyncFailedError::SyncFailedError(const std::string & msg) throw () :
}
DefaultSyncer::DefaultSyncer(const SyncerParams & params) :
- _local(params[k::local()]),
- _remote(params[k::remote()]),
- _environment(params[k::environment()])
+ _local(params.local()),
+ _remote(params.remote()),
+ _environment(params.environment())
{
std::string::size_type p(_remote.find("://")), q(_remote.find(":"));
if (std::string::npos == p)
@@ -91,18 +90,18 @@ DefaultSyncer::sync(const SyncOptions & opts) const
std::tr1::shared_ptr<const FSEntrySequence> fetchers_dirs(_environment->fetchers_dirs());
std::tr1::shared_ptr<const FSEntrySequence> syncers_dirs(_environment->syncers_dirs());
- Command cmd(Command(stringify(_syncer) + " " + opts[k::options()] + " '" + _local + "' '" + _remote + "'")
+ Command cmd(Command(stringify(_syncer) + " " + opts.options() + " '" + _local + "' '" + _remote + "'")
.with_setenv("PALUDIS_ACTION", "sync")
.with_setenv("PALUDIS_BASHRC_FILES", join(bashrc_files->begin(), bashrc_files->end(), " "))
.with_setenv("PALUDIS_FETCHERS_DIRS", join(fetchers_dirs->begin(), fetchers_dirs->end(), " "))
.with_setenv("PALUDIS_SYNCERS_DIRS", join(syncers_dirs->begin(), syncers_dirs->end(), " "))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
- .with_setenv("PALUDIS_SYNC_FILTER_FILE", stringify(opts[k::filter_file()])));
+ .with_setenv("PALUDIS_SYNC_FILTER_FILE", stringify(opts.filter_file())));
- if (! opts[k::output_prefix()].empty())
+ if (! opts.output_prefix().empty())
cmd
- .with_stdout_prefix(opts[k::output_prefix()])
- .with_stderr_prefix(opts[k::output_prefix()])
+ .with_stdout_prefix(opts.output_prefix())
+ .with_stderr_prefix(opts.output_prefix())
.with_prefix_blank_lines();
if (run_command(cmd))
diff --git a/paludis/syncer.hh b/paludis/syncer.hh
index 69cd1d3..e9360e9 100644
--- a/paludis/syncer.hh
+++ b/paludis/syncer.hh
@@ -21,8 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_SYNCER_HH 1
#include <paludis/util/exception.hh>
-#include <paludis/util/kc-fwd.hh>
-#include <paludis/util/keys.hh>
#include <paludis/repository.hh>
#include <string>
@@ -39,6 +37,16 @@
namespace paludis
{
+ namespace n
+ {
+ struct environment;
+ struct filter_file;
+ struct local;
+ struct options;
+ struct output_prefix;
+ struct remote;
+ }
+
/**
* Options used by Syncer.
*
@@ -46,11 +54,12 @@ namespace paludis
* \ingroup g_repository
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::options, std::string>,
- kc::Field<k::filter_file, FSEntry>,
- kc::Field<k::output_prefix, std::string>
- > SyncOptions;
+ struct SyncOptions
+ {
+ NamedValue<n::filter_file, FSEntry> filter_file;
+ NamedValue<n::options, std::string> options;
+ NamedValue<n::output_prefix, std::string> output_prefix;
+ };
/**
* Parameters for a Syncer.
@@ -59,11 +68,12 @@ namespace paludis
* \ingroup g_repository
* \nosubgrouping
*/
- typedef kc::KeyedClass<
- kc::Field<k::local, std::string>,
- kc::Field<k::remote, std::string>,
- kc::Field<k::environment, const Environment *>
- > SyncerParams;
+ struct SyncerParams
+ {
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::local, std::string> local;
+ NamedValue<n::remote, std::string> remote;
+ };
/**
* A Syncer subclass handles syncing Repository instances.
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index 9a3b387..dddd72d 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -35,7 +35,6 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/options.hh>
-#include <paludis/util/kc.hh>
#include <paludis/package_database.hh>
#include <paludis/hook.hh>
#include <paludis/dep_tag.hh>
diff --git a/paludis/unmerger.cc b/paludis/unmerger.cc
index 561a0e8..9bbea99 100644
--- a/paludis/unmerger.cc
+++ b/paludis/unmerger.cc
@@ -77,10 +77,10 @@ Unmerger::unmerge()
{
populate_unmerge_set();
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_pre")
- ("UNLINK_TARGET", stringify(_imp->options[k::root()])))).max_exit_status)
- throw UnmergerError("Unmerge from '" + stringify(_imp->options[k::root()]) + "' aborted by hook");
+ ("UNLINK_TARGET", stringify(_imp->options.root())))).max_exit_status)
+ throw UnmergerError("Unmerge from '" + stringify(_imp->options.root()) + "' aborted by hook");
for (UnmergeEntriesIterator i(_imp->unmerge_entries.rbegin()), i_end(_imp->unmerge_entries.rend()) ; i != i_end ; ++i)
{
@@ -111,18 +111,18 @@ Unmerger::unmerge()
throw InternalError(PALUDIS_HERE, "Unexpected entry_type '" + stringify((*i).second.first) + "'");
}
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_post")
- ("UNLINK_TARGET", stringify(_imp->options[k::root()])))).max_exit_status)
- throw UnmergerError("Unmerge from '" + stringify(_imp->options[k::root()]) + "' aborted by hook");
+ ("UNLINK_TARGET", stringify(_imp->options.root())))).max_exit_status)
+ throw UnmergerError("Unmerge from '" + stringify(_imp->options.root()) + "' aborted by hook");
}
void
Unmerger::unmerge_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
{
- FSEntry f_real(_imp->options[k::root()] / f);
+ FSEntry f_real(_imp->options.root() / f);
- HookResult hr(_imp->options[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force")))));
@@ -146,9 +146,9 @@ Unmerger::unmerge_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
void
Unmerger::unmerge_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
{
- FSEntry f_real(_imp->options[k::root()] / f);
+ FSEntry f_real(_imp->options.root() / f);
- HookResult hr(_imp->options[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force")))));
@@ -172,9 +172,9 @@ Unmerger::unmerge_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
void
Unmerger::unmerge_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
{
- FSEntry f_real(_imp->options[k::root()] / f);
+ FSEntry f_real(_imp->options.root() / f);
- HookResult hr(_imp->options[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")))));
@@ -193,9 +193,9 @@ Unmerger::unmerge_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
void
Unmerger::unmerge_misc(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
{
- FSEntry f_real(_imp->options[k::root()] / f);
+ FSEntry f_real(_imp->options.root() / f);
- HookResult hr(_imp->options[k::environment()]->perform_hook(extend_hook(
+ HookResult hr(_imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force")))));
@@ -219,7 +219,7 @@ Unmerger::unmerge_misc(FSEntry & f, std::tr1::shared_ptr<ExtraInfo> ei) const
void
Unmerger::unlink_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_pre")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
@@ -236,7 +236,7 @@ Unmerger::unlink_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
f.unlink();
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_post")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
@@ -245,14 +245,14 @@ Unmerger::unlink_file(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
void
Unmerger::unlink_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_pre")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
f.unlink();
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_post")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
@@ -261,14 +261,14 @@ Unmerger::unlink_sym(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
void
Unmerger::unlink_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_pre")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
f.rmdir();
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_post")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
@@ -277,14 +277,14 @@ Unmerger::unlink_dir(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
void
Unmerger::unlink_misc(FSEntry & f, std::tr1::shared_ptr<ExtraInfo>) const
{
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_pre")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
f.unlink();
- if (0 != _imp->options[k::environment()]->perform_hook(extend_hook(
+ if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_post")
("UNLINK_TARGET", stringify(f)))).max_exit_status)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
@@ -294,6 +294,6 @@ Hook
Unmerger::extend_hook(const Hook & h) const
{
return h
- ("ROOT", stringify(_imp->options[k::root()]));
+ ("ROOT", stringify(_imp->options.root()));
}
diff --git a/paludis/unmerger.hh b/paludis/unmerger.hh
index 3869e8e..ce9ee4b 100644
--- a/paludis/unmerger.hh
+++ b/paludis/unmerger.hh
@@ -24,8 +24,7 @@
#include <paludis/util/exception.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/merger_entry_type.hh>
/** \file
@@ -44,17 +43,24 @@ namespace paludis
class Hook;
class Environment;
+ namespace n
+ {
+ struct environment;
+ struct root;
+ }
+
/**
* Options for a basic Unmerger.
*
* \see Unmerger
* \ingroup g_repository
- * \nosubgrouping
+ * \since 0.30
*/
- typedef kc::KeyedClass<
- kc::Field<k::environment, const Environment *>,
- kc::Field<k::root, FSEntry>
- > UnmergerOptions;
+ struct UnmergerOptions
+ {
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::root, FSEntry> root;
+ };
/**
* Thrown if an error occurs during an unmerge.
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index ddde181..130424a 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -30,6 +30,7 @@
#include <paludis/util/options.hh>
#include <paludis/util/log.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/make_named_values.hh>
using namespace paludis;
@@ -233,19 +234,19 @@ paludis::parse_user_package_dep_spec(const std::string & ss, const Environment *
Context context("When parsing user package dep spec '" + ss + "':");
bool had_bracket_version_requirements(false);
- return partial_parse_generic_elike_package_dep_spec(ss, GenericELikePackageDepSpecParseFunctions::named_create()
- (k::check_sanity(), std::tr1::bind(&user_check_sanity, _1, options, env))
- (k::remove_trailing_square_bracket_if_exists(), std::tr1::bind(&user_remove_trailing_square_bracket_if_exists,
+ return partial_parse_generic_elike_package_dep_spec(ss, make_named_values<GenericELikePackageDepSpecParseFunctions>(
+ value_for<n::add_package_requirement>(std::tr1::bind(&user_add_package_requirement, _1, _2, env, options, filter)),
+ value_for<n::add_version_requirement>(std::tr1::bind(&elike_add_version_requirement, _1, _2, _3)),
+ value_for<n::check_sanity>(std::tr1::bind(&user_check_sanity, _1, options, env)),
+ value_for<n::get_remove_trailing_version>(std::tr1::bind(&elike_get_remove_trailing_version, _1)),
+ value_for<n::get_remove_version_operator>(std::tr1::bind(&elike_get_remove_version_operator, _1,
+ ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps)),
+ value_for<n::has_version_operator>(std::tr1::bind(&elike_has_version_operator, _1, std::tr1::cref(had_bracket_version_requirements))),
+ value_for<n::remove_trailing_repo_if_exists>(std::tr1::bind(&user_remove_trailing_repo_if_exists, _1, _2)),
+ value_for<n::remove_trailing_slot_if_exists>(std::tr1::bind(&user_remove_trailing_slot_if_exists, _1, _2)),
+ value_for<n::remove_trailing_square_bracket_if_exists>(std::tr1::bind(&user_remove_trailing_square_bracket_if_exists,
_1, _2, std::tr1::ref(had_bracket_version_requirements)))
- (k::remove_trailing_repo_if_exists(), std::tr1::bind(&user_remove_trailing_repo_if_exists, _1, _2))
- (k::remove_trailing_slot_if_exists(), std::tr1::bind(&user_remove_trailing_slot_if_exists, _1, _2))
- (k::has_version_operator(), std::tr1::bind(&elike_has_version_operator, _1, std::tr1::cref(had_bracket_version_requirements)))
- (k::get_remove_version_operator(), std::tr1::bind(&elike_get_remove_version_operator, _1,
- ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps))
- (k::get_remove_trailing_version(), std::tr1::bind(&elike_get_remove_trailing_version, _1))
- (k::add_version_requirement(), std::tr1::bind(&elike_add_version_requirement, _1, _2, _3))
- (k::add_package_requirement(), std::tr1::bind(&user_add_package_requirement, _1, _2, env, options, filter))
- );
+ ));
}
UserSlotExactRequirement::UserSlotExactRequirement(const SlotName & s) :
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 0634217..6a731b9 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -33,8 +33,6 @@ add(`indirect_iterator', `hh', `fwd', `impl', `test')
add(`instantiation_policy', `hh', `impl', `test')
add(`is_file_with_extension', `hh', `cc', `se', `test', `testscript')
add(`join', `hh', `test')
-add(`kc', `hh', `fwd')
-add(`keys', `hh')
add(`log', `hh', `cc', `se', `test')
add(`make_named_values', `hh', `cc')
add(`make_shared_ptr', `hh', `fwd')
diff --git a/paludis/util/kc-fwd.hh b/paludis/util/kc-fwd.hh
deleted file mode 100644
index f361ab8..0000000
--- a/paludis/util/kc-fwd.hh
+++ /dev/null
@@ -1,80 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2008 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_UTIL_KC_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_UTIL_KC_FWD_HH 1
-
-namespace paludis
-{
- namespace kc
- {
- template <typename Key_, typename Type_>
- struct Field;
-
- template <unsigned id_>
- struct NoField;
-
- template <unsigned id_>
- struct Key;
-
- template <bool b_, typename T_>
- struct NamedField;
-
- template <typename T_>
- struct NamedField<false, T_>;
-
- template <unsigned id_, typename T_>
- struct NamedField<true, Field<Key<id_>, T_> >;
-
- template <typename T_>
- struct Part;
-
- template <unsigned id_>
- struct Part<NoField<id_> >;
-
- template <unsigned id_, typename Type_>
- struct Part<Field<Key<id_>, Type_> >;
-
- template <
- typename T1_ = NoField<1>,
- typename T2_ = NoField<2>,
- typename T3_ = NoField<3>,
- typename T4_ = NoField<4>,
- typename T5_ = NoField<5>,
- typename T6_ = NoField<6>,
- typename T7_ = NoField<7>,
- typename T8_ = NoField<8>,
- typename T9_ = NoField<9>,
- typename T10_ = NoField<10>,
- typename T11_ = NoField<11>,
- typename T12_ = NoField<12>,
- typename T13_ = NoField<13>,
- typename T14_ = NoField<14>,
- typename T15_ = NoField<15>,
- typename T16_ = NoField<16>,
- typename T17_ = NoField<17>,
- typename T18_ = NoField<18>,
- typename T19_ = NoField<19>,
- typename T20_ = NoField<20>
- > class KeyedClass;
-
- }
-}
-
-#endif
diff --git a/paludis/util/kc.hh b/paludis/util/kc.hh
deleted file mode 100644
index f56f47d..0000000
--- a/paludis/util/kc.hh
+++ /dev/null
@@ -1,646 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2008 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_UTIL_KC_HH
-#define PALUDIS_GUARD_PALUDIS_UTIL_KC_HH 1
-
-#include <paludis/util/kc-fwd.hh>
-#include <tr1/type_traits>
-
-namespace paludis
-{
- namespace kc
- {
- template <bool b_, typename T_>
- struct SV
- {
- template <typename V_>
- static const T_ & sv(const T_ & t, const V_ &)
- {
- return t;
- }
- };
-
- template <typename T_>
- struct SV<false, T_>
- {
- template <typename D_, typename V_>
- static V_ sv(const D_ &, V_ v)
- {
- return v;
- }
- };
-
- template <typename Key_, typename Type_>
- struct Field
- {
- typedef Type_ ConstructorType;
- typedef void DefaultConstructorValueType;
-
- typedef Key_ NamedFirstParamType;
- typedef Type_ NamedSecondParamType;
- };
-
- template <unsigned id_>
- struct NoField
- {
- typedef NoField<id_> ConstructorType;
- typedef NoField<id_> DefaultConstructorValueType;
-
- typedef NoField<id_> NamedFirstParamType;
- typedef NoField<id_> NamedSecondParamType;
- };
-
- template <unsigned id_>
- struct Key
- {
- };
-
- template <bool b_, typename T_>
- struct NamedField;
-
- template <typename T_>
- struct NamedField<false, T_>
- {
- };
-
- template <unsigned id_, typename T_>
- struct NamedField<true, Field<Key<id_>, T_> >
- {
- T_ value;
-
- NamedField(const T_ & v) :
- value(v)
- {
- }
- };
-
- template <typename T_>
- struct Part;
-
- template <unsigned id_>
- struct Part<NoField<id_> >
- {
- public:
- void operator[] (const NoField<id_> &);
-
- Part(const NoField<id_> &)
- {
- }
-
- Part(const NamedField<false, NoField<id_> > &)
- {
- }
- };
-
- template <unsigned id_, typename Type_>
- class Part<Field<Key<id_>, Type_> >
- {
- private:
- Type_ _value;
-
- public:
- Type_ & operator[] (const Key<id_> &)
- {
- return _value;
- }
-
- const Type_ & operator[] (const Key<id_> &) const
- {
- return _value;
- }
-
- Part(const Type_ & v) :
- _value(v)
- {
- }
-
- Part(const NamedField<true, Field<Key<id_>, Type_> > & v) :
- _value(v.value)
- {
- }
- };
-
- template <bool b_>
- struct CheckTrue;
-
- template <>
- struct CheckTrue<true>
- {
- static const bool check_true = true;
- };
-
- /**
- * A KeyedClass is used to avoid huge amounts of boilerplate code for classes that merely
- * contain a few member variables. It provides type safe, compile-time checked constructors
- * using arbitrarily ordered named arguments that ensures that all members are initialised
- * exactly once.
- *
- * A typical KeyedClass is constructed like this:
- *
- * \code
- * MyKeyedClass foo(MyKeyedClass::named_create()
- * (k::first_param(), "first")
- * (k::second_param(), second())
- * (k::third_param(), 3)
- * );
- * \endcode
- *
- * Member access is:
- *
- * \code
- * std::cout << foo[k::first_param()];
- * foo[k::second_param()] = another_value();
- * \endcode
- *
- * A KeyedClass can be declared through a typedef, or through subclassing if additional
- * functionality is required:
- *
- * \code
- * typedef kc::KeyedClass<
- * kc::Field<k::first_param, std::string>,
- * kc::Field<k::second_param, std::string>,
- * kc::Field<k::third_param, int>
- * > MyKeyedClass;
- * \endcode
- *
- * All keys are in the paludis::k:: namespace.
- *
- * \since 0.26
- * \ingroup g_data_structures
- */
- template <
- typename T1_,
- typename T2_,
- typename T3_,
- typename T4_,
- typename T5_,
- typename T6_,
- typename T7_,
- typename T8_,
- typename T9_,
- typename T10_,
- typename T11_,
- typename T12_,
- typename T13_,
- typename T14_,
- typename T15_,
- typename T16_,
- typename T17_,
- typename T18_,
- typename T19_,
- typename T20_
- > class KeyedClass :
- public Part<T1_>,
- public Part<T2_>,
- public Part<T3_>,
- public Part<T4_>,
- public Part<T5_>,
- public Part<T6_>,
- public Part<T7_>,
- public Part<T8_>,
- public Part<T9_>,
- public Part<T10_>,
- public Part<T11_>,
- public Part<T12_>,
- public Part<T13_>,
- public Part<T14_>,
- public Part<T15_>,
- public Part<T16_>,
- public Part<T17_>,
- public Part<T18_>,
- public Part<T19_>,
- public Part<T20_>
- {
- public:
- /**
- * Convenience access to our own type.
- */
- typedef KeyedClass BaseType;
-
- ///\name Basic operations
- ///\{
-
- /**
- * Constructor, using ordered literal parameters.
- */
- KeyedClass
- (
- const typename T1_::ConstructorType & v1 = typename T1_::DefaultConstructorValueType(),
- const typename T2_::ConstructorType & v2 = typename T2_::DefaultConstructorValueType(),
- const typename T3_::ConstructorType & v3 = typename T3_::DefaultConstructorValueType(),
- const typename T4_::ConstructorType & v4 = typename T4_::DefaultConstructorValueType(),
- const typename T5_::ConstructorType & v5 = typename T5_::DefaultConstructorValueType(),
- const typename T6_::ConstructorType & v6 = typename T6_::DefaultConstructorValueType(),
- const typename T7_::ConstructorType & v7 = typename T7_::DefaultConstructorValueType(),
- const typename T8_::ConstructorType & v8 = typename T8_::DefaultConstructorValueType(),
- const typename T9_::ConstructorType & v9 = typename T9_::DefaultConstructorValueType(),
- const typename T10_::ConstructorType & v10 = typename T10_::DefaultConstructorValueType(),
- const typename T11_::ConstructorType & v11 = typename T11_::DefaultConstructorValueType(),
- const typename T12_::ConstructorType & v12 = typename T12_::DefaultConstructorValueType(),
- const typename T13_::ConstructorType & v13 = typename T13_::DefaultConstructorValueType(),
- const typename T14_::ConstructorType & v14 = typename T14_::DefaultConstructorValueType(),
- const typename T15_::ConstructorType & v15 = typename T15_::DefaultConstructorValueType(),
- const typename T16_::ConstructorType & v16 = typename T16_::DefaultConstructorValueType(),
- const typename T17_::ConstructorType & v17 = typename T17_::DefaultConstructorValueType(),
- const typename T18_::ConstructorType & v18 = typename T18_::DefaultConstructorValueType(),
- const typename T19_::ConstructorType & v19 = typename T19_::DefaultConstructorValueType(),
- const typename T20_::ConstructorType & v20 = typename T20_::DefaultConstructorValueType()
- ) :
- Part<T1_>(v1),
- Part<T2_>(v2),
- Part<T3_>(v3),
- Part<T4_>(v4),
- Part<T5_>(v5),
- Part<T6_>(v6),
- Part<T7_>(v7),
- Part<T8_>(v8),
- Part<T9_>(v9),
- Part<T10_>(v10),
- Part<T11_>(v11),
- Part<T12_>(v12),
- Part<T13_>(v13),
- Part<T14_>(v14),
- Part<T15_>(v15),
- Part<T16_>(v16),
- Part<T17_>(v17),
- Part<T18_>(v18),
- Part<T19_>(v19),
- Part<T20_>(v20)
- {
- }
-
- /**
- * Copy constructor.
- */
- KeyedClass(const KeyedClass & other) :
- Part<T1_>(other),
- Part<T2_>(other),
- Part<T3_>(other),
- Part<T4_>(other),
- Part<T5_>(other),
- Part<T6_>(other),
- Part<T7_>(other),
- Part<T8_>(other),
- Part<T9_>(other),
- Part<T10_>(other),
- Part<T11_>(other),
- Part<T12_>(other),
- Part<T13_>(other),
- Part<T14_>(other),
- Part<T15_>(other),
- Part<T16_>(other),
- Part<T17_>(other),
- Part<T18_>(other),
- Part<T19_>(other),
- Part<T20_>(other)
- {
- }
-
- using Part<T1_>::operator[];
- using Part<T2_>::operator[];
- using Part<T3_>::operator[];
- using Part<T4_>::operator[];
- using Part<T5_>::operator[];
- using Part<T6_>::operator[];
- using Part<T7_>::operator[];
- using Part<T8_>::operator[];
- using Part<T9_>::operator[];
- using Part<T10_>::operator[];
- using Part<T11_>::operator[];
- using Part<T12_>::operator[];
- using Part<T13_>::operator[];
- using Part<T14_>::operator[];
- using Part<T15_>::operator[];
- using Part<T16_>::operator[];
- using Part<T17_>::operator[];
- using Part<T18_>::operator[];
- using Part<T19_>::operator[];
- using Part<T20_>::operator[];
-
- /**
- * Named arguments class helper for KeyedClass.
- *
- * \ingroup g_data_structures
- * \since 0.26
- */
- template <
- bool b1_,
- bool b2_,
- bool b3_,
- bool b4_,
- bool b5_,
- bool b6_,
- bool b7_,
- bool b8_,
- bool b9_,
- bool b10_,
- bool b11_,
- bool b12_,
- bool b13_,
- bool b14_,
- bool b15_,
- bool b16_,
- bool b17_,
- bool b18_,
- bool b19_,
- bool b20_
- >
- struct Named
- {
- ///\name Members
- ///\{
-
- NamedField<b1_, T1_> v1;
- NamedField<b2_, T2_> v2;
- NamedField<b3_, T3_> v3;
- NamedField<b4_, T4_> v4;
- NamedField<b5_, T5_> v5;
- NamedField<b6_, T6_> v6;
- NamedField<b7_, T7_> v7;
- NamedField<b8_, T8_> v8;
- NamedField<b9_, T9_> v9;
- NamedField<b10_, T10_> v10;
- NamedField<b11_, T11_> v11;
- NamedField<b12_, T12_> v12;
- NamedField<b13_, T13_> v13;
- NamedField<b14_, T14_> v14;
- NamedField<b15_, T15_> v15;
- NamedField<b16_, T16_> v16;
- NamedField<b17_, T17_> v17;
- NamedField<b18_, T18_> v18;
- NamedField<b19_, T19_> v19;
- NamedField<b20_, T20_> v20;
-
- ///\}
-
- /**
- * Empty constructor.
- */
- Named()
- {
- }
-
- /**
- * Copy constructor.
- */
- Named(
- NamedField<b1_, T1_> p1,
- NamedField<b2_, T2_> p2,
- NamedField<b3_, T3_> p3,
- NamedField<b4_, T4_> p4,
- NamedField<b5_, T5_> p5,
- NamedField<b6_, T6_> p6,
- NamedField<b7_, T7_> p7,
- NamedField<b8_, T8_> p8,
- NamedField<b9_, T9_> p9,
- NamedField<b10_, T10_> p10,
- NamedField<b11_, T11_> p11,
- NamedField<b12_, T12_> p12,
- NamedField<b13_, T13_> p13,
- NamedField<b14_, T14_> p14,
- NamedField<b15_, T15_> p15,
- NamedField<b16_, T16_> p16,
- NamedField<b17_, T17_> p17,
- NamedField<b18_, T18_> p18,
- NamedField<b19_, T19_> p19,
- NamedField<b20_, T20_> p20
- ) :
- v1(p1),
- v2(p2),
- v3(p3),
- v4(p4),
- v5(p5),
- v6(p6),
- v7(p7),
- v8(p8),
- v9(p9),
- v10(p10),
- v11(p11),
- v12(p12),
- v13(p13),
- v14(p14),
- v15(p15),
- v16(p16),
- v17(p17),
- v18(p18),
- v19(p19),
- v20(p20)
- {
- }
-
- /**
- * Set a member.
- *
- * The member must not have already been set.
- */
- template <typename K_, typename V_>
- Named<
- std::tr1::is_same<K_, typename T1_::NamedFirstParamType>::value || b1_,
- std::tr1::is_same<K_, typename T2_::NamedFirstParamType>::value || b2_,
- std::tr1::is_same<K_, typename T3_::NamedFirstParamType>::value || b3_,
- std::tr1::is_same<K_, typename T4_::NamedFirstParamType>::value || b4_,
- std::tr1::is_same<K_, typename T5_::NamedFirstParamType>::value || b5_,
- std::tr1::is_same<K_, typename T6_::NamedFirstParamType>::value || b6_,
- std::tr1::is_same<K_, typename T7_::NamedFirstParamType>::value || b7_,
- std::tr1::is_same<K_, typename T8_::NamedFirstParamType>::value || b8_,
- std::tr1::is_same<K_, typename T9_::NamedFirstParamType>::value || b9_,
- std::tr1::is_same<K_, typename T10_::NamedFirstParamType>::value || b10_,
- std::tr1::is_same<K_, typename T11_::NamedFirstParamType>::value || b11_,
- std::tr1::is_same<K_, typename T12_::NamedFirstParamType>::value || b12_,
- std::tr1::is_same<K_, typename T13_::NamedFirstParamType>::value || b13_,
- std::tr1::is_same<K_, typename T14_::NamedFirstParamType>::value || b14_,
- std::tr1::is_same<K_, typename T15_::NamedFirstParamType>::value || b15_,
- std::tr1::is_same<K_, typename T16_::NamedFirstParamType>::value || b16_,
- std::tr1::is_same<K_, typename T17_::NamedFirstParamType>::value || b17_,
- std::tr1::is_same<K_, typename T18_::NamedFirstParamType>::value || b18_,
- std::tr1::is_same<K_, typename T19_::NamedFirstParamType>::value || b19_,
- std::tr1::is_same<K_, typename T20_::NamedFirstParamType>::value || b20_
- >
- operator() (
- const K_ &,
- const V_ & v)
- {
- bool PALUDIS_ATTRIBUTE((unused)) check_key_known(CheckTrue<
- std::tr1::is_same<K_, typename T1_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T2_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T3_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T4_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T5_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T6_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T7_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T8_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T9_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T10_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T11_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T12_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T13_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T14_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T15_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T16_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T17_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T18_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T19_::NamedFirstParamType>::value ||
- std::tr1::is_same<K_, typename T20_::NamedFirstParamType>::value
- >::check_true);
-
- bool PALUDIS_ATTRIBUTE((unused)) check_key_unrepeated(CheckTrue<
- ((! std::tr1::is_same<K_, typename T1_::NamedFirstParamType>::value) || ! b1_) &&
- ((! std::tr1::is_same<K_, typename T2_::NamedFirstParamType>::value) || ! b2_) &&
- ((! std::tr1::is_same<K_, typename T3_::NamedFirstParamType>::value) || ! b3_) &&
- ((! std::tr1::is_same<K_, typename T4_::NamedFirstParamType>::value) || ! b4_) &&
- ((! std::tr1::is_same<K_, typename T5_::NamedFirstParamType>::value) || ! b5_) &&
- ((! std::tr1::is_same<K_, typename T6_::NamedFirstParamType>::value) || ! b6_) &&
- ((! std::tr1::is_same<K_, typename T7_::NamedFirstParamType>::value) || ! b7_) &&
- ((! std::tr1::is_same<K_, typename T8_::NamedFirstParamType>::value) || ! b8_) &&
- ((! std::tr1::is_same<K_, typename T9_::NamedFirstParamType>::value) || ! b9_) &&
- ((! std::tr1::is_same<K_, typename T10_::NamedFirstParamType>::value) || ! b10_) &&
- ((! std::tr1::is_same<K_, typename T11_::NamedFirstParamType>::value) || ! b11_) &&
- ((! std::tr1::is_same<K_, typename T12_::NamedFirstParamType>::value) || ! b12_) &&
- ((! std::tr1::is_same<K_, typename T13_::NamedFirstParamType>::value) || ! b13_) &&
- ((! std::tr1::is_same<K_, typename T14_::NamedFirstParamType>::value) || ! b14_) &&
- ((! std::tr1::is_same<K_, typename T15_::NamedFirstParamType>::value) || ! b15_) &&
- ((! std::tr1::is_same<K_, typename T16_::NamedFirstParamType>::value) || ! b16_) &&
- ((! std::tr1::is_same<K_, typename T17_::NamedFirstParamType>::value) || ! b17_) &&
- ((! std::tr1::is_same<K_, typename T18_::NamedFirstParamType>::value) || ! b18_) &&
- ((! std::tr1::is_same<K_, typename T19_::NamedFirstParamType>::value) || ! b19_) &&
- ((! std::tr1::is_same<K_, typename T20_::NamedFirstParamType>::value) || ! b20_)
- >::check_true);
-
- return Named<
- std::tr1::is_same<K_, typename T1_::NamedFirstParamType>::value || b1_,
- std::tr1::is_same<K_, typename T2_::NamedFirstParamType>::value || b2_,
- std::tr1::is_same<K_, typename T3_::NamedFirstParamType>::value || b3_,
- std::tr1::is_same<K_, typename T4_::NamedFirstParamType>::value || b4_,
- std::tr1::is_same<K_, typename T5_::NamedFirstParamType>::value || b5_,
- std::tr1::is_same<K_, typename T6_::NamedFirstParamType>::value || b6_,
- std::tr1::is_same<K_, typename T7_::NamedFirstParamType>::value || b7_,
- std::tr1::is_same<K_, typename T8_::NamedFirstParamType>::value || b8_,
- std::tr1::is_same<K_, typename T9_::NamedFirstParamType>::value || b9_,
- std::tr1::is_same<K_, typename T10_::NamedFirstParamType>::value || b10_,
- std::tr1::is_same<K_, typename T11_::NamedFirstParamType>::value || b11_,
- std::tr1::is_same<K_, typename T12_::NamedFirstParamType>::value || b12_,
- std::tr1::is_same<K_, typename T13_::NamedFirstParamType>::value || b13_,
- std::tr1::is_same<K_, typename T14_::NamedFirstParamType>::value || b14_,
- std::tr1::is_same<K_, typename T15_::NamedFirstParamType>::value || b15_,
- std::tr1::is_same<K_, typename T16_::NamedFirstParamType>::value || b16_,
- std::tr1::is_same<K_, typename T17_::NamedFirstParamType>::value || b17_,
- std::tr1::is_same<K_, typename T18_::NamedFirstParamType>::value || b18_,
- std::tr1::is_same<K_, typename T19_::NamedFirstParamType>::value || b19_,
- std::tr1::is_same<K_, typename T20_::NamedFirstParamType>::value || b20_
- >(
- SV<std::tr1::is_same<K_, typename T1_::NamedFirstParamType>::value, typename T1_::NamedSecondParamType>::sv(v, v1),
- SV<std::tr1::is_same<K_, typename T2_::NamedFirstParamType>::value, typename T2_::NamedSecondParamType>::sv(v, v2),
- SV<std::tr1::is_same<K_, typename T3_::NamedFirstParamType>::value, typename T3_::NamedSecondParamType>::sv(v, v3),
- SV<std::tr1::is_same<K_, typename T4_::NamedFirstParamType>::value, typename T4_::NamedSecondParamType>::sv(v, v4),
- SV<std::tr1::is_same<K_, typename T5_::NamedFirstParamType>::value, typename T5_::NamedSecondParamType>::sv(v, v5),
- SV<std::tr1::is_same<K_, typename T6_::NamedFirstParamType>::value, typename T6_::NamedSecondParamType>::sv(v, v6),
- SV<std::tr1::is_same<K_, typename T7_::NamedFirstParamType>::value, typename T7_::NamedSecondParamType>::sv(v, v7),
- SV<std::tr1::is_same<K_, typename T8_::NamedFirstParamType>::value, typename T8_::NamedSecondParamType>::sv(v, v8),
- SV<std::tr1::is_same<K_, typename T9_::NamedFirstParamType>::value, typename T9_::NamedSecondParamType>::sv(v, v9),
- SV<std::tr1::is_same<K_, typename T10_::NamedFirstParamType>::value, typename T10_::NamedSecondParamType>::sv(v, v10),
- SV<std::tr1::is_same<K_, typename T11_::NamedFirstParamType>::value, typename T11_::NamedSecondParamType>::sv(v, v11),
- SV<std::tr1::is_same<K_, typename T12_::NamedFirstParamType>::value, typename T12_::NamedSecondParamType>::sv(v, v12),
- SV<std::tr1::is_same<K_, typename T13_::NamedFirstParamType>::value, typename T13_::NamedSecondParamType>::sv(v, v13),
- SV<std::tr1::is_same<K_, typename T14_::NamedFirstParamType>::value, typename T14_::NamedSecondParamType>::sv(v, v14),
- SV<std::tr1::is_same<K_, typename T15_::NamedFirstParamType>::value, typename T15_::NamedSecondParamType>::sv(v, v15),
- SV<std::tr1::is_same<K_, typename T16_::NamedFirstParamType>::value, typename T16_::NamedSecondParamType>::sv(v, v16),
- SV<std::tr1::is_same<K_, typename T17_::NamedFirstParamType>::value, typename T17_::NamedSecondParamType>::sv(v, v17),
- SV<std::tr1::is_same<K_, typename T18_::NamedFirstParamType>::value, typename T18_::NamedSecondParamType>::sv(v, v18),
- SV<std::tr1::is_same<K_, typename T19_::NamedFirstParamType>::value, typename T19_::NamedSecondParamType>::sv(v, v19),
- SV<std::tr1::is_same<K_, typename T20_::NamedFirstParamType>::value, typename T20_::NamedSecondParamType>::sv(v, v20)
- );
- }
- };
-
- /**
- * Create an empty set of named arguments.
- */
- static Named<
- false, false, false, false, false,
- false, false, false, false, false,
- false, false, false, false, false,
- false, false, false, false, false> named_create()
- {
- return Named<
- false, false, false, false, false,
- false, false, false, false, false,
- false, false, false, false, false,
- false, false, false, false, false>();
- }
-
- /**
- * Create using a fully constructed set of named arguments.
- */
- template <
- bool b1_,
- bool b2_,
- bool b3_,
- bool b4_,
- bool b5_,
- bool b6_,
- bool b7_,
- bool b8_,
- bool b9_,
- bool b10_,
- bool b11_,
- bool b12_,
- bool b13_,
- bool b14_,
- bool b15_,
- bool b16_,
- bool b17_,
- bool b18_,
- bool b19_,
- bool b20_
- >
- KeyedClass(const Named<
- b1_, b2_, b3_, b4_, b5_, b6_, b7_, b8_, b9_,
- b10_, b11_, b12_, b13_, b14_, b15_, b16_, b17_, b18_, b19_,
- b20_> & named) :
- Part<T1_>(named.v1),
- Part<T2_>(named.v2),
- Part<T3_>(named.v3),
- Part<T4_>(named.v4),
- Part<T5_>(named.v5),
- Part<T6_>(named.v6),
- Part<T7_>(named.v7),
- Part<T8_>(named.v8),
- Part<T9_>(named.v9),
- Part<T10_>(named.v10),
- Part<T11_>(named.v11),
- Part<T12_>(named.v12),
- Part<T13_>(named.v13),
- Part<T14_>(named.v14),
- Part<T15_>(named.v15),
- Part<T16_>(named.v16),
- Part<T17_>(named.v17),
- Part<T18_>(named.v18),
- Part<T19_>(named.v19),
- Part<T20_>(named.v20)
- {
- }
-
- ///\}
- };
-
- }
-}
-
-#endif
diff --git a/paludis/util/keys.hh b/paludis/util/keys.hh
deleted file mode 100644
index 1716c5c..0000000
--- a/paludis/util/keys.hh
+++ /dev/null
@@ -1,201 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2008 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_UTIL_KEYS_HH
-#define PALUDIS_GUARD_PALUDIS_UTIL_KEYS_HH 1
-
-#include <paludis/util/kc-fwd.hh>
-
-namespace paludis
-{
- namespace k
- {
- typedef kc::Key<1> fetch_unneeded;
- typedef kc::Key<2> safe_resume;
- typedef kc::Key<4> debug_build;
- typedef kc::Key<5> checks;
- typedef kc::Key<6> destination;
- typedef kc::Key<7> visible;
- typedef kc::Key<8> target_file;
- typedef kc::Key<9> requires_manual_fetching;
- typedef kc::Key<10> failed_automatic_fetching;
- typedef kc::Key<11> failed_integrity_checks;
- typedef kc::Key<12> default_environment;
- typedef kc::Key<13> fallback_environment;
- typedef kc::Key<14> support_old_style_virtuals;
- typedef kc::Key<15> default_ebuild_distdir;
- typedef kc::Key<16> default_ebuild_write_cache;
- typedef kc::Key<17> default_ebuild_names_cache;
- typedef kc::Key<18> default_ebuild_builddir;
- typedef kc::Key<19> default_ebuild_layout;
- typedef kc::Key<20> default_ebuild_eapi_when_unknown;
- typedef kc::Key<21> default_ebuild_eapi_when_unspecified;
- typedef kc::Key<22> default_ebuild_profile_eapi;
- typedef kc::Key<23> default_vdb_provides_cache;
- typedef kc::Key<24> default_vdb_names_cache;
- typedef kc::Key<25> paludis_environment_use_conf_filename;
- typedef kc::Key<26> paludis_environment_keywords_conf_filename;
- typedef kc::Key<27> concept_use;
- typedef kc::Key<28> concept_keyword;
- typedef kc::Key<29> paludis_package;
- typedef kc::Key<30> kind;
- typedef kc::Key<31> value;
- typedef kc::Key<32> mask_file;
- typedef kc::Key<33> comment;
- typedef kc::Key<34> environment;
- typedef kc::Key<35> image;
- typedef kc::Key<36> root;
- typedef kc::Key<37> no_chown;
- typedef kc::Key<38> options;
- typedef kc::Key<39> contents_file;
- typedef kc::Key<40> config_protect;
- typedef kc::Key<41> config_protect_mask;
- typedef kc::Key<42> package_id;
- typedef kc::Key<43> sets_interface;
- typedef kc::Key<44> syncable_interface;
- typedef kc::Key<45> use_interface;
- typedef kc::Key<46> world_interface;
- typedef kc::Key<47> mirrors_interface;
- typedef kc::Key<48> environment_variable_interface;
- typedef kc::Key<49> provides_interface;
- typedef kc::Key<50> virtuals_interface;
- typedef kc::Key<51> make_virtuals_interface;
- typedef kc::Key<52> destination_interface;
- typedef kc::Key<53> e_interface;
- typedef kc::Key<54> hook_interface;
- typedef kc::Key<55> qa_interface;
- typedef kc::Key<56> manifest_interface;
- typedef kc::Key<57> path;
- typedef kc::Key<58> arch;
- typedef kc::Key<59> status;
- typedef kc::Key<60> profile;
- typedef kc::Key<61> virtual_name;
- typedef kc::Key<62> provided_by;
- typedef kc::Key<63> provided_by_spec;
- typedef kc::Key<64> image_dir;
- typedef kc::Key<65> environment_file;
- typedef kc::Key<66> filter_file;
- typedef kc::Key<67> output_prefix;
- typedef kc::Key<68> local;
- typedef kc::Key<69> remote;
- typedef kc::Key<69> ebuild_dir;
- typedef kc::Key<70> ebuild_file;
- typedef kc::Key<71> eclassdirs;
- typedef kc::Key<72> exlibsdirs;
- typedef kc::Key<73> portdir;
- typedef kc::Key<74> distdir;
- typedef kc::Key<75> builddir;
- typedef kc::Key<76> userpriv;
- typedef kc::Key<77> sandbox;
- typedef kc::Key<78> commands;
- typedef kc::Key<79> a;
- typedef kc::Key<80> aa;
- typedef kc::Key<81> use;
- typedef kc::Key<82> use_expand;
- typedef kc::Key<83> profiles;
- typedef kc::Key<84> expand_vars;
- typedef kc::Key<85> files_dir;
- typedef kc::Key<86> name;
- typedef kc::Key<87> exported_name;
- typedef kc::Key<88> supported;
- typedef kc::Key<89> package_dep_spec_parse_options;
- typedef kc::Key<90> dependency_spec_tree_parse_options;
- typedef kc::Key<91> iuse_flag_parse_options;
- typedef kc::Key<92> merger_options;
- typedef kc::Key<93> breaks_portage;
- typedef kc::Key<94> can_be_pbin;
- typedef kc::Key<95> ebuild_options;
- typedef kc::Key<96> ebuild_phases;
- typedef kc::Key<97> ebuild_metadata_variables;
- typedef kc::Key<98> ebuild_environment_variables;
- typedef kc::Key<99> uri_labels;
- typedef kc::Key<100> dependency_labels;
- typedef kc::Key<101> pipe_commands;
- typedef kc::Key<102> tools_options;
- typedef kc::Key<103> rewrite_virtuals;
- typedef kc::Key<104> no_slot_or_repo;
- typedef kc::Key<106> slot;
- typedef kc::Key<107> loadsaveenv_dir;
- typedef kc::Key<108> unmerge_only;
- typedef kc::Key<109> load_environment;
- typedef kc::Key<110> info_vars;
- typedef kc::Key<111> output_directory;
- typedef kc::Key<112> destination_repository;
- typedef kc::Key<113> binary_ebuild_location;
- typedef kc::Key<114> binary_distdir;
- typedef kc::Key<115> env_use;
- typedef kc::Key<116> env_use_expand;
- typedef kc::Key<117> env_use_expand_hidden;
- typedef kc::Key<118> env_aa;
- typedef kc::Key<119> env_arch;
- typedef kc::Key<120> env_kv;
- typedef kc::Key<121> env_accept_keywords;
- typedef kc::Key<122> env_portdir;
- typedef kc::Key<123> env_distdir;
- typedef kc::Key<124> description_use;
- typedef kc::Key<125> debug_dir;
- typedef kc::Key<126> use_ebuild_file;
- typedef kc::Key<127> install_under;
- typedef kc::Key<128> location;
- typedef kc::Key<129> version;
- typedef kc::Key<130> build_dependencies;
- typedef kc::Key<131> run_dependencies;
- typedef kc::Key<132> description;
- typedef kc::Key<133> fs_location;
- typedef kc::Key<134> magic;
- typedef kc::Key<135> mutex;
- typedef kc::Key<136> ndbam;
- typedef kc::Key<137> on_string;
- typedef kc::Key<138> on_arrow;
- typedef kc::Key<139> on_any;
- typedef kc::Key<140> on_use;
- typedef kc::Key<141> on_label;
- typedef kc::Key<142> on_pop;
- typedef kc::Key<143> on_should_be_empty;
- typedef kc::Key<144> on_all;
- typedef kc::Key<145> on_error;
- typedef kc::Key<146> add_handler;
- typedef kc::Key<147> item;
- typedef kc::Key<148> on_use_under_any;
- typedef kc::Key<149> on_annotations;
- typedef kc::Key<150> sync;
- typedef kc::Key<151> sync_options;
- typedef kc::Key<152> from_repositories;
- typedef kc::Key<153> mask;
- typedef kc::Key<154> repository;
- typedef kc::Key<155> repository_homepage;
- typedef kc::Key<156> repository_description;
- typedef kc::Key<157> get_new_ids_or_minus_one;
- typedef kc::Key<158> rewrite_ids_over_to_root;
- typedef kc::Key<159> importance;
- typedef kc::Key<160> keys;
- typedef kc::Key<161> format;
- typedef kc::Key<162> remove_trailing_square_bracket_if_exists;
- typedef kc::Key<163> remove_trailing_slot_if_exists;
- typedef kc::Key<164> has_version_operator;
- typedef kc::Key<165> get_remove_version_operator;
- typedef kc::Key<166> get_remove_trailing_version;
- typedef kc::Key<167> add_version_requirement;
- typedef kc::Key<168> add_package_requirement;
- typedef kc::Key<169> check_sanity;
- typedef kc::Key<170> remove_trailing_repo_if_exists;
- }
-}
-
-#endif
diff --git a/paludis/util/named_value-fwd.hh b/paludis/util/named_value-fwd.hh
index eca97e7..922fa11 100644
--- a/paludis/util/named_value-fwd.hh
+++ b/paludis/util/named_value-fwd.hh
@@ -35,7 +35,6 @@ namespace paludis
template <typename K_>
NamedValue<K_, std::string>
value_for(const char * const v);
-
}
#endif
diff --git a/paludis/util/named_value.hh b/paludis/util/named_value.hh
index 4d45616..e4dedf2 100644
--- a/paludis/util/named_value.hh
+++ b/paludis/util/named_value.hh
@@ -31,6 +31,12 @@ namespace paludis
V_ _value;
public:
+ template <typename T_>
+ NamedValue(const NamedValue<K_, T_> & v) :
+ _value(v())
+ {
+ }
+
explicit NamedValue(const V_ & v) :
_value(v)
{
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index aea055a..6b483a3 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -26,9 +26,9 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/iterator_funcs.hh>
-#include <paludis/util/kc.hh>
-#include <paludis/util/keys.hh>
#include <paludis/util/simple_parser.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/version_spec.hh>
#include <vector>
#include <limits>
@@ -45,6 +45,15 @@ BadVersionSpecError::BadVersionSpecError(const std::string & name, const std::st
{
}
+namespace paludis
+{
+ namespace n
+ {
+ struct kind;
+ struct value;
+ }
+}
+
namespace
{
enum PartKind
@@ -61,12 +70,13 @@ namespace
number,
scm
};
-}
-typedef kc::KeyedClass<
- kc::Field<k::kind, PartKind>,
- kc::Field<k::value, std::string>
- > Part;
+ struct Part
+ {
+ NamedValue<n::kind, PartKind> kind;
+ NamedValue<n::value, std::string> value;
+ };
+}
namespace paludis
{
@@ -107,7 +117,7 @@ VersionSpec::VersionSpec(const std::string & text) :
SimpleParser parser(text);
if (parser.consume(simple_parser::exact("scm")))
- _imp->parts.push_back(Part(scm, ""));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(scm), value_for<n::value>("")));
else
{
/* numbers... */
@@ -117,7 +127,7 @@ VersionSpec::VersionSpec(const std::string & text) :
if (! parser.consume(+simple_parser::any_of("0123456789") >> number_part))
throw BadVersionSpecError(text, "Expected number part not found at offset " + stringify(parser.offset()));
- _imp->parts.push_back(Part(number, number_part));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(number), value_for<n::value>(number_part)));
if (! parser.consume(simple_parser::exact(".")))
break;
@@ -127,7 +137,7 @@ VersionSpec::VersionSpec(const std::string & text) :
{
std::string l;
if (parser.consume(simple_parser::any_of("abcdefghijklmnopqrstuvwxyz") >> l))
- _imp->parts.push_back(Part(letter, l));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(letter), value_for<n::value>(l)));
}
while (true)
@@ -157,7 +167,7 @@ VersionSpec::VersionSpec(const std::string & text) :
number_str = "0";
}
- _imp->parts.push_back(Part(k, number_str));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(k), value_for<n::value>(number_str)));
}
/* try */
@@ -173,24 +183,24 @@ VersionSpec::VersionSpec(const std::string & text) :
if (number_str.empty())
number_str = "0";
}
- _imp->parts.push_back(Part(trypart, number_str));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(trypart), value_for<n::value>(number_str)));
}
/* scm */
if (parser.consume(simple_parser::exact("-scm")))
{
/* _suffix-scm? */
- if (_imp->parts.back()[k::value()].empty())
- _imp->parts.back()[k::value()] = "MAX";
+ if (_imp->parts.back().value().empty())
+ _imp->parts.back().value() = "MAX";
- _imp->parts.push_back(Part(scm, ""));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(scm), value_for<n::value>("")));
}
/* Now we can change empty values to "0" */
for (std::vector<Part>::iterator i(_imp->parts.begin()),
i_end(_imp->parts.end()) ; i != i_end ; ++i)
- if ((*i)[k::value()].empty())
- (*i)[k::value()] = "0";
+ if ((*i).value().empty())
+ (*i).value() = "0";
}
/* revision */
@@ -208,7 +218,7 @@ VersionSpec::VersionSpec(const std::string & text) :
number_str = strip_leading(number_str, "0");
if (number_str.empty())
number_str = "0";
- _imp->parts.push_back(Part(revision, number_str));
+ _imp->parts.push_back(make_named_values<Part>(value_for<n::kind>(revision), value_for<n::value>(number_str)));
if (empty)
{
@@ -264,7 +274,7 @@ VersionSpec::compare(const VersionSpec & other) const
v1(_imp->parts.begin()), v1_end(_imp->parts.end()),
v2(other._imp->parts.begin()), v2_end(other._imp->parts.end());
- Part end_part(empty, "");
+ Part end_part(make_named_values<Part>(value_for<n::kind>(empty), value_for<n::value>("")));
bool first(true);
while (true)
{
@@ -274,49 +284,49 @@ VersionSpec::compare(const VersionSpec & other) const
if (&end_part == p1 && &end_part == p2)
break;
- if (p1 == &end_part && (*p2)[k::kind()] == revision && (*p2)[k::value()] == "0")
+ if (p1 == &end_part && (*p2).kind() == revision && (*p2).value() == "0")
continue;
- if (p2 == &end_part && (*p1)[k::kind()] == revision && (*p1)[k::value()] == "0")
+ if (p2 == &end_part && (*p1).kind() == revision && (*p1).value() == "0")
continue;
- if ((*p1)[k::kind()] < (*p2)[k::kind()])
+ if ((*p1).kind() < (*p2).kind())
return -1;
- if ((*p1)[k::kind()] > (*p2)[k::kind()])
+ if ((*p1).kind() > (*p2).kind())
return 1;
std::string p1s, p2s;
bool length_cmp(true);
/* number parts */
- if ((*p1)[k::kind()] == number)
+ if ((*p1).kind() == number)
{
if (first)
{
/* first component - always as integer (leading zeroes removed) */
first = false;
- p1s = strip_leading((*p1)[k::value()], "0");
- p2s = strip_leading((*p2)[k::value()], "0");
+ p1s = strip_leading((*p1).value(), "0");
+ p2s = strip_leading((*p2).value(), "0");
}
- else if ((! (*p1)[k::value()].empty() && (*p1)[k::value()].at(0) == '0') ||
- (! (*p2)[k::value()].empty() && (*p2)[k::value()].at(0) == '0'))
+ else if ((! (*p1).value().empty() && (*p1).value().at(0) == '0') ||
+ (! (*p2).value().empty() && (*p2).value().at(0) == '0'))
{
/* leading zeroes - stringwise compare with trailing zeroes removed */
length_cmp = false;
- p1s = strip_trailing((*p1)[k::value()], "0");
- p2s = strip_trailing((*p2)[k::value()], "0");
+ p1s = strip_trailing((*p1).value(), "0");
+ p2s = strip_trailing((*p2).value(), "0");
}
else
{
- p1s = (*p1)[k::value()];
- p2s = (*p2)[k::value()];
+ p1s = (*p1).value();
+ p2s = (*p2).value();
}
}
/* anything else than number parts */
else
{
- p1s = (*p1)[k::value()];
- p2s = (*p2)[k::value()];
+ p1s = (*p1).value();
+ p2s = (*p2).value();
/* _suffix-scm? */
if (p1s == "MAX" && p2s == "MAX")
@@ -352,7 +362,7 @@ VersionSpec::tilde_compare(const VersionSpec & other) const
v1(_imp->parts.begin()), v1_end(_imp->parts.end()),
v2(other._imp->parts.begin()), v2_end(other._imp->parts.end());
- Part end_part(empty, "");
+ Part end_part(make_named_values<Part>(value_for<n::kind>(empty), value_for<n::value>("")));
bool first(true);
while (true)
{
@@ -361,49 +371,49 @@ VersionSpec::tilde_compare(const VersionSpec & other) const
if (&end_part == p1 && &end_part == p2)
break;
- if ((*p1)[k::kind()] != (*p2)[k::kind()])
+ if ((*p1).kind() != (*p2).kind())
{
- if (p2 != &end_part || (*p1)[k::kind()] != revision)
+ if (p2 != &end_part || (*p1).kind() != revision)
return false;
}
else
{
std::string p1s, p2s;
/* number part */
- if ((*p1)[k::kind()] == number)
+ if ((*p1).kind() == number)
{
if (first)
{
/* first component - remove leading zeroes and check whether equal */
first = false;
- if (strip_leading((*p1)[k::value()], "0") != strip_leading((*p2)[k::value()], "0"))
+ if (strip_leading((*p1).value(), "0") != strip_leading((*p2).value(), "0"))
return false;
}
- else if ((! (*p1)[k::value()].empty() && (*p1)[k::value()].at(0) == '0') ||
- (! (*p2)[k::value()].empty() && (*p2)[k::value()].at(0) == '0'))
+ else if ((! (*p1).value().empty() && (*p1).value().at(0) == '0') ||
+ (! (*p2).value().empty() && (*p2).value().at(0) == '0'))
{
/* leading zeroes - remove trailing zeroes and check whether equal */
- if (strip_trailing((*p1)[k::value()], "0") != strip_trailing((*p2)[k::value()], "0"))
+ if (strip_trailing((*p1).value(), "0") != strip_trailing((*p2).value(), "0"))
return false;
}
else
{
/* normal(!) case */
- if ((*p1)[k::value()] != (*p2)[k::value()])
+ if ((*p1).value() != (*p2).value())
return false;
}
}
/* revision - compare as integers */
- else if ((*p1)[k::kind()] == revision)
+ else if ((*p1).kind() == revision)
{
- int c = (*p1)[k::value()].size() - (*p2)[k::value()].size();
+ int c = (*p1).value().size() - (*p2).value().size();
if (c < 0)
return false;
- else if (c == 0 && (*p1)[k::value()].compare((*p2)[k::value()]) == -1)
+ else if (c == 0 && (*p1).value().compare((*p2).value()) == -1)
return false;
}
/* not a number part nor revision - must be just equal */
- else if ((*p1)[k::value()] != (*p2)[k::value()])
+ else if ((*p1).value() != (*p2).value())
return false;
}
}
@@ -436,7 +446,7 @@ VersionSpec::hash() const
for (std::vector<Part>::const_iterator r(_imp->parts.begin()), r_end(_imp->parts.end()) ;
r != r_end ; ++r)
{
- if ((*r)[k::value()] == "0" && (*r)[k::kind()] == revision)
+ if ((*r).value() == "0" && (*r).kind() == revision)
continue;
std::size_t hh(result & h_mask);
@@ -444,10 +454,10 @@ VersionSpec::hash() const
result ^= (hh >> h_shift);
std::string r_v;
- if (! (*r)[k::value()].empty() && (*r)[k::value()].at(0) == '0')
- r_v = strip_trailing((*r)[k::value()], "0");
+ if (! (*r).value().empty() && (*r).value().at(0) == '0')
+ r_v = strip_trailing((*r).value(), "0");
else
- r_v = (*r)[k::value()];
+ r_v = (*r).value();
size_t x(0);
int zeroes(0);
@@ -462,7 +472,7 @@ VersionSpec::hash() const
}
first = false;
- result ^= (static_cast<std::size_t>((*r)[k::kind()]) + (x << 3) + (zeroes << 12));
+ result ^= (static_cast<std::size_t>((*r).kind()) + (x << 3) + (zeroes << 12));
}
} while (false);
@@ -479,7 +489,7 @@ namespace
{
bool operator() (const Part & p) const
{
- return p[k::kind()] == p_;
+ return p.kind() == p_;
}
};
}
@@ -517,7 +527,7 @@ VersionSpec::revision_only() const
else
result = "r";
- result.append((*r)[k::value()]);
+ result.append((*r).value());
r = std::find_if(next(r), _imp->parts.end(), IsPart<revision>());
} while (r != _imp->parts.end());
@@ -561,7 +571,7 @@ VersionSpec::is_scm() const
/* are we a -r9999? */
r = std::find_if(_imp->parts.begin(), _imp->parts.end(), IsPart<revision>());
if (r != _imp->parts.end())
- if ((*r)[k::value()] == "9999")
+ if ((*r).value() == "9999")
{
result = true;
break;
@@ -616,8 +626,8 @@ VersionSpec::bump() const
number_parts.pop_back();
/* ++string */
- std::string::reverse_iterator i(number_parts.back()[k::value()].rbegin()),
- i_end(number_parts.back()[k::value()].rend());
+ std::string::reverse_iterator i(number_parts.back().value().rbegin()),
+ i_end(number_parts.back().value().rend());
bool add1(true);
while (i != i_end && add1)
{
@@ -631,7 +641,7 @@ VersionSpec::bump() const
++i;
}
if (add1)
- number_parts.back()[k::value()].insert(0, "1");
+ number_parts.back().value().insert(0, "1");
bool need_dot(false);
std::string str;
@@ -640,7 +650,7 @@ VersionSpec::bump() const
{
if (need_dot)
str.append(".");
- str.append((*r)[k::value()]);
+ str.append((*r).value());
need_dot = true;
}
return VersionSpec(str);
diff --git a/python/action.cc b/python/action.cc
index c0d5d27..2012d7a 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -22,7 +22,7 @@
#include <paludis/action.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/kc.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/repository.hh>
#include <tr1/memory>
@@ -48,6 +48,31 @@ class class_supports_action_test :
}
};
+namespace
+{
+ InstallActionOptions make_install_action_options(
+ const InstallActionDebugOption & d, const InstallActionChecksOption & c,
+ const std::tr1::shared_ptr<paludis::Repository> & r)
+ {
+ return make_named_values<InstallActionOptions>(
+ value_for<n::checks>(c),
+ value_for<n::debug_build>(d),
+ value_for<n::destination>(r)
+ );
+ }
+
+ FetchActionOptions make_fetch_action_options(
+ const bool fetch_unneeded, const bool safe_resume
+ )
+ {
+ return make_named_values<FetchActionOptions>(
+ value_for<n::fetch_unneeded>(fetch_unneeded),
+ value_for<n::safe_resume>(safe_resume)
+ );
+ }
+
+}
+
void expose_action()
{
/**
@@ -91,27 +116,29 @@ void expose_action()
(
"InstallActionOptions",
"Options for InstallAction.",
- bp::init<const InstallActionDebugOption &, const InstallActionChecksOption &,
- const std::tr1::shared_ptr<paludis::Repository> &>(
- "__init__(InstallActionDebugOption, InstallActionChecksOption, Repository)"
- )
+ bp::no_init
)
+ .def("__init__",
+ make_install_action_options,
+ "__init__(InstallActionDebugOption, InstallActionChecksOption, Repository)"
+ )
+
.add_property("debug_build",
- &kc_getter<InstallActionOptions, InstallActionDebugOption, k::debug_build>,
- &kc_setter<InstallActionOptions, InstallActionDebugOption, k::debug_build>,
+ &named_values_getter<InstallActionOptions, n::debug_build, InstallActionDebugOption, &InstallActionOptions::debug_build>,
+ &named_values_setter<InstallActionOptions, n::debug_build, InstallActionDebugOption, &InstallActionOptions::debug_build>,
"[rw] InstallActionDebugOption"
)
.add_property("checks",
- &kc_getter<InstallActionOptions, InstallActionChecksOption, k::checks>,
- &kc_setter<InstallActionOptions, InstallActionChecksOption, k::checks>,
+ &named_values_getter<InstallActionOptions, n::checks, InstallActionChecksOption, &InstallActionOptions::checks>,
+ &named_values_setter<InstallActionOptions, n::checks, InstallActionChecksOption, &InstallActionOptions::checks>,
"[rw] InstallActionChecksOption"
)
.add_property("destination",
- &kc_getter<InstallActionOptions, std::tr1::shared_ptr<Repository>, k::destination>,
- &kc_setter<InstallActionOptions, std::tr1::shared_ptr<Repository>, k::destination>,
+ &named_values_getter<InstallActionOptions, n::destination, std::tr1::shared_ptr<Repository>, &InstallActionOptions::destination>,
+ &named_values_setter<InstallActionOptions, n::destination, std::tr1::shared_ptr<Repository>, &InstallActionOptions::destination>,
"[rw] Repository"
)
;
@@ -123,17 +150,23 @@ void expose_action()
(
"FetchActionOptions",
"Options for FetchAction.",
- bp::init<const bool &, const bool &>("__init__(fetch_unneeded_bool, safe_resume_bool)")
+ bp::no_init
)
+
+ .def("__init__",
+ bp::make_constructor(make_fetch_action_options),
+ "__init__(fetch_uneeded, safe_resume)"
+ )
+
.add_property("fetch_unneeded",
- &kc_getter<FetchActionOptions, bool, k::fetch_unneeded>,
- &kc_setter<FetchActionOptions, bool, k::fetch_unneeded>,
+ &named_values_getter<FetchActionOptions, n::fetch_unneeded, bool, &FetchActionOptions::fetch_unneeded>,
+ &named_values_setter<FetchActionOptions, n::fetch_unneeded, bool, &FetchActionOptions::fetch_unneeded>,
"[rw] bool"
)
.add_property("safe_resume",
- &kc_getter<FetchActionOptions, bool, k::safe_resume>,
- &kc_setter<FetchActionOptions, bool, k::safe_resume>,
+ &named_values_getter<FetchActionOptions, n::safe_resume, bool, &FetchActionOptions::safe_resume>,
+ &named_values_setter<FetchActionOptions, n::safe_resume, bool, &FetchActionOptions::safe_resume>,
"[rw] bool"
)
;
diff --git a/python/mask.cc b/python/mask.cc
index 2725c89..c7df631 100644
--- a/python/mask.cc
+++ b/python/mask.cc
@@ -22,7 +22,6 @@
#include <paludis/mask.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/kc.hh>
using namespace paludis;
using namespace paludis::python;
@@ -289,15 +288,15 @@ void expose_mask()
)
)
.add_property("mask_file",
- &kc_getter<RepositoryMaskInfo, FSEntry, k::mask_file>,
- &kc_setter<RepositoryMaskInfo, FSEntry, k::mask_file>,
+ &named_values_getter<RepositoryMaskInfo, n::mask_file, FSEntry, &RepositoryMaskInfo::mask_file>,
+ &named_values_setter<RepositoryMaskInfo, n::mask_file, FSEntry, &RepositoryMaskInfo::mask_file>,
"[ro] str\n"
"Holds the file whence the mask originates."
)
.add_property("comment",
- &kc_getter<RepositoryMaskInfo, std::tr1::shared_ptr<const Sequence<std::string> >, k::comment>,
- &kc_setter<RepositoryMaskInfo, std::tr1::shared_ptr<const Sequence<std::string> >, k::comment>,
+ &named_values_getter<RepositoryMaskInfo, n::comment, std::tr1::shared_ptr<const Sequence<std::string> >, &RepositoryMaskInfo::comment>,
+ &named_values_setter<RepositoryMaskInfo, n::comment, std::tr1::shared_ptr<const Sequence<std::string> >, &RepositoryMaskInfo::comment>,
"[ro] Iterable of str\n"
"Sequence of lines explaining the mask."
)
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index eb4d4a4..735957c 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -23,6 +23,7 @@
#include <python/mutex.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/attributes.hh>
+#include <paludis/util/named_value-fwd.hh>
#include <boost/python.hpp>
#include <tr1/memory>
@@ -154,18 +155,18 @@ namespace paludis
}
};
- // helper for kc getters
- template <typename C_, typename T_, typename K_>
- T_ kc_getter(const C_ & c)
+ // helper for named values
+ template <typename C_, typename K_, typename T_, NamedValue<K_, T_> (C_::* c_)>
+ T_ named_values_getter(const C_ & c)
{
- return c[K_()];
+ return (c.*c_)();
}
- // helper for kc setters
- template <typename C_, typename T_, typename K_>
- void kc_setter(C_ & c, const T_ & t)
+ // helper for named values
+ template <typename C_, typename K_, typename T_, NamedValue<K_, T_> (C_::* c_)>
+ void named_values_setter(C_ & c, const T_ & t)
{
- c[K_()] = t;
+ (c.*c_)() = t;
}
} // namespace paludis::python
} // namespace paludis
diff --git a/ruby/action.cc b/ruby/action.cc
index ee854d9..0300890 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -21,8 +21,8 @@
#include <paludis_ruby.hh>
#include <paludis/action.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <ruby.h>
using namespace paludis;
@@ -233,10 +233,10 @@ namespace
rb_raise(rb_eArgError, "FetchActionOptions expects one or two arguments, but got %d",argc);
}
- ptr = new FetchActionOptions(FetchActionOptions::named_create()
- (k::fetch_unneeded(), v_fetch_unneeded)
- (k::safe_resume(), v_safe_resume)
- );
+ ptr = new FetchActionOptions(make_named_values<FetchActionOptions>(
+ value_for<n::fetch_unneeded>(v_fetch_unneeded),
+ value_for<n::safe_resume>(v_safe_resume)
+ ));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<FetchActionOptions>::free, ptr));
rb_obj_call_init(tdata, argc, argv);
@@ -328,12 +328,12 @@ namespace
rb_raise(rb_eArgError, "FetchActionOptions expects one or four arguments, but got %d",argc);
}
- ptr = new FetchActionFailure(FetchActionFailure::named_create()
- (k::target_file(), v_target_file)
- (k::requires_manual_fetching(), v_requires_manual_fetching)
- (k::failed_automatic_fetching(), v_failed_automatic_fetching)
- (k::failed_integrity_checks(), v_failed_integrity_checks)
- );
+ ptr = new FetchActionFailure(make_named_values<FetchActionFailure>(
+ value_for<n::failed_automatic_fetching>(v_failed_automatic_fetching),
+ value_for<n::failed_integrity_checks>(v_failed_integrity_checks),
+ value_for<n::requires_manual_fetching>(v_requires_manual_fetching),
+ value_for<n::target_file>(v_target_file)
+ ));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<FetchActionFailure>::free, ptr));
rb_obj_call_init(tdata, argc, argv);
@@ -388,30 +388,30 @@ namespace
*
* Did we fail automatic fetching?
*/
- template <typename T_, typename K_, typename R_>
- struct KCFetch;
+ template <typename T_, typename K_, typename R_, NamedValue<K_, R_> (T_::*) >
+ struct NVFetch;
- template <typename T_, typename K_>
- struct KCFetch<T_, K_, bool>
+ template <typename T_, typename K_, NamedValue<K_, bool> (T_::* f_) >
+ struct NVFetch<T_, K_, bool, f_>
{
static VALUE
fetch(VALUE self)
{
T_ * p;
Data_Get_Struct(self, T_, p);
- return bool_to_value((*p)[K_()]);
+ return bool_to_value((p->*f_)());
}
};
- template <typename T_, typename K_>
- struct KCFetch<T_, K_, std::string>
+ template <typename T_, typename K_, NamedValue<K_, std::string> (T_::* f_) >
+ struct NVFetch<T_, K_, std::string, f_>
{
static VALUE
fetch(VALUE self)
{
T_ * p;
Data_Get_Struct(self, T_, p);
- return rb_str_new2((*p)[K_()].c_str());
+ return rb_str_new2((p->*f_)().c_str());
}
};
@@ -432,15 +432,15 @@ namespace
* Our InstallActionChecksOption
*
*/
- template <typename T_, typename K_>
- struct KCFetchEnum
+ template <typename T_, typename K_, typename R_, NamedValue<K_, R_> (T_::* f_) >
+ struct NVFetchEnum
{
static VALUE
fetch(VALUE self)
{
T_ * p;
Data_Get_Struct(self, T_, p);
- return INT2FIX((*p)[K_()]);
+ return INT2FIX((p->*f_)());
}
};
@@ -529,11 +529,11 @@ namespace
rb_raise(rb_eArgError, "InstallActionOptions expects one or three arguments, but got %d",argc);
}
- ptr = new InstallActionOptions(InstallActionOptions::named_create()
- (k::debug_build(), v_debug_build)
- (k::checks(), v_checks)
- (k::destination(), v_destination)
- );
+ ptr = new InstallActionOptions(make_named_values<InstallActionOptions>(
+ value_for<n::checks>(v_checks),
+ value_for<n::debug_build>(v_debug_build),
+ value_for<n::destination>(v_destination)
+ ));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<InstallActionOptions>::free, ptr));
rb_obj_call_init(tdata, argc, argv);
@@ -559,7 +559,7 @@ namespace
{
InstallActionOptions * p;
Data_Get_Struct(self, InstallActionOptions, p);
- return repository_to_value((*p)[k::destination()]);
+ return repository_to_value((*p).destination());
}
/*
@@ -673,9 +673,11 @@ namespace
rb_define_singleton_method(c_fetch_action_options, "new", RUBY_FUNC_CAST(&fetch_action_options_new), -1);
rb_define_method(c_fetch_action_options, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
rb_define_method(c_fetch_action_options, "fetch_unneeded?",
- RUBY_FUNC_CAST((&KCFetch<FetchActionOptions, k::fetch_unneeded, bool>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::fetch_unneeded, bool,
+ &FetchActionOptions::fetch_unneeded>::fetch)), 0);
rb_define_method(c_fetch_action_options, "safe_resume?",
- RUBY_FUNC_CAST((&KCFetch<FetchActionOptions, k::safe_resume, bool>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetch<FetchActionOptions, n::safe_resume, bool,
+ &FetchActionOptions::safe_resume>::fetch)), 0);
/*
* Document-class: Paludis::FetchActionFailure
@@ -686,13 +688,17 @@ namespace
rb_define_singleton_method(c_fetch_action_failure, "new", RUBY_FUNC_CAST(&fetch_action_failure_new), -1);
rb_define_method(c_fetch_action_failure, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
rb_define_method(c_fetch_action_failure, "target_file",
- RUBY_FUNC_CAST((&KCFetch<FetchActionFailure, k::target_file, std::string>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::target_file, std::string,
+ &FetchActionFailure::target_file>::fetch)), 0);
rb_define_method(c_fetch_action_failure, "requires_manual_fetching?",
- RUBY_FUNC_CAST((&KCFetch<FetchActionFailure, k::requires_manual_fetching, bool>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::requires_manual_fetching, bool,
+ &FetchActionFailure::requires_manual_fetching>::fetch)), 0);
rb_define_method(c_fetch_action_failure, "failed_automatic_fetching?",
- RUBY_FUNC_CAST((&KCFetch<FetchActionFailure, k::failed_automatic_fetching, bool>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::failed_automatic_fetching, bool,
+ &FetchActionFailure::failed_automatic_fetching>::fetch)), 0);
rb_define_method(c_fetch_action_failure, "failed_integrity_checks",
- RUBY_FUNC_CAST((&KCFetch<FetchActionFailure, k::failed_integrity_checks, std::string>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetch<FetchActionFailure, n::failed_integrity_checks, std::string,
+ &FetchActionFailure::failed_integrity_checks>::fetch)), 0);
/*
* Document-class: Paludis::InfoAction
@@ -751,9 +757,11 @@ namespace
rb_define_singleton_method(c_install_action_options, "new", RUBY_FUNC_CAST(&install_action_options_new), -1);
rb_define_method(c_install_action_options, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
rb_define_method(c_install_action_options, "debug_build",
- RUBY_FUNC_CAST((&KCFetchEnum<InstallActionOptions, k::debug_build>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetchEnum<InstallActionOptions, n::debug_build, InstallActionDebugOption,
+ &InstallActionOptions::debug_build>::fetch)), 0);
rb_define_method(c_install_action_options, "checks",
- RUBY_FUNC_CAST((&KCFetchEnum<InstallActionOptions, k::checks>::fetch)), 0);
+ RUBY_FUNC_CAST((&NVFetchEnum<InstallActionOptions, n::checks, InstallActionChecksOption,
+ &InstallActionOptions::checks>::fetch)), 0);
rb_define_method(c_install_action_options, "destination", RUBY_FUNC_CAST(&install_action_options_destination), 0);
/*
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index a925f4d..84a0de8 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -21,7 +21,6 @@
#include <paludis_ruby.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/visitor-impl.hh>
-#include <paludis/util/kc.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
@@ -515,7 +514,7 @@ namespace
{
std::tr1::shared_ptr<const RepositoryMaskInfo> * ptr;
Data_Get_Struct(self, std::tr1::shared_ptr<const RepositoryMaskInfo>, ptr);
- return rb_str_new2(stringify((**ptr)[k::mask_file()]).c_str());
+ return rb_str_new2(stringify((**ptr).mask_file()).c_str());
}
/*
@@ -530,8 +529,8 @@ namespace
std::tr1::shared_ptr<const RepositoryMaskInfo> * ptr;
Data_Get_Struct(self, std::tr1::shared_ptr<const RepositoryMaskInfo>, ptr);
VALUE result(rb_ary_new());
- for (Sequence<std::string>::ConstIterator it((**ptr)[k::comment()]->begin()),
- it_end((**ptr)[k::comment()]->end()); it_end != it; ++it)
+ for (Sequence<std::string>::ConstIterator it((**ptr).comment()->begin()),
+ it_end((**ptr).comment()->end()); it_end != it; ++it)
rb_ary_push(result, rb_str_new2(it->c_str()));
return result;
}
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 07e49ea..4502f8f 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -21,7 +21,6 @@
#include <paludis/paludis.hh>
#include <paludis_ruby.hh>
#include <paludis/util/config_file.hh>
-#include <paludis/util/kc.hh>
#include <paludis/dep_list_exceptions.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/instantiation_policy-impl.hh>
diff --git a/ruby/repository.cc b/ruby/repository.cc
index eb2ba9e..c2a1eea 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -377,14 +377,14 @@ namespace
*
* Returns self if the repository supports the interface, otherwise Nil.
*/
- template <typename T_>
+ template <typename T_, typename R_, NamedValue<T_, R_ *> (RepositoryCapabilities::* f_)>
struct Interface
{
static VALUE fetch(VALUE self)
{
std::tr1::shared_ptr<Repository> * self_ptr;
Data_Get_Struct(self, std::tr1::shared_ptr<Repository>, self_ptr);
- return ((**self_ptr)[T_()]) ? self : Qnil;
+ return ((**self_ptr).*f_)() ? self : Qnil;
}
};
@@ -441,7 +441,7 @@ namespace
{
std::tr1::shared_ptr<Repository> * self_ptr;
Data_Get_Struct(self, std::tr1::shared_ptr<Repository>, self_ptr);
- RepositoryUseInterface * const use_interface ((**self_ptr)[k::use_interface()]);
+ RepositoryUseInterface * const use_interface ((**self_p