aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-10-24 09:32:40 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-10-24 09:32:40 +0100
commit7cd0c2d122a5b38c5a925dac52b429c99e7f5085 (patch)
tree3263a593a314a0f91c8d14005b61a8a134325ae1
parent95de300935276509248c6ad2f6a08bf458ef290c (diff)
downloadpaludis-7cd0c2d122a5b38c5a925dac52b429c99e7f5085.tar.gz
paludis-7cd0c2d122a5b38c5a925dac52b429c99e7f5085.tar.xz
Paludis is about choices.
-rw-r--r--doc/api/cplusplus/examples/example_environment.cc19
-rw-r--r--doc/api/cplusplus/examples/example_formatter.cc10
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc20
-rw-r--r--doc/api/cplusplus/examples/example_stringify_formatter.cc7
-rw-r--r--doc/api/cplusplus/groups.doxygen14
-rw-r--r--doc/api/ruby/create_ruby_doc.rb8
-rw-r--r--paludis/action-fwd.hh4
-rw-r--r--paludis/action.cc2
-rw-r--r--paludis/action.hh4
-rw-r--r--paludis/action.se45
-rw-r--r--paludis/args/Makefile.am4
-rw-r--r--paludis/args/checks_arg.cc52
-rw-r--r--paludis/args/checks_arg.hh67
-rw-r--r--paludis/args/debug_build_arg.cc53
-rw-r--r--paludis/args/debug_build_arg.hh67
-rw-r--r--paludis/args/install_args_group.cc8
-rw-r--r--paludis/args/install_args_group.hh8
-rw-r--r--paludis/choice-fwd.hh69
-rw-r--r--paludis/choice.cc288
-rw-r--r--paludis/choice.hh349
-rw-r--r--paludis/dep_list.cc44
-rw-r--r--paludis/dep_list_TEST.cc268
-rw-r--r--paludis/dep_spec-fwd.hh9
-rw-r--r--paludis/dep_spec.cc35
-rw-r--r--paludis/dep_spec.hh21
-rw-r--r--paludis/dep_spec_flattener.cc6
-rw-r--r--paludis/dep_spec_flattener.hh41
-rw-r--r--paludis/dep_tree.hh8
-rw-r--r--paludis/elike_choices-fwd.hh39
-rw-r--r--paludis/elike_choices.cc260
-rw-r--r--paludis/elike_choices.hh116
-rw-r--r--paludis/elike_conditional_dep_spec-fwd.hh6
-rw-r--r--paludis/elike_conditional_dep_spec.cc75
-rw-r--r--paludis/elike_use_requirement.cc107
-rw-r--r--paludis/elike_use_requirement_TEST.cc54
-rw-r--r--paludis/environment.hh36
-rw-r--r--paludis/environment_implementation.cc29
-rw-r--r--paludis/environment_implementation.hh3
-rw-r--r--paludis/environments/no_config/no_config_environment.cc26
-rw-r--r--paludis/environments/no_config/no_config_environment.hh17
-rw-r--r--paludis/environments/paludis/paludis_environment.cc84
-rw-r--r--paludis/environments/paludis/paludis_environment.hh20
-rw-r--r--paludis/environments/paludis/paludis_environment_TEST.cc90
-rw-r--r--paludis/environments/paludis/use_conf.cc163
-rw-r--r--paludis/environments/paludis/use_conf.hh20
-rw-r--r--paludis/environments/paludis/use_config_entry.sr35
-rw-r--r--paludis/environments/portage/Makefile.am16
-rw-r--r--paludis/environments/portage/portage_environment.cc78
-rw-r--r--paludis/environments/portage/portage_environment.hh12
-rw-r--r--paludis/environments/portage/portage_environment_TEST.cc51
-rwxr-xr-xpaludis/environments/portage/portage_environment_TEST_setup.sh10
-rw-r--r--paludis/environments/test/test_environment.cc50
-rw-r--r--paludis/environments/test/test_environment.hh21
-rw-r--r--paludis/files.m46
-rw-r--r--paludis/formatter.hh157
-rw-r--r--paludis/install_task.cc14
-rw-r--r--paludis/install_task.hh2
-rw-r--r--paludis/metadata_key-fwd.hh1
-rw-r--r--paludis/metadata_key.cc10
-rw-r--r--paludis/metadata_key.hh56
-rw-r--r--paludis/name-fwd.hh44
-rw-r--r--paludis/name.cc142
-rw-r--r--paludis/name.hh54
-rw-r--r--paludis/name.sr24
-rw-r--r--paludis/name_TEST.cc40
-rw-r--r--paludis/package_id.hh15
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc1
-rw-r--r--paludis/repositories/cran/cran_package_id.cc12
-rw-r--r--paludis/repositories/cran/cran_package_id.hh2
-rw-r--r--paludis/repositories/cran/cran_repository.cc1
-rw-r--r--paludis/repositories/e/Makefile.am17
-rw-r--r--paludis/repositories/e/dep_parser.cc73
-rw-r--r--paludis/repositories/e/dep_parser.hh11
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc35
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.hh2
-rw-r--r--paludis/repositories/e/e_choice_value.cc77
-rw-r--r--paludis/repositories/e/e_choice_value.hh68
-rw-r--r--paludis/repositories/e/e_installed_repository.cc69
-rw-r--r--paludis/repositories/e/e_installed_repository.hh31
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc125
-rw-r--r--paludis/repositories/e/e_installed_repository_id.hh14
-rw-r--r--paludis/repositories/e/e_key.cc646
-rw-r--r--paludis/repositories/e/e_key.hh105
-rw-r--r--paludis/repositories/e/e_repository.cc237
-rw-r--r--paludis/repositories/e/e_repository.hh36
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc40
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh13
-rw-r--r--paludis/repositories/e/e_repository_id.hh14
-rw-r--r--paludis/repositories/e/e_repository_profile.cc252
-rw-r--r--paludis/repositories/e/e_repository_profile.hh38
-rw-r--r--paludis/repositories/e/e_stripper.cc5
-rw-r--r--paludis/repositories/e/e_stripper.hh6
-rw-r--r--paludis/repositories/e/eapi.cc8
-rw-r--r--paludis/repositories/e/eapi.hh13
-rw-r--r--paludis/repositories/e/eapis/0.conf14
-rw-r--r--paludis/repositories/e/eapis/2.conf2
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf24
-rw-r--r--paludis/repositories/e/eapis/kdebuild-1.conf4
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf12
-rw-r--r--paludis/repositories/e/eapis/pbin-1+0.conf2
-rw-r--r--paludis/repositories/e/eapis/pbin-1+1.conf2
-rw-r--r--paludis/repositories/e/eapis/pbin-1+exheres-0.conf2
-rw-r--r--paludis/repositories/e/eapis/pbin-1+paludis-1.conf2
-rw-r--r--paludis/repositories/e/ebuild.cc15
-rw-r--r--paludis/repositories/e/ebuild.hh5
-rw-r--r--paludis/repositories/e/ebuild_entries.cc162
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc17
-rw-r--r--paludis/repositories/e/ebuild_id.cc181
-rw-r--r--paludis/repositories/e/ebuild_id.hh16
-rw-r--r--paludis/repositories/e/exheres_layout.cc5
-rw-r--r--paludis/repositories/e/exndbam_repository.cc1
-rw-r--r--paludis/repositories/e/exndbam_repository_TEST.cc2
-rw-r--r--paludis/repositories/e/glsa.cc6
-rw-r--r--paludis/repositories/e/glsa.hh4
-rw-r--r--paludis/repositories/e/iuse.cc46
-rw-r--r--paludis/repositories/e/iuse.hh45
-rw-r--r--paludis/repositories/e/iuse.se (renamed from paludis/name.se)18
-rw-r--r--paludis/repositories/e/qa/extractors.cc62
-rw-r--r--paludis/repositories/e/qa/iuse_key.cc42
-rw-r--r--paludis/repositories/e/qa/metadata_keys.cc9
-rw-r--r--paludis/repositories/e/qa/restrict_key.cc8
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc104
-rw-r--r--paludis/repositories/e/qa/spec_keys_TEST.cc11
-rw-r--r--paludis/repositories/e/qa/visibility.cc46
-rwxr-xr-xpaludis/repositories/e/qa/visibility_TEST_setup.sh12
-rw-r--r--paludis/repositories/e/traditional_layout.cc7
-rw-r--r--paludis/repositories/e/use_desc.cc46
-rw-r--r--paludis/repositories/e/use_desc.hh12
-rw-r--r--paludis/repositories/e/vdb_repository.cc1
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc22
-rwxr-xr-xpaludis/repositories/e/vdb_repository_TEST_setup.sh6
-rw-r--r--paludis/repositories/e/xml_things.cc2
-rw-r--r--paludis/repositories/fake/dep_parser.cc2
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc1
-rw-r--r--paludis/repositories/fake/fake_package_id.cc247
-rw-r--r--paludis/repositories/fake/fake_package_id.hh41
-rw-r--r--paludis/repositories/fake/fake_repository.cc2
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc58
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh31
-rw-r--r--paludis/repositories/gems/gem_specification.cc12
-rw-r--r--paludis/repositories/gems/gem_specification.hh2
-rw-r--r--paludis/repositories/gems/gems_repository.cc1
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc1
-rw-r--r--paludis/repositories/unavailable/unavailable_id.cc12
-rw-r--r--paludis/repositories/unavailable/unavailable_id.hh2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc1
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc11
-rw-r--r--paludis/repositories/unpackaged/installed_id.hh2
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc1
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc6
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc34
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.hh2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc55
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.hh18
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_stripper.cc5
-rw-r--r--paludis/repositories/unpackaged/unpackaged_stripper.hh6
-rw-r--r--paludis/repositories/unwritten/unwritten_id.cc11
-rw-r--r--paludis/repositories/unwritten/unwritten_id.hh2
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.cc1
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc1
-rw-r--r--paludis/repositories/virtuals/package_id.cc12
-rw-r--r--paludis/repositories/virtuals/package_id.hh2
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc1
-rw-r--r--paludis/repository-fwd.hh1
-rw-r--r--paludis/repository.cc4
-rw-r--r--paludis/repository.hh68
-rw-r--r--paludis/stringify_formatter-impl.hh16
-rw-r--r--paludis/stringify_formatter.cc187
-rw-r--r--paludis/stringify_formatter.hh28
-rw-r--r--paludis/stringify_formatter_TEST.cc10
-rw-r--r--paludis/stripper.cc18
-rw-r--r--paludis/stripper.hh6
-rw-r--r--paludis/stripper_TEST.cc5
-rw-r--r--python/action.cc29
-rwxr-xr-xpython/action_TEST.py14
-rw-r--r--python/additional_tests.cc58
-rw-r--r--python/dep_spec.cc31
-rw-r--r--python/dep_spec.hh15
-rw-r--r--python/environment.cc65
-rwxr-xr-xpython/environment_TEST.py16
-rw-r--r--python/formatter.cc138
-rwxr-xr-xpython/formatter_TEST.py84
-rw-r--r--python/metadata_key.cc108
-rwxr-xr-xpython/metadata_key_TEST.py36
-rw-r--r--python/name.cc79
-rwxr-xr-xpython/name_TEST.py15
-rw-r--r--python/nice_names.nn8
-rw-r--r--python/package_id.cc6
-rw-r--r--python/repository.cc45
-rwxr-xr-xpython/repository_TEST.py32
-rw-r--r--ruby/Makefile.am3
-rw-r--r--ruby/action.cc103
-rw-r--r--ruby/action_TEST.rb12
-rw-r--r--ruby/choice.cc477
-rw-r--r--ruby/choice_TEST.rb199
-rwxr-xr-xruby/choice_TEST_cleanup.sh9
-rwxr-xr-xruby/choice_TEST_setup.sh37
-rw-r--r--ruby/dep_spec.cc24
-rw-r--r--ruby/environment.cc22
-rw-r--r--ruby/environment_TEST.rb45
-rw-r--r--ruby/metadata_key.cc66
-rw-r--r--ruby/name.cc13
-rw-r--r--ruby/nice_names.nn1
-rw-r--r--ruby/package_id.cc19
-rw-r--r--ruby/package_id_TEST.rb43
-rw-r--r--ruby/paludis_ruby.cc14
-rw-r--r--ruby/paludis_ruby.hh9
-rw-r--r--ruby/repository.cc130
-rw-r--r--ruby/repository_TEST.rb94
-rw-r--r--src/clients/accerso/command_line.hh2
-rw-r--r--src/clients/adjutrix/find_unused_packages.cc3
-rw-r--r--src/clients/adjutrix/keywords_graph.cc44
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc3
-rw-r--r--src/clients/importare/command_line.cc1
-rw-r--r--src/clients/inquisitio/key_extractor.cc50
-rw-r--r--src/clients/instruo/command_line.hh2
-rw-r--r--src/clients/instruo/instruo.cc9
-rw-r--r--src/clients/paludis/applets.cc18
-rw-r--r--src/clients/paludis/info.cc15
-rwxr-xr-xsrc/clients/paludis/install_TEST22
-rwxr-xr-xsrc/clients/paludis/install_TEST_setup.sh54
-rw-r--r--src/clients/qualudis/qualudis.cc15
-rw-r--r--src/output/Makefile.am10
-rw-r--r--src/output/colour_formatter.cc228
-rw-r--r--src/output/colour_formatter.hh40
-rw-r--r--src/output/console_install_task.cc445
-rw-r--r--src/output/console_install_task.hh45
-rw-r--r--src/output/console_install_task.sr15
-rw-r--r--src/output/console_query_task.cc142
-rw-r--r--src/output/mask_displayer.cc17
-rwxr-xr-xtest/run_test.sh2
233 files changed, 5619 insertions, 5034 deletions
diff --git a/doc/api/cplusplus/examples/example_environment.cc b/doc/api/cplusplus/examples/example_environment.cc
index 966c536..3513c27 100644
--- a/doc/api/cplusplus/examples/example_environment.cc
+++ b/doc/api/cplusplus/examples/example_environment.cc
@@ -51,10 +51,9 @@ int main(int argc, char * argv[])
* called directly from clients. The system information and mirror
* functions are mostly for use by Repository subclasses. The []
* operator is covered in \ref example_selection.cc
- * "example_selection.cc". That leaves the package database, sets and
- * (currently, although this may well change in the future) use flag
- * queries. The package database has its own examples, so we'll start
- * with sets: */
+ * "example_selection.cc". That leaves the package database and sets.
+ * The package database has its own examples, so we'll start with sets:
+ * */
std::tr1::shared_ptr<SetSpecTree::ConstItem> world(env->set(SetName("world")));
if (world)
@@ -65,18 +64,6 @@ int main(int argc, char * argv[])
}
else
cout << "No world set defined" << endl;
-
- /* And use flags, for which we need a package IDs: */
- std::tr1::shared_ptr<const PackageIDSequence> ids((*env)[selection::BestVersionOnly(
- generator::Matches(make_package_dep_spec().package(QualifiedPackageName("sys-apps/paludis"))) |
- filter::SupportsAction<InstalledAction>())]);
-
- if (! ids->empty())
- {
- UseFlagName u("ruby");
- cout << "Use flag '" << u << "' for ID '" << **ids->rbegin() << "' is "
- << (env->query_use(u, **ids->rbegin()) ? "enabled" : "disabled") << endl;
- }
}
catch (const Exception & e)
{
diff --git a/doc/api/cplusplus/examples/example_formatter.cc b/doc/api/cplusplus/examples/example_formatter.cc
index 263aa25..fdb5a0a 100644
--- a/doc/api/cplusplus/examples/example_formatter.cc
+++ b/doc/api/cplusplus/examples/example_formatter.cc
@@ -107,6 +107,16 @@ namespace
return span_colour(escape_html(stringify(s)), "#66ff66");
}
+ std::string decorate(const ConditionalDepSpec &, const std::string & s, const format::Added &) const
+ {
+ return s;
+ }
+
+ std::string decorate(const ConditionalDepSpec &, const std::string & s, const format::Changed &) const
+ {
+ return s;
+ }
+
std::string format(const ConditionalDepSpec & s, const format::Disabled &) const
{
return span_colour(escape_html(stringify(s)), "#ff6666");
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index adaea1c..8bf1b11 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -104,6 +104,14 @@ namespace
* example_contents.cc "example_contents.cc" for that. */
}
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > &)
+ {
+ cout << indent << left << setw(30) << " Class:" << " " <<
+ "MetadataValueKey<std::tr1::shared_ptr<const Choices> > " << endl;
+ /* We won't display the contents of the choices key here, since
+ * it has its own examples. */
+ }
+
void visit(const MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > & key)
{
cout << indent << left << setw(30) << " Class:" << " " <<
@@ -167,24 +175,12 @@ namespace
cout << indent << left << setw(30) << " Initial label:" << " " << key.initial_label()->text() << endl;
}
- void visit(const MetadataCollectionKey<IUseFlagSet> & key)
- {
- cout << indent << left << setw(30) << " Class:" << " " << "MetadataSpecTreeKey<IUseFlagSet>" << endl;
- cout << indent << left << setw(30) << " Value:" << " " << key.pretty_print_flat(formatter) << endl;
- }
-
void visit(const MetadataCollectionKey<KeywordNameSet> & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<KeywordNameSet>" << endl;
cout << indent << left << setw(30) << " Value:" << " " << key.pretty_print_flat(formatter) << endl;
}
- void visit(const MetadataCollectionKey<UseFlagNameSet> & key)
- {
- cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<UseFlagNameSet>" << endl;
- cout << indent << left << setw(30) << " Value:" << " " << key.pretty_print_flat(formatter) << endl;
- }
-
void visit(const MetadataCollectionKey<Set<std::string> > & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Set<std::string> >" << endl;
diff --git a/doc/api/cplusplus/examples/example_stringify_formatter.cc b/doc/api/cplusplus/examples/example_stringify_formatter.cc
index f6d6332..dcd5176 100644
--- a/doc/api/cplusplus/examples/example_stringify_formatter.cc
+++ b/doc/api/cplusplus/examples/example_stringify_formatter.cc
@@ -52,13 +52,6 @@ int main(int argc, char * argv[])
* formatter for all of the keys. */
StringifyFormatter formatter;
- /* We need to check that _key() methods don't return zero. */
- if ((*i)->iuse_key())
- {
- cout << " " << (*i)->iuse_key()->human_name() << ":" << endl;
- cout << " " << (*i)->iuse_key()->pretty_print_flat(formatter) << endl;
- }
-
if ((*i)->keywords_key())
{
cout << " " << (*i)->keywords_key()->human_name() << ":" << endl;
diff --git a/doc/api/cplusplus/groups.doxygen b/doc/api/cplusplus/groups.doxygen
index a29b187..a44e6d0 100644
--- a/doc/api/cplusplus/groups.doxygen
+++ b/doc/api/cplusplus/groups.doxygen
@@ -30,6 +30,20 @@ using namespace paludis;
* - \ref example_action.cc "example_action.cc"
*/
+/** \defgroup g_choices Choices
+ *
+ * \ingroup g_package_id
+ *
+ * Choices represent things like USE flags, the various USE_EXPAND values
+ * (LINGUAS, VIDEO_CARDS etc) and fancy things like build_options.
+ *
+ * \since 0.32
+ *
+ * \section Examples
+ *
+ * - None at this time.
+ */
+
/** \defgroup g_contents Contents
*
* \ingroup g_metadata_key
diff --git a/doc/api/ruby/create_ruby_doc.rb b/doc/api/ruby/create_ruby_doc.rb
index 670decb..84db5cd 100644
--- a/doc/api/ruby/create_ruby_doc.rb
+++ b/doc/api/ruby/create_ruby_doc.rb
@@ -44,14 +44,16 @@ module RDoc
end
next
end
+ line.gsub!(/FAKE_RDOC_METHOD\(([a-zA-Z0-9_\-]+)\);/) {|match| "VALUE #{$1}(VALUE self) { }"}
if line =~ /rb_define/
#help rdoc recognise normal methods
line.gsub!('&','')
line.gsub!(/RUBY_FUNC_CAST\(*([^)]+)\)*/) {|match| $1}
+ line.gsub!(/RDOC_IS_STUPID\((\w+),.*, ([0-9\-])+\);/) {|match| "#{$1}, #{$2})"}
#help rdoc recognise template methods
- line.gsub!(/\w+<\s*\w+(::\w+)*(,\s*\w+)*(::\w+)?>::\w+/,'template_methods')
- #catch more templates
- line.gsub!(/\w+\s*<\s*\w+\s*<\s*\w+\s*>,\s*\w+::\w+>::\w+/, 'template_methods')
+ line.gsub!(/[a-zA-Z0-9\-_:]+<\s*[a-zA-Z0-9\-_:]+(::[a-zA-Z0-9\-_:]+)*(,\s*[a-zA-Z0-9\-_:]+)*(::[a-zA-Z0-9\-_:]+)?>::[a-zA-Z0-9\-_:]+/,'template_methods')
+ line.gsub!(/[a-zA-Z0-9\-_:]+\s*<\s*[a-zA-Z0-9\-_:]+\s*<\s*[a-zA-Z0-9\-_:]+\s*>,\s*[a-zA-Z0-9\-_:]+::[a-zA-Z0-9\-_:]+>::[a-zA-Z0-9\-_:]+/, 'template_methods')
+ line.gsub!(/[a-zA-Z0-9\-_:]+\s*<\s*[a-zA-Z0-9\-_:]+\s*<\s*[a-zA-Z0-9\-_:]+\s*<[^>]+>\s*>,\s*[a-zA-Z0-9\-_:]+::[a-zA-Z0-9\-_:]+>::[a-zA-Z0-9\-_:]+/, 'template_methods')
end
new_body+= line
end
diff --git a/paludis/action-fwd.hh b/paludis/action-fwd.hh
index 85d3ad5..3ae5504 100644
--- a/paludis/action-fwd.hh
+++ b/paludis/action-fwd.hh
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_ACTION_FWD_HH
#define PALUDIS_GUARD_PALUDIS_ACTION_FWD_HH 1
-#include <iosfwd>
#include <paludis/util/attributes.hh>
#include <tr1/memory>
@@ -61,9 +60,6 @@ namespace paludis
struct UninstallActionOptions;
struct FetchActionFailure;
-
-#include <paludis/action-se.hh>
-
}
#endif
diff --git a/paludis/action.cc b/paludis/action.cc
index d151ace..d1620bd 100644
--- a/paludis/action.cc
+++ b/paludis/action.cc
@@ -26,8 +26,6 @@
using namespace paludis;
-#include <paludis/action-se.cc>
-
Action::~Action()
{
}
diff --git a/paludis/action.hh b/paludis/action.hh
index 6bd6518..85fd140 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -46,9 +46,7 @@ namespace paludis
{
namespace n
{
- struct checks;
struct config_protect;
- struct debug_build;
struct destination;
struct failed_automatic_fetching;
struct failed_integrity_checks;
@@ -81,8 +79,6 @@ namespace paludis
*/
struct InstallActionOptions
{
- NamedValue<n::checks, InstallActionChecksOption> checks;
- NamedValue<n::debug_build, InstallActionDebugOption> debug_build;
NamedValue<n::destination, std::tr1::shared_ptr<Repository> > destination;
NamedValue<n::used_this_for_config_protect, std::tr1::function<void (const std::string &)> > used_this_for_config_protect;
};
diff --git a/paludis/action.se b/paludis/action.se
deleted file mode 100644
index d549eb4..0000000
--- a/paludis/action.se
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et ft=sh :
-
-make_enum_InstallActionDebugOption()
-{
- prefix iado
-
- key iado_none "No debugging"
- key iado_split "Split debugging"
- key iado_internal "Internal debugging"
-
- doxygen_comment << "END"
- /**
- * Debug build mode for an InstallAction.
- *
- * May be ignored by some repositories, and by packages where there
- * isn't a sensible concept of debugging.
- *
- * \see InstallAction
- * \ingroup g_actions
- * \since 0.26
- */
-END
-}
-
-make_enum_InstallActionChecksOption()
-{
- prefix iaco
-
- key iaco_none "No checks"
- key iaco_default "Checks where they would usually be carried out"
- key iaco_always "Always use checks"
-
- doxygen_comment << "END"
- /**
- * Whether to run post-build checks (for example, 'make check' or 'src_test'),
- * if they are available.
- *
- * \see InstallAction
- * \ingroup g_actions
- * \since 0.26
- */
-END
-}
-
diff --git a/paludis/args/Makefile.am b/paludis/args/Makefile.am
index ae4f501..908f4b8 100644
--- a/paludis/args/Makefile.am
+++ b/paludis/args/Makefile.am
@@ -17,8 +17,6 @@ paludis_args_include_HEADERS = \
args_visitor.hh \
args_dumper.hh \
man.hh \
- checks_arg.hh \
- debug_build_arg.hh \
deps_option_arg.hh \
log_level_arg.hh \
dep_list_args_group.hh \
@@ -34,8 +32,6 @@ libpaludisargs_@PALUDIS_PC_SLOT@_la_SOURCES = \
bad_argument.cc \
args_visitor.cc \
args_dumper.cc \
- checks_arg.cc \
- debug_build_arg.cc \
deps_option_arg.cc \
log_level_arg.cc \
dep_list_args_group.cc \
diff --git a/paludis/args/checks_arg.cc b/paludis/args/checks_arg.cc
deleted file mode 100644
index 33adb97..0000000
--- a/paludis/args/checks_arg.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 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
- */
-
-#include "checks_arg.hh"
-#include "do_help.hh"
-
-using namespace paludis;
-using namespace paludis::args;
-
-ChecksArg::ChecksArg(ArgsGroup * const grp, const std::string & ln, char sh) :
- EnumArg(grp, ln, sh, "Whether to run post-build checks",
- EnumArgOptions
- ("none", "Don't run checks, even if they should be run")
- ("default", "Run checks if they should be run by default")
- ("always", "Always run checks"),
- "default")
-{
-}
-
-ChecksArg::~ChecksArg()
-{
-}
-
-InstallActionChecksOption
-ChecksArg::option() const
-{
- if ("none" == argument())
- return iaco_none;
- if ("default" == argument())
- return iaco_default;
- if ("always" == argument())
- return iaco_always;
-
- throw DoHelp("Bad value for --" + long_name());
-}
-
diff --git a/paludis/args/checks_arg.hh b/paludis/args/checks_arg.hh
deleted file mode 100644
index 11689b0..0000000
--- a/paludis/args/checks_arg.hh
+++ /dev/null
@@ -1,67 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 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_SRC_COMMON_ARGS_CHECKS_ARG_HH
-#define PALUDIS_GUARD_SRC_COMMON_ARGS_CHECKS_ARG_HH 1
-
-#include <paludis/args/args_option.hh>
-#include <paludis/action-fwd.hh>
-
-/** \file
- * Declarations for the Checks class.
- *
- * \ingroup g_args
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- namespace args
- {
- /**
- * The '--checks' standard command line argument.
- *
- * \since 0.26
- * \ingroup g_args
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE ChecksArg :
- public EnumArg
- {
- public:
- ///\name Basic operations
- ///\{
-
- ChecksArg(ArgsGroup * const, const std::string &, char);
- ~ChecksArg();
-
- ///\}
-
- /**
- * Our selected value, as an InstallActionChecksOption.
- */
- InstallActionChecksOption option() const;
- };
- }
-}
-
-#endif
diff --git a/paludis/args/debug_build_arg.cc b/paludis/args/debug_build_arg.cc
deleted file mode 100644
index 57a7ee9..0000000
--- a/paludis/args/debug_build_arg.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 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
- */
-
-#include "debug_build_arg.hh"
-#include "do_help.hh"
-
-using namespace paludis;
-using namespace paludis::args;
-
-DebugBuildArg::DebugBuildArg(ArgsGroup * const grp, const std::string & ln,
- char sh) :
- EnumArg(grp, ln, sh, "What to do with debug information",
- EnumArgOptions
- ("none", "Discard debug information")
- ("split", "Split debug information")
- ("internal", "Keep debug information"),
- "split")
-{
-}
-
-DebugBuildArg::~DebugBuildArg()
-{
-}
-
-InstallActionDebugOption
-DebugBuildArg::option() const
-{
- if ("none" == argument())
- return iado_none;
- if ("split" == argument())
- return iado_split;
- if ("internal" == argument())
- return iado_internal;
-
- throw DoHelp("Bad value for --" + long_name());
-}
-
diff --git a/paludis/args/debug_build_arg.hh b/paludis/args/debug_build_arg.hh
deleted file mode 100644
index e523150..0000000
--- a/paludis/args/debug_build_arg.hh
+++ /dev/null
@@ -1,67 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 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_SRC_COMMON_ARGS_DEBUG_BUILD_ARG_HH
-#define PALUDIS_GUARD_SRC_COMMON_ARGS_DEBUG_BUILD_ARG_HH 1
-
-#include <paludis/args/args_option.hh>
-#include <paludis/repository.hh>
-
-/** \file
- * Declarations for the DebugBuildArg class.
- *
- * \ingroup g_args
- *
- * \section Examples
- *
- * - None at this time.
- */
-
-namespace paludis
-{
- namespace args
- {
- /**
- * The '--debug-build' standard command line argument.
- *
- * \since 0.26
- * \ingroup g_args
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE DebugBuildArg :
- public EnumArg
- {
- public:
- ///\name Basic operations
- ///\{
-
- DebugBuildArg(ArgsGroup * const, const std::string &, char);
- ~DebugBuildArg();
-
- ///\}
-
- /**
- * Our selected value, as an InstallActionDebugOption.
- */
- InstallActionDebugOption option() const;
- };
- }
-}
-
-#endif
diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc
index a7d30bf..2acc4a8 100644
--- a/paludis/args/install_args_group.cc
+++ b/paludis/args/install_args_group.cc
@@ -36,8 +36,6 @@ InstallArgsGroup::InstallArgsGroup(ArgsHandler * h, const std::string & our_name
a_preserve_world(this, "preserve-world", '1', "Don't modify the world file", true),
a_add_to_world_spec(this, "add-to-world-spec", '\0',
"Use this spec, rather than all targets, for updating world (for resume commands)"),
- a_debug_build(this, "debug-build", '\0'),
- a_checks(this, "checks", '\0'),
a_fetch(this, "fetch", 'f', "Only fetch sources; don't install anything", false),
a_no_safe_resume(this, "no-safe-resume", '\0', "Do not allow interrupted downloads to be resumed", false),
a_show_reasons(this, "show-reasons", '\0', "Show why packages are being (un)installed",
@@ -118,9 +116,6 @@ InstallArgsGroup::populate_install_task(const Environment *, InstallTask & task)
if (a_add_to_world_spec.specified())
task.set_add_to_world_spec(a_add_to_world_spec.argument());
- task.set_debug_mode(a_debug_build.option());
- task.set_checks_mode(a_checks.option());
-
if (a_continue_on_failure.argument() == "if-fetch-only")
task.set_continue_on_failure(itcof_if_fetch_only);
else if (a_continue_on_failure.argument() == "never")
@@ -202,9 +197,6 @@ InstallArgsGroup::paludis_command_fragment() const
if (a_preserve_world.specified())
paludis_command.append(" --" + a_preserve_world.long_name());
- if (a_debug_build.specified())
- paludis_command.append(" --" + a_debug_build.long_name() + " " + a_debug_build.argument());
-
if (a_no_safe_resume.specified())
paludis_command.append(" --" + a_no_safe_resume.long_name());
diff --git a/paludis/args/install_args_group.hh b/paludis/args/install_args_group.hh
index e16acee..fa7dfea 100644
--- a/paludis/args/install_args_group.hh
+++ b/paludis/args/install_args_group.hh
@@ -24,8 +24,6 @@
#include <paludis/util/set.hh>
#include <paludis/args/args.hh>
-#include <paludis/args/checks_arg.hh>
-#include <paludis/args/debug_build_arg.hh>
#include <paludis/dep_list-fwd.hh>
#include <paludis/install_task.hh>
@@ -74,12 +72,6 @@ namespace paludis
/// --add-to-world-spec
paludis::args::StringArg a_add_to_world_spec;
- /// --debug-build
- paludis::args::DebugBuildArg a_debug_build;
-
- /// --checks
- paludis::args::ChecksArg a_checks;
-
/// --fetch
paludis::args::SwitchArg a_fetch;
diff --git a/paludis/choice-fwd.hh b/paludis/choice-fwd.hh
new file mode 100644
index 0000000..1c84602
--- /dev/null
+++ b/paludis/choice-fwd.hh
@@ -0,0 +1,69 @@
+/* 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_CHOICE_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_CHOICE_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/validated-fwd.hh>
+
+/** \file
+ * Forward declarations for paludis/choice.hh .
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+
+namespace paludis
+{
+ class Choices;
+
+ class Choice;
+ class ChoiceValue;
+
+ struct ChoicePrefixNameValidator;
+ struct ChoiceNameWithPrefixValidator;
+ struct UnprefixedChoiceNameValidator;
+
+ /**
+ * A prefix for a choice name ('' for USE, 'linguas' for LINGUAS etc).
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ typedef Validated<std::string, ChoicePrefixNameValidator> ChoicePrefixName;
+
+ /**
+ * A choice name, including prefix and delim ('nls' for USE, 'linguas_en' for LINGUAS etc).
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ typedef Validated<std::string, ChoiceNameWithPrefixValidator> ChoiceNameWithPrefix;
+
+ /**
+ * A choice name, without prefix or delim ('nls' for USE, 'en' for LINGUAS etc).
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ typedef Validated<std::string, UnprefixedChoiceNameValidator> UnprefixedChoiceName;
+}
+
+#endif
diff --git a/paludis/choice.cc b/paludis/choice.cc
new file mode 100644
index 0000000..c7a1a69
--- /dev/null
+++ b/paludis/choice.cc
@@ -0,0 +1,288 @@
+/* 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
+ */
+
+#include <paludis/choice.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/validated.hh>
+#include <paludis/util/set-impl.hh>
+#include <list>
+
+using namespace paludis;
+
+ChoicePrefixNameError::ChoicePrefixNameError(const std::string & n) throw () :
+ NameError(n, "choice prefix name")
+{
+}
+
+void
+ChoicePrefixNameValidator::validate(const std::string & s)
+{
+ if (! s.empty())
+ {
+ switch (s.at(s.length() - 1))
+ {
+ case ':':
+ case '_':
+ throw ChoicePrefixNameError(s);
+ break;
+ };
+
+ if (s[0] >= 'A' && s[0] <= 'Z')
+ throw ChoicePrefixNameError(s);
+
+ if (std::string::npos != s.find(" \t\r\n"))
+ throw ChoicePrefixNameError(s);
+ }
+}
+
+ChoiceNameWithPrefixError::ChoiceNameWithPrefixError(const std::string & n) throw () :
+ NameError(n, "choice name with prefix")
+{
+}
+
+void
+ChoiceNameWithPrefixValidator::validate(const std::string & s)
+{
+ if (s.empty())
+ throw ChoiceNameWithPrefixError(s);
+
+ switch (s.at(s.length() - 1))
+ {
+ case ':':
+ case '_':
+ throw ChoiceNameWithPrefixError(s);
+ break;
+ };
+
+ if (std::string::npos != s.find(" \t\r\n"))
+ throw ChoiceNameWithPrefixError(s);
+}
+
+UnprefixedChoiceNameError::UnprefixedChoiceNameError(const std::string & n) throw () :
+ NameError(n, "unprefixed choice name")
+{
+}
+
+void
+UnprefixedChoiceNameValidator::validate(const std::string & s)
+{
+ if (s.empty())
+ throw ChoiceNameWithPrefixError(s);
+
+ switch (s.at(s.length() - 1))
+ {
+ case ':':
+ case '_':
+ throw ChoiceNameWithPrefixError(s);
+ break;
+ };
+
+ if (std::string::npos != s.find(" \t\r\n"))
+ throw ChoiceNameWithPrefixError(s);
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<Choices>
+ {
+ std::list<std::tr1::shared_ptr<const Choice> > choices;
+ };
+}
+
+Choices::Choices() :
+ PrivateImplementationPattern<Choices>(new Implementation<Choices>)
+{
+}
+
+Choices::~Choices()
+{
+}
+
+void
+Choices::add(const std::tr1::shared_ptr<const Choice> & c)
+{
+ _imp->choices.push_back(c);
+}
+
+Choices::ConstIterator
+Choices::begin() const
+{
+ return ConstIterator(_imp->choices.begin());
+}
+
+Choices::ConstIterator
+Choices::end() const
+{
+ return ConstIterator(_imp->choices.end());
+}
+
+const std::tr1::shared_ptr<const ChoiceValue>
+Choices::find_by_name_with_prefix(const ChoiceNameWithPrefix & f) const
+{
+ for (ConstIterator i(begin()), i_end(end()) ;
+ i != i_end ; ++i)
+ {
+ if (0 != (*i)->prefix().data().compare(0, (*i)->prefix().data().length(), f.data(), 0, (*i)->prefix().data().length()))
+ continue;
+
+ for (Choice::ConstIterator j((*i)->begin()), j_end((*i)->end()) ;
+ j != j_end ; ++j)
+ if ((*j)->name_with_prefix() == f)
+ return *j;
+ }
+
+ return std::tr1::shared_ptr<const ChoiceValue>();
+}
+
+bool
+Choices::has_matching_contains_every_value_prefix(const ChoiceNameWithPrefix & f) const
+{
+ for (ConstIterator i(begin()), i_end(end()) ;
+ i != i_end ; ++i)
+ {
+ if (0 != (*i)->prefix().data().compare(0, (*i)->prefix().data().length(), f.data(), 0, (*i)->prefix().data().length()))
+ continue;
+
+ if ((*i)->contains_every_value())
+ return true;
+ }
+
+ return false;
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<Choice>
+ {
+ std::list<std::tr1::shared_ptr<const ChoiceValue> > values;
+ const std::string raw_name;
+ const std::string human_name;
+ const ChoicePrefixName prefix;
+ const bool contains_every_value;
+ const bool hidden;
+ const bool show_with_no_prefix;
+ const bool consider_added_or_changed;
+
+ Implementation(const std::string & r, const std::string & h, const ChoicePrefixName & p,
+ const bool c, const bool i, const bool s, const bool a) :
+ raw_name(r),
+ human_name(h),
+ prefix(p),
+ contains_every_value(c),
+ hidden(i),
+ show_with_no_prefix(s),
+ consider_added_or_changed(a)
+ {
+ }
+ };
+}
+
+Choice::Choice(const std::string & r, const std::string & h, const ChoicePrefixName & p,
+ const bool c, const bool i, const bool s, const bool a) :
+ PrivateImplementationPattern<Choice>(new Implementation<Choice>(r, h, p, c, i, s, a))
+{
+}
+
+Choice::~Choice()
+{
+}
+
+void
+Choice::add(const std::tr1::shared_ptr<const ChoiceValue> & v)
+{
+ _imp->values.push_back(v);
+}
+
+const std::string
+Choice::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+const std::string
+Choice::human_name() const
+{
+ return _imp->human_name;
+}
+
+const bool
+Choice::contains_every_value() const
+{
+ return _imp->contains_every_value;
+}
+
+const bool
+Choice::hidden() const
+{
+ return _imp->hidden;
+}
+
+const bool
+Choice::show_with_no_prefix() const
+{
+ return _imp->show_with_no_prefix;
+}
+
+const bool
+Choice::consider_added_or_changed() const
+{
+ return _imp->consider_added_or_changed;
+}
+
+const ChoicePrefixName
+Choice::prefix() const
+{
+ return _imp->prefix;
+}
+
+Choice::ConstIterator
+Choice::begin() const
+{
+ return ConstIterator(_imp->values.begin());
+}
+
+Choice::ConstIterator
+Choice::end() const
+{
+ return ConstIterator(_imp->values.end());
+}
+
+ChoiceValue::~ChoiceValue()
+{
+}
+
+template class PrivateImplementationPattern<Choices>;
+template class PrivateImplementationPattern<Choice>;
+
+template class WrappedForwardIterator<Choices::ConstIteratorTag, const std::tr1::shared_ptr<const Choice> >;
+template class WrappedForwardIterator<Choice::ConstIteratorTag, const std::tr1::shared_ptr<const ChoiceValue> >;
+
+template class Validated<std::string, UnprefixedChoiceNameValidator>;
+template class Validated<std::string, ChoicePrefixNameValidator>;
+template class Validated<std::string, ChoiceNameWithPrefixValidator>;
+
+template class Set<UnprefixedChoiceName>;
+template class WrappedForwardIterator<Set<UnprefixedChoiceName>::ConstIteratorTag, const UnprefixedChoiceName>;
+
diff --git a/paludis/choice.hh b/paludis/choice.hh
new file mode 100644
index 0000000..a877024
--- /dev/null
+++ b/paludis/choice.hh
@@ -0,0 +1,349 @@
+/* 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_CHOICE_HH
+#define PALUDIS_GUARD_PALUDIS_CHOICE_HH 1
+
+#include <paludis/choice-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/exception.hh>
+#include <tr1/memory>
+#include <string>
+
+/** \file
+ * Declarations for choice-related classes.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ *
+ * \section Examples
+ *
+ * - None at this time.
+ */
+
+namespace paludis
+{
+ /**
+ * Thrown if a ChoicePrefixName is given an invalid value.
+ *
+ * \since 0.32
+ * \ingroup g_choices
+ * \ingroup g_exceptions
+ */
+ class PALUDIS_VISIBLE ChoicePrefixNameError :
+ public NameError
+ {
+ public:
+ ChoicePrefixNameError(const std::string &) throw ();
+ };
+
+ /**
+ * Thrown if a ChoiceNameWithPrefix is given an invalid value.
+ *
+ * \since 0.32
+ * \ingroup g_choices
+ * \ingroup g_exceptions
+ */
+ class PALUDIS_VISIBLE ChoiceNameWithPrefixError :
+ public NameError
+ {
+ public:
+ ChoiceNameWithPrefixError(const std::string &) throw ();
+ };
+
+ /**
+ * Thrown if a UnprefixedChoiceName is given an invalid value.
+ *
+ * \since 0.32
+ * \ingroup g_choices
+ * \ingroup g_exceptions
+ */
+ class PALUDIS_VISIBLE UnprefixedChoiceNameError :
+ public NameError
+ {
+ public:
+ UnprefixedChoiceNameError(const std::string &) throw ();
+ };
+
+ /**
+ * A ChoicePrefixNameValidator handles validation for ChoicePrefixName.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ struct PALUDIS_VISIBLE ChoicePrefixNameValidator :
+ private InstantiationPolicy<ChoicePrefixNameValidator, instantiation_method::NonInstantiableTag>
+ {
+ /**
+ * If the parameter is not a valid value for a ChoicePrefixName, throw
+ * a ChoicePrefixNameError.
+ */
+ static void validate(const std::string &);
+ };
+
+ /**
+ * A ChoiceNameWithPrefixValidator handles validation for ChoicePrefixName.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ struct PALUDIS_VISIBLE ChoiceNameWithPrefixValidator :
+ private InstantiationPolicy<ChoiceNameWithPrefixValidator, instantiation_method::NonInstantiableTag>
+ {
+ /**
+ * If the parameter is not a valid value for a ChoiceNameWithPrefix, throw
+ * a ChoiceNameWithPrefixError.
+ */
+ static void validate(const std::string &);
+ };
+
+ /**
+ * A UnprefixedChoiceNameValidator handles validation for ChoicePrefixName.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ struct PALUDIS_VISIBLE UnprefixedChoiceNameValidator :
+ private InstantiationPolicy<UnprefixedChoiceNameValidator, instantiation_method::NonInstantiableTag>
+ {
+ /**
+ * If the parameter is not a valid value for a UnprefixedChoiceName, throw
+ * a UnprefixedChoiceNameError.
+ */
+ static void validate(const std::string &);
+ };
+
+ /**
+ * Choices holds a collection of configurable values for a PackageID.
+ *
+ * A PackageID may have a choices_key holding a Choices object. This Choices object
+ * will hold a number of Choice objects. Examples of things held by Choice objects for
+ * ebuilds include USE, USE_EXPAND values (linguas, video_cards and so on), ARCH and
+ * build_options.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ class PALUDIS_VISIBLE Choices :
+ private PrivateImplementationPattern<Choices>
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ Choices();
+ ~Choices();
+
+ ///\}
+
+ /**
+ * Add a new Choice to our collection.
+ */
+ void add(const std::tr1::shared_ptr<const Choice> &);
+
+ ///\name Iterate over Choice children
+ ///\{
+
+ struct ConstIteratorTag;
+ typedef WrappedForwardIterator<ConstIteratorTag, const std::tr1::shared_ptr<const Choice> > ConstIterator;
+ ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
+ /**
+ * Find a ChoiceValue that has a particular prefix and name.
+ *
+ * Returns a zero pointer for no match.
+ *
+ * This is a convenient way of getting a particular use flag's details. Calling this
+ * method with, say, "nls" or "ruby" will get the value for that flag without having
+ * to hunt around in all the subkeys manually. Prefixes work too, e.g. "linguas_en" for
+ * 0-based EAPIs or "linguas:en" for exheres EAPIs.
+ */
+ const std::tr1::shared_ptr<const ChoiceValue> find_by_name_with_prefix(
+ const ChoiceNameWithPrefix &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * Do we have a Choice subkey with contains_every_value true and a prefix matching
+ * this name?
+ *
+ * 0-based EAPIs don't require things like userland_GNU in IUSE. So if you're looking
+ * for a flag and don't find it, check this method before issuing a QA notice.
+ */
+ bool has_matching_contains_every_value_prefix(const ChoiceNameWithPrefix &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ /**
+ * An individual choice in a Choices collection.
+ *
+ * Examples of a choice include USE, individual USE_EXPAND values (linguas, video_cards etc)
+ * and build_options.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ class PALUDIS_VISIBLE Choice :
+ private PrivateImplementationPattern<Choice>
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ Choice(const std::string & raw_name, const std::string & human_name, const ChoicePrefixName & prefix,
+ const bool contains_every_value, const bool hidden, const bool show_with_no_prefix,
+ const bool consider_added_or_changed);
+ ~Choice();
+
+ ///\}
+
+ /**
+ * Add a new ChoiceValue.
+ */
+ void add(const std::tr1::shared_ptr<const ChoiceValue> &);
+
+ ///\name Properties
+ ///\{
+
+ /**
+ * Our raw name, for example 'USE' or 'LINGUAS'.
+ */
+ const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * A human-readable name (often the same as raw_name).
+ */
+ const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * The prefix for our ChoiceValue children.
+ *
+ * An empty string for USE and ARCH, 'linguas' for LINGUAS etc.
+ */
+ const ChoicePrefixName prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * If true, pretend that we contain every possible value and that any value not listed
+ * as a child exists and is not enabled.
+ *
+ * For pesky 0-based EAPIs that don't require things like userland_GNU in IUSE, and that
+ * don't have a comprehensive list of possible values.
+ */
+ const bool contains_every_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * If true, this option should not usually be shown visually to a user.
+ */
+ const bool hidden() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * If true, hint that we're better not displaying our prefix to the user.
+ *
+ * This is used by --pretend --install and --query to avoid showing a Use:
+ * prefix before a list of use flag names.
+ */
+ const bool show_with_no_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
+ * If false, do not consider flags in this section for 'added' or 'changed'
+ * detection.
+ *
+ * Used by build_options.
+ */
+ const bool consider_added_or_changed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+
+ ///\name Iterate over ChoiceValue children
+ ///\{
+
+ struct ConstIteratorTag;
+ typedef WrappedForwardIterator<ConstIteratorTag, const std::tr1::shared_ptr<const ChoiceValue> > ConstIterator;
+ ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ ///\}
+ };
+
+ /**
+ * An individial Value in a ChoiceValue.
+ *
+ * For example, the 'nls' flag in 'USE'.
+ *
+ * \ingroup g_choices
+ * \since 0.32
+ */
+ class PALUDIS_VISIBLE ChoiceValue
+ {
+ public:
+ ///\name Basic operations
+ ///\{
+
+ virtual ~ChoiceValue() = 0;
+
+ ///\}
+
+ ///\name Properties
+ ///\{
+
+ /**
+ * Our name, without an prefix (for example, 'nls' or 'en').
+ */
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Our name, with prefix if there is one (for example, 'nls' or 'linguas_en').
+ */
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Is this flag enabled?
+ */
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Is this flag locked (forced or masked)?
+ */
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * The flag's description, or an empty string.
+ */
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Is this flag explicitly listed?
+ *
+ * Use this to avoid showing things like LINGUAS values that aren't listed
+ * in IUSE but that end up as a ChoiceValue anyway.
+ */
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ ///\}
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<Choices>;
+ extern template class PrivateImplementationPattern<Choice>;
+#endif
+}
+
+#endif
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index ac5d5c2..fb3dca0 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -38,6 +38,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/choice.hh>
#include <paludis/util/join.hh>
#include <paludis/util/log.hh>
@@ -1487,21 +1488,44 @@ DepList::prefer_installed_over_uninstalled(const PackageID & installed,
if (dl_reinstall_if_use_changed == _imp->opts->reinstall)
{
- std::set<UseFlagName> use_common;
- if (installed.iuse_key() && uninstalled.iuse_key())
+ std::set<ChoiceNameWithPrefix> common;
+ if (installed.choices_key() && uninstalled.choices_key())
{
- std::set<IUseFlag> iuse_common;
+ std::set<ChoiceNameWithPrefix> i_common, u_common;
+ for (Choices::ConstIterator k(installed.choices_key()->value()->begin()),
+ k_end(installed.choices_key()->value()->end()) ;
+ k != k_end ; ++k)
+ {
+ if (! (*k)->consider_added_or_changed())
+ continue;
+
+ for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
+ i != i_end ; ++i)
+ i_common.insert((*i)->name_with_prefix());
+ }
+
+ for (Choices::ConstIterator k(uninstalled.choices_key()->value()->begin()),
+ k_end(uninstalled.choices_key()->value()->end()) ;
+ k != k_end ; ++k)
+ {
+ if (! (*k)->consider_added_or_changed())
+ continue;
+
+ for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
+ i != i_end ; ++i)
+ u_common.insert((*i)->name_with_prefix());
+ }
+
std::set_intersection(
- installed.iuse_key()->value()->begin(), installed.iuse_key()->value()->end(),
- uninstalled.iuse_key()->value()->begin(), uninstalled.iuse_key()->value()->end(),
- std::inserter(iuse_common, iuse_common.begin()));
- std::transform(iuse_common.begin(), iuse_common.end(), std::inserter(use_common, use_common.begin()),
- std::tr1::mem_fn(&IUseFlag::flag));
+ i_common.begin(), i_common.end(),
+ u_common.begin(), u_common.end(),
+ std::inserter(common, common.begin()));
}
- for (std::set<UseFlagName>::const_iterator f(use_common.begin()), f_end(use_common.end()) ;
+ for (std::set<ChoiceNameWithPrefix>::const_iterator f(common.begin()), f_end(common.end()) ;
f != f_end ; ++f)
- if (_imp->env->query_use(*f, installed) != _imp->env->query_use(*f, uninstalled))
+ if (installed.choices_key()->value()->find_by_name_with_prefix(*f)->enabled() !=
+ uninstalled.choices_key()->value()->find_by_name_with_prefix(*f)->enabled())
return false;
}
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index b1bdd13..a5ed743 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -26,6 +26,7 @@
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/override_functions.hh>
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/choice.hh>
using namespace paludis;
using namespace test;
@@ -450,7 +451,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("enabled? ( cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("enabled? ( cat/two )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
}
@@ -470,7 +473,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("!enabled? ( cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("!enabled? ( cat/two )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
}
@@ -489,7 +494,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("disabled? ( cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("disabled? ( cat/two )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
}
@@ -508,7 +515,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("!disabled? ( cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("!disabled? ( cat/two )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
}
@@ -528,7 +537,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( enabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( enabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -549,7 +560,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( !enabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( !enabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -570,7 +583,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( disabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( disabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -591,7 +606,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( !disabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( !disabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -612,7 +629,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( enabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( enabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -633,7 +652,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( !enabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( !enabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -654,7 +675,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( disabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( disabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -675,7 +698,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( !disabled? ( cat/two ) cat/three )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( !disabled? ( cat/two ) cat/three )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -696,7 +721,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( enabled? ( cat/three ) cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( enabled? ( cat/three ) cat/two )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -717,7 +744,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( !enabled? ( cat/three ) cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( !enabled? ( cat/three ) cat/two )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -739,7 +768,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( disabled? ( cat/three ) cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( disabled? ( cat/three ) cat/two )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -761,7 +792,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three || ( !disabled? ( cat/three ) cat/two )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("cat/three || ( !disabled? ( cat/three ) cat/two )");
+ idcat->choices_key()->add("", "disabled");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -782,7 +815,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ idcat->choices_key()->add("", "enabled1");
+ idcat->choices_key()->add("", "enabled2");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -803,7 +839,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ idcat->choices_key()->add("", "enabled1");
+ idcat->choices_key()->add("", "enabled2");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -824,7 +863,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "one", "1"));
+ idcat->build_dependencies_key()->set_from_string("|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
+ idcat->choices_key()->add("", "enabled1");
+ idcat->choices_key()->add("", "enabled2");
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -922,7 +964,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
}
void populate_expected()
@@ -942,7 +984,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
}
void populate_expected()
@@ -962,7 +1004,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
}
void populate_expected()
@@ -990,7 +1032,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
}
void populate_expected()
@@ -1018,7 +1060,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
}
void populate_expected()
@@ -1038,7 +1080,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
}
void populate_expected()
@@ -1058,7 +1100,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "disabled");
}
void populate_expected()
@@ -1086,7 +1128,7 @@ namespace test_cases
void populate_repo()
{
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("( cat/two cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ repo->add_version("cat", "two", "1")->choices_key()->add("", "enabled");
}
void populate_expected()
@@ -1408,13 +1450,21 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname?] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat3", "disabled", "1")->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname?] )");
- repo->add_version("cat4", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat5", "disabled", "1")->build_dependencies_key()->set_from_string("( cat6/disabled[pkgname?] )");
- repo->add_version("cat6", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat", "all", "1")->build_dependencies_key()->set_from_string("( cat5/disabled cat3/disabled cat1/enabled )");
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
+ idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname?] )");
+ idcat3->choices_key()->add("", "pkgname");
+ repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "disabled", "1"));
+ idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[pkgname?] )");
+ idcat5->choices_key()->add("", "pkgname");
+ repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
+ idcat->build_dependencies_key()->set_from_string("( cat5/disabled cat3/disabled cat1/enabled )");
+ idcat->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1438,8 +1488,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname?] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1466,13 +1518,21 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "disabled", "1")->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname!?] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat3", "enabled", "1")->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname!?] )");
- repo->add_version("cat4", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat5", "enabled", "1")->build_dependencies_key()->set_from_string("( cat6/disabled[pkgname!?] )");
- repo->add_version("cat6", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat", "all", "1")->build_dependencies_key()->set_from_string("( cat5/enabled cat3/enabled cat1/disabled )");
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname!?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "enabled", "1"));
+ idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname!?] )");
+ idcat3->choices_key()->add("", "pkgname");
+ repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "enabled", "1"));
+ idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[pkgname!?] )");
+ idcat5->choices_key()->add("", "pkgname");
+ repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
+ idcat->build_dependencies_key()->set_from_string("( cat5/enabled cat3/enabled cat1/disabled )");
+ idcat->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1496,8 +1556,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "disabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!?] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1524,13 +1586,21 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname?] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat3", "disabled", "1")->build_dependencies_key()->set_from_string("( cat4/enabled[-pkgname?] )");
- repo->add_version("cat4", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat5", "disabled", "1")->build_dependencies_key()->set_from_string("( cat6/disabled[-pkgname?] )");
- repo->add_version("cat6", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat", "all", "1")->build_dependencies_key()->set_from_string("( cat5/disabled cat3/disabled cat1/enabled )");
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
+ idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[-pkgname?] )");
+ idcat3->choices_key()->add("", "pkgname");
+ repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "disabled", "1"));
+ idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[-pkgname?] )");
+ idcat5->choices_key()->add("", "pkgname");
+ repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
+ idcat->build_dependencies_key()->set_from_string("( cat5/disabled cat3/disabled cat1/enabled )");
+ idcat->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1554,8 +1624,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/enabled[-pkgname?] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[-pkgname?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1582,13 +1654,21 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "disabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname!?] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat3", "enabled", "1")->build_dependencies_key()->set_from_string("( cat4/enabled[-pkgname!?] )");
- repo->add_version("cat4", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat5", "enabled", "1")->build_dependencies_key()->set_from_string("( cat6/disabled[-pkgname!?] )");
- repo->add_version("cat6", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat", "all", "1")->build_dependencies_key()->set_from_string("( cat5/enabled cat3/enabled cat1/disabled )");
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname!?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "enabled", "1"));
+ idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[-pkgname!?] )");
+ idcat3->choices_key()->add("", "pkgname");
+ repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat5(repo->add_version("cat5", "enabled", "1"));
+ idcat5->build_dependencies_key()->set_from_string("( cat6/disabled[-pkgname!?] )");
+ idcat5->choices_key()->add("", "pkgname");
+ repo->add_version("cat6", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
+ idcat->build_dependencies_key()->set_from_string("( cat5/enabled cat3/enabled cat1/disabled )");
+ idcat->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1612,8 +1692,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "disabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname!?] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[-pkgname!?] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1640,11 +1722,17 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname=] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat3", "disabled", "1")->build_dependencies_key()->set_from_string("( cat4/disabled[pkgname=] )");
- repo->add_version("cat4", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat", "all", "1")->build_dependencies_key()->set_from_string("( cat3/disabled cat1/enabled )");
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname=] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
+ idcat3->build_dependencies_key()->set_from_string("( cat4/disabled[pkgname=] )");
+ idcat3->choices_key()->add("", "pkgname");
+ repo->add_version("cat4", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
+ idcat->build_dependencies_key()->set_from_string("( cat3/disabled cat1/enabled )");
+ idcat->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1666,8 +1754,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname=] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname=] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1694,8 +1784,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "disabled", "1")->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname=] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname=] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1722,11 +1814,17 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!=] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat3", "disabled", "1")->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname!=] )");
- repo->add_version("cat4", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
- repo->add_version("cat", "all", "1")->build_dependencies_key()->set_from_string("( cat3/disabled cat1/enabled )");
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!=] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat3(repo->add_version("cat3", "disabled", "1"));
+ idcat3->build_dependencies_key()->set_from_string("( cat4/enabled[pkgname!=] )");
+ idcat3->choices_key()->add("", "pkgname");
+ repo->add_version("cat4", "enabled", "1")->choices_key()->add("", "pkgname");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "all", "1"));
+ idcat->build_dependencies_key()->set_from_string("( cat3/disabled cat1/enabled )");
+ idcat->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1748,8 +1846,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "enabled", "1")->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!=] )");
- repo->add_version("cat2", "enabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "enabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/disabled[pkgname!=] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "enabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -1776,8 +1876,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat1", "disabled", "1")->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname!=] )");
- repo->add_version("cat2", "disabled", "1")->iuse_key()->set_from_string("ebuild", IUseFlagParseOptions());
+ std::tr1::shared_ptr<FakePackageID> idcat1(repo->add_version("cat1", "disabled", "1"));
+ idcat1->build_dependencies_key()->set_from_string("( cat2/enabled[pkgname!=] )");
+ idcat1->choices_key()->add("", "pkgname");
+ repo->add_version("cat2", "disabled", "1")->choices_key()->add("", "pkgname");
}
void populate_expected()
@@ -2122,7 +2224,9 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo")));
env.package_database()->add_repository(1, repo);
repo->add_version("cat", "one", "1")->build_dependencies_key()->set_from_string("cat/three");
- repo->add_version("cat", "two", "1")->build_dependencies_key()->set_from_string("enabled? ( || ( ( <cat/three-1 cat/three:0 =cat/four-1 ) cat/five ) )");
+ std::tr1::shared_ptr<FakePackageID> idcat(repo->add_version("cat", "two", "1"));
+ idcat->build_dependencies_key()->set_from_string("enabled? ( || ( ( <cat/three-1 cat/three:0 =cat/four-1 ) cat/five ) )");
+ idcat->choices_key()->add("", "enabled");
repo->add_version("cat", "three", "0.9");
repo->add_version("cat", "four", "1");
diff --git a/paludis/dep_spec-fwd.hh b/paludis/dep_spec-fwd.hh
index 712c1ae..ad827b7 100644
--- a/paludis/dep_spec-fwd.hh
+++ b/paludis/dep_spec-fwd.hh
@@ -49,6 +49,7 @@ namespace paludis
class BlockDepSpec;
class StringDepSpec;
class NamedSetDepSpec;
+ class PlainTextLabelDepSpec;
template <typename T_> class LabelsDepSpec;
/**
@@ -181,6 +182,14 @@ namespace paludis
* \since 0.26
*/
std::ostream & operator<< (std::ostream &, const NamedSetDepSpec &) PALUDIS_VISIBLE;
+
+ /**
+ * A PlainTextLabelDepSpec can be written to an ostream.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.32
+ */
+ std::ostream & operator<< (std::ostream &, const PlainTextLabelDepSpec &) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index ae6c527..720eb31 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -354,6 +354,13 @@ paludis::operator<< (std::ostream & s, const URILabelsDepSpec & l)
}
std::ostream &
+paludis::operator<< (std::ostream & s, const PlainTextLabelDepSpec & l)
+{
+ s << l.label() << ":";
+ return s;
+}
+
+std::ostream &
paludis::operator<< (std::ostream & s, const DependencyLabelsDepSpec & l)
{
s << join(indirect_iterator(l.begin()), indirect_iterator(l.end()), ",") << ":";
@@ -393,6 +400,33 @@ PlainTextDepSpec::need_keys_added() const
{
}
+PlainTextLabelDepSpec::PlainTextLabelDepSpec(const std::string & s) :
+ StringDepSpec(s)
+{
+}
+
+PlainTextLabelDepSpec::~PlainTextLabelDepSpec()
+{
+}
+
+std::tr1::shared_ptr<DepSpec>
+PlainTextLabelDepSpec::clone() const
+{
+ std::tr1::shared_ptr<PlainTextLabelDepSpec> result(new PlainTextLabelDepSpec(text()));
+ result->set_annotations_key(annotations_key());
+ return result;
+}
+
+const std::string
+PlainTextLabelDepSpec::label() const
+{
+ return text().substr(0, text().length() - 1);
+}
+
+void
+PlainTextLabelDepSpec::need_keys_added() const
+{
+}
LicenseDepSpec::LicenseDepSpec(const std::string & s) :
StringDepSpec(s)
@@ -412,7 +446,6 @@ LicenseDepSpec::need_keys_added() const
{
}
-
SimpleURIDepSpec::SimpleURIDepSpec(const std::string & s) :
StringDepSpec(s)
{
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 28969a0..f5e9704 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -937,6 +937,26 @@ namespace paludis
virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE PlainTextLabelDepSpec :
+ public StringDepSpec
+ {
+ protected:
+ virtual void need_keys_added() const;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ PlainTextLabelDepSpec(const std::string &);
+ ~PlainTextLabelDepSpec();
+
+ ///\}
+
+ virtual std::tr1::shared_ptr<DepSpec> clone() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ const std::string label() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class Cloneable<DepSpec>;
extern template class PrivateImplementationPattern<ConditionalDepSpec>;
@@ -946,6 +966,7 @@ namespace paludis
extern template class CloneUsingThis<DepSpec, PackageDepSpec>;
extern template class PrivateImplementationPattern<DependencyLabelsDepSpec>;
extern template class PrivateImplementationPattern<URILabelsDepSpec>;
+ extern template class PrivateImplementationPattern<PlainTextLabelDepSpec>;
#endif
}
diff --git a/paludis/dep_spec_flattener.cc b/paludis/dep_spec_flattener.cc
index 2cb7555..d235c04 100644
--- a/paludis/dep_spec_flattener.cc
+++ b/paludis/dep_spec_flattener.cc
@@ -143,6 +143,12 @@ DepSpecFlattener<Heirarchy_, Item_>::visit_leaf(const Item_ & p)
_imp->specs.push_back(std::tr1::static_pointer_cast<const Item_>(p.clone()));
}
+template <typename Heirarchy_, typename Item_>
+void
+dep_spec_flattener_internals::VisitPlainTextLabelDepSpec<Heirarchy_, Item_, true>::visit_leaf(const PlainTextLabelDepSpec &)
+{
+}
+
template class DepSpecFlattener<ProvideSpecTree, PackageDepSpec>;
template class DepSpecFlattener<SetSpecTree, PackageDepSpec>;
template class DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec>;
diff --git a/paludis/dep_spec_flattener.hh b/paludis/dep_spec_flattener.hh
index 8d4fc68..888e03e 100644
--- a/paludis/dep_spec_flattener.hh
+++ b/paludis/dep_spec_flattener.hh
@@ -90,6 +90,34 @@ namespace paludis
};
/**
+ * Implement visit for PlainTextLabelDepSpec, if necessary.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.32
+ * \nosubgrouping
+ */
+ template <typename H_, typename I_, bool b_>
+ struct VisitPlainTextLabelDepSpec
+ {
+ void visit_leaf(const NoType<1u> &);
+ };
+
+ /**
+ * Implement visit for PlainTextLabelDepSpec, if necessary.
+ *
+ * \ingroup g_dep_spec
+ * \since 0.32
+ * \nosubgrouping
+ */
+ template <typename H_, typename I_>
+ class VisitPlainTextLabelDepSpec<H_, I_, true> :
+ public virtual visitor_internals::Visits<const TreeLeaf<H_, PlainTextLabelDepSpec> >
+ {
+ public:
+ void visit_leaf(const PlainTextLabelDepSpec &);
+ };
+
+ /**
* Implement visit for ConditionalDepSpec, if necessary.
*
* \ingroup g_dep_spec
@@ -127,12 +155,12 @@ namespace paludis
* This template can be instantiated as:
*
* - DepSpecFlattener<ProvideSpecTree, PlainTextDepSpec>
- * - DepSpecFlattener<RestrictSpecTree, PlainTextDepSpec>
+ * - DepSpecFlattener<PlainTextDepSpec, PlainTextDepSpec>
* - DepSpecFlattener<SetSpecTree, PackageDepSpec>
* - DepSpecFlattener<SimpleURISpecTree, SimpleURIDepSpec>
*
- * It is <b>not</b> suitable for heirarchies that can contain AnyDepSpec
- * or any kind of label.
+ * It is <b>not</b> suitable for heirarchies that can contain AnyDepSpec.
+ * Any labels are discarded.
*
* \ingroup g_dep_spec
* \since 0.26
@@ -146,11 +174,15 @@ namespace paludis
public ConstVisitor<Heirarchy_>::template VisitConstSequence<DepSpecFlattener<Heirarchy_, Item_>, AllDepSpec>,
public dep_spec_flattener_internals::VisitNamedSetDepSpec<
Heirarchy_, Item_, ConstVisitor<Heirarchy_>::template Contains<const TreeLeaf<Heirarchy_, NamedSetDepSpec> >::value>,
+ public dep_spec_flattener_internals::VisitPlainTextLabelDepSpec<
+ Heirarchy_, Item_, ConstVisitor<Heirarchy_>::template Contains<const TreeLeaf<Heirarchy_, PlainTextLabelDepSpec> >::value>,
public dep_spec_flattener_internals::VisitConditionalDepSpec<
Heirarchy_, Item_, ConstVisitor<Heirarchy_>::template Contains<const ConstTreeSequence<Heirarchy_, ConditionalDepSpec> >::value>
{
friend class dep_spec_flattener_internals::VisitNamedSetDepSpec<
Heirarchy_, Item_, ConstVisitor<Heirarchy_>::template Contains<const TreeLeaf<Heirarchy_, NamedSetDepSpec> >::value>;
+ friend class dep_spec_flattener_internals::VisitPlainTextLabelDepSpec<
+ Heirarchy_, Item_, ConstVisitor<Heirarchy_>::template Contains<const TreeLeaf<Heirarchy_, PlainTextLabelDepSpec> >::value>;
friend class dep_spec_flattener_internals::VisitConditionalDepSpec<
Heirarchy_, Item_, ConstVisitor<Heirarchy_>::template Contains<const ConstTreeSequence<Heirarchy_, ConditionalDepSpec> >::value>;
@@ -169,6 +201,9 @@ namespace paludis
using dep_spec_flattener_internals::VisitNamedSetDepSpec<Heirarchy_, Item_,
ConstVisitor<Heirarchy_>::template Contains<const TreeLeaf<Heirarchy_, NamedSetDepSpec> >::value>::visit_leaf;
+ using dep_spec_flattener_internals::VisitPlainTextLabelDepSpec<Heirarchy_, Item_,
+ ConstVisitor<Heirarchy_>::template Contains<const TreeLeaf<Heirarchy_, PlainTextLabelDepSpec> >::value>::visit_leaf;
+
void visit_leaf(const Item_ &);
///}
diff --git a/paludis/dep_tree.hh b/paludis/dep_tree.hh
index 98e9d6e..aa78cc8 100644
--- a/paludis/dep_tree.hh
+++ b/paludis/dep_tree.hh
@@ -55,6 +55,7 @@ namespace paludis
GenericSpecTree,
DepSpec,
TreeLeaf<GenericSpecTree, PlainTextDepSpec>,
+ TreeLeaf<GenericSpecTree, PlainTextLabelDepSpec>,
TreeLeaf<GenericSpecTree, SimpleURIDepSpec>,
TreeLeaf<GenericSpecTree, FetchableURIDepSpec>,
TreeLeaf<GenericSpecTree, LicenseDepSpec>,
@@ -86,7 +87,8 @@ namespace paludis
BlockDepSpec,
URILabelsDepSpec,
DependencyLabelsDepSpec,
- NamedSetDepSpec
+ NamedSetDepSpec,
+ PlainTextLabelDepSpec
> ItemFormatter;
};
@@ -225,6 +227,7 @@ namespace paludis
PlainTextSpecTree,
DepSpec,
TreeLeaf<PlainTextSpecTree, PlainTextDepSpec>,
+ TreeLeaf<PlainTextSpecTree, PlainTextLabelDepSpec>,
ConstTreeSequence<PlainTextSpecTree, AllDepSpec>,
ConstTreeSequence<PlainTextSpecTree, ConditionalDepSpec>
>
@@ -239,7 +242,8 @@ namespace paludis
*/
typedef Formatter<
ConditionalDepSpec,
- PlainTextDepSpec
+ PlainTextDepSpec,
+ PlainTextLabelDepSpec
> ItemFormatter;
};
diff --git a/paludis/elike_choices-fwd.hh b/paludis/elike_choices-fwd.hh
new file mode 100644
index 0000000..e2f06c9
--- /dev/null
+++ b/paludis/elike_choices-fwd.hh
@@ -0,0 +1,39 @@
+/* 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_ELIKE_CHOICES_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_ELIKE_CHOICES_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/choice-fwd.hh>
+#include <string>
+
+namespace paludis
+{
+ struct ELikeStripChoiceValue;
+ struct ELikeSplitChoiceValue;
+ struct ELikeOptionalTestsChoiceValue;
+ struct ELikeRecommendedTestsChoiceValue;
+
+ const ChoicePrefixName canonical_build_options_prefix() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::string canonical_build_options_raw_name() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::string canonical_build_options_human_name() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+}
+
+#endif
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
new file mode 100644
index 0000000..932b918
--- /dev/null
+++ b/paludis/elike_choices.cc
@@ -0,0 +1,260 @@
+/* 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
+ */
+
+#include <paludis/elike_choices.hh>
+#include <paludis/environment.hh>
+#include <paludis/util/tribool.hh>
+#include <paludis/util/stringify.hh>
+
+using namespace paludis;
+
+const UnprefixedChoiceName
+ELikeStripChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("strip");
+}
+
+const ChoiceNameWithPrefix
+ELikeStripChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+ELikeStripChoiceValue::ELikeStripChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())
+{
+}
+
+const UnprefixedChoiceName
+ELikeStripChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeStripChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeStripChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeStripChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeStripChoiceValue::description() const
+{
+ return "Strip binaries and libraries before installation";
+}
+
+bool
+ELikeStripChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const UnprefixedChoiceName
+ELikeSplitChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("split");
+}
+
+const ChoiceNameWithPrefix
+ELikeSplitChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+ELikeSplitChoiceValue::ELikeSplitChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())
+{
+}
+
+const UnprefixedChoiceName
+ELikeSplitChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeSplitChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeSplitChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeSplitChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeSplitChoiceValue::description() const
+{
+ return "Split debugging information out from binaries and libraries before installation";
+}
+
+bool
+ELikeSplitChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const UnprefixedChoiceName
+ELikeOptionalTestsChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("optional_tests");
+}
+
+const ChoiceNameWithPrefix
+ELikeOptionalTestsChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+ELikeOptionalTestsChoiceValue::ELikeOptionalTestsChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())
+{
+}
+
+const UnprefixedChoiceName
+ELikeOptionalTestsChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeOptionalTestsChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeOptionalTestsChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeOptionalTestsChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeOptionalTestsChoiceValue::description() const
+{
+ return "Run tests considered by the package to be optional";
+}
+
+bool
+ELikeOptionalTestsChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const UnprefixedChoiceName
+ELikeRecommendedTestsChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("recommended_tests");
+}
+
+const ChoiceNameWithPrefix
+ELikeRecommendedTestsChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+ELikeRecommendedTestsChoiceValue::ELikeRecommendedTestsChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())
+{
+}
+
+const UnprefixedChoiceName
+ELikeRecommendedTestsChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeRecommendedTestsChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeRecommendedTestsChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeRecommendedTestsChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeRecommendedTestsChoiceValue::description() const
+{
+ return "Run tests considered by the package to be recommended";
+}
+
+bool
+ELikeRecommendedTestsChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const ChoicePrefixName
+paludis::canonical_build_options_prefix()
+{
+ return ChoicePrefixName("build_options");
+}
+
+const std::string
+paludis::canonical_build_options_raw_name()
+{
+ return "build_options";
+}
+
+const std::string
+paludis::canonical_build_options_human_name()
+{
+ return "Build Options";
+}
+
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
new file mode 100644
index 0000000..a367d10
--- /dev/null
+++ b/paludis/elike_choices.hh
@@ -0,0 +1,116 @@
+/* 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_ELIKE_CHOICES_HH
+#define PALUDIS_GUARD_PALUDIS_ELIKE_CHOICES_HH 1
+
+#include <paludis/elike_choices-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/choice.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE ELikeStripChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikeStripChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE ELikeSplitChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikeSplitChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE ELikeOptionalTestsChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikeOptionalTestsChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE ELikeRecommendedTestsChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikeRecommendedTestsChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+}
+
+#endif
diff --git a/paludis/elike_conditional_dep_spec-fwd.hh b/paludis/elike_conditional_dep_spec-fwd.hh
index a37ae84..ea7385a 100644
--- a/paludis/elike_conditional_dep_spec-fwd.hh
+++ b/paludis/elike_conditional_dep_spec-fwd.hh
@@ -24,6 +24,7 @@
#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/name-fwd.hh>
+#include <paludis/choice-fwd.hh>
#include <string>
namespace paludis
@@ -31,11 +32,12 @@ namespace paludis
class ELikeConditionalDepSpecParseError;
ConditionalDepSpec parse_elike_conditional_dep_spec(const std::string &,
- const Environment * const, const std::tr1::shared_ptr<const PackageID> &) PALUDIS_VISIBLE;
+ const Environment * const, const std::tr1::shared_ptr<const PackageID> &,
+ const bool no_warning_for_unlisted) PALUDIS_VISIBLE;
bool elike_conditional_dep_spec_is_inverse(const ConditionalDepSpec & spec) PALUDIS_VISIBLE;
- UseFlagName elike_conditional_dep_spec_flag(const ConditionalDepSpec & spec) PALUDIS_VISIBLE;
+ ChoiceNameWithPrefix elike_conditional_dep_spec_flag(const ConditionalDepSpec & spec) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/elike_conditional_dep_spec.cc b/paludis/elike_conditional_dep_spec.cc
index 1ca1f22..1498781 100644
--- a/paludis/elike_conditional_dep_spec.cc
+++ b/paludis/elike_conditional_dep_spec.cc
@@ -25,12 +25,14 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/visitor_cast.hh>
#include <paludis/util/destringify.hh>
+#include <paludis/util/log.hh>
#include <paludis/dep_spec.hh>
#include <paludis/name.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
+#include <paludis/choice.hh>
#include <ostream>
#include <string>
@@ -43,20 +45,63 @@ ELikeConditionalDepSpecParseError::ELikeConditionalDepSpecParseError(const std::
namespace
{
+ bool icky_use_query(const ChoiceNameWithPrefix & f, const PackageID & id, const bool no_warning_for_unlisted)
+ {
+ if (! id.choices_key())
+ {
+ Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ "ID '" << id << "' has no choices, so couldn't get the state of flag '" << f << "'";
+ return false;
+ }
+
+ const std::tr1::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f));
+ if (v)
+ return v->enabled();
+
+ if (! no_warning_for_unlisted)
+ if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f))
+ Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ "ID '" << id << "' has no flag named '" << f << "'";
+ return false;
+ }
+
+ bool icky_use_query_locked(const ChoiceNameWithPrefix & f, const PackageID & id, const bool no_warning_for_unlisted)
+ {
+ if (! id.choices_key())
+ {
+ Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ "ID '" << id << "' has no choices, so couldn't get the state of flag '" << f << "'";
+ return false;
+ }
+
+ const std::tr1::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f));
+ if (v)
+ return v->locked();
+
+ if (! no_warning_for_unlisted)
+ if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f))
+ Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ "ID '" << id << "' has no flag named '" << f << "'";
+ return false;
+ }
+
struct EConditionalDepSpecData :
ConditionalDepSpecData
{
bool inverse;
- UseFlagName flag;
+ ChoiceNameWithPrefix flag;
const Environment * const env;
const std::tr1::shared_ptr<const PackageID> id;
+ bool no_warning_for_unlisted;
- EConditionalDepSpecData(const std::string & s, const Environment * const e, const std::tr1::shared_ptr<const PackageID> & i) :
+ EConditionalDepSpecData(const std::string & s, const Environment * const e, const std::tr1::shared_ptr<const PackageID> & i,
+ const bool n) :
inverse(false),
- flag(UseFlagName("unset")),
+ flag("x"),
env(e),
- id(i)
+ id(i),
+ no_warning_for_unlisted(n)
{
if (s.empty())
throw ELikeConditionalDepSpecParseError(s, "missing use flag name");
@@ -68,7 +113,7 @@ namespace
if (s.length() < (inverse ? 3 : 2))
throw ELikeConditionalDepSpecParseError(s, "missing flag name on use conditional");
- flag = UseFlagName(s.substr(inverse ? 1 : 0, s.length() - (inverse ? 2 : 1)));
+ flag = ChoiceNameWithPrefix(s.substr(inverse ? 1 : 0, s.length() - (inverse ? 2 : 1)));
add_metadata_key(make_shared_ptr(new LiteralMetadataValueKey<std::string> ("Flag", "Flag", mkt_normal, stringify(flag))));
add_metadata_key(make_shared_ptr(new LiteralMetadataValueKey<std::string> ("Inverse", "Inverse", mkt_normal, stringify(inverse))));
@@ -84,7 +129,7 @@ namespace
if (! id)
throw InternalError(PALUDIS_HERE, "! id");
- return env->query_use(flag, *id) ^ inverse;
+ return icky_use_query(flag, *id, no_warning_for_unlisted) ^ inverse;
}
virtual bool condition_meetable() const
@@ -92,14 +137,7 @@ namespace
if (! id)
throw InternalError(PALUDIS_HERE, "! id");
- RepositoryUseInterface * const u((*id->repository()).use_interface());
- if (! u)
- return true;
-
- if (inverse)
- return ! u->query_use_force(flag, *id);
- else
- return ! u->query_use_mask(flag, *id);
+ return condition_met() || ! icky_use_query_locked(flag, *id, no_warning_for_unlisted);
}
virtual void need_keys_added() const
@@ -110,12 +148,13 @@ namespace
ConditionalDepSpec
paludis::parse_elike_conditional_dep_spec(const std::string & s,
- const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id)
+ const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id,
+ const bool no_warning_for_unlisted)
{
- return ConditionalDepSpec(make_shared_ptr(new EConditionalDepSpecData(s, env, id)));
+ return ConditionalDepSpec(make_shared_ptr(new EConditionalDepSpecData(s, env, id, no_warning_for_unlisted)));
}
-UseFlagName
+ChoiceNameWithPrefix
paludis::elike_conditional_dep_spec_flag(const ConditionalDepSpec & spec)
{
ConditionalDepSpec::MetadataConstIterator i(spec.find_metadata("Flag"));
@@ -124,7 +163,7 @@ paludis::elike_conditional_dep_spec_flag(const ConditionalDepSpec & spec)
const MetadataValueKey<std::string> * key(visitor_cast<const MetadataValueKey<std::string> >(**i));
if (! key)
throw InternalError(PALUDIS_HERE, "Spec '" + stringify(spec) + "' has Flag metadata which is not a string");
- return UseFlagName(key->value());
+ return ChoiceNameWithPrefix(key->value());
}
bool
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index d3ae113..a3a0159 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -24,9 +24,13 @@
#include <paludis/util/join.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/dep_spec.hh>
#include <paludis/name.hh>
#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/choice.hh>
#include <vector>
#include <functional>
#include <algorithm>
@@ -35,19 +39,38 @@ using namespace paludis;
namespace
{
+ bool icky_use_query(const ChoiceNameWithPrefix & f, const PackageID & id)
+ {
+ if (! id.choices_key())
+ {
+ Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ "ID '" << id << "' has no choices, so couldn't get the state of flag '" << f << "'";
+ return false;
+ }
+
+ const std::tr1::shared_ptr<const ChoiceValue> v(id.choices_key()->value()->find_by_name_with_prefix(f));
+ if (v)
+ return v->enabled();
+
+ if (! id.choices_key()->value()->has_matching_contains_every_value_prefix(f))
+ Log::get_instance()->message("elike_use_requirement.query", ll_warning, lc_context) <<
+ "ID '" << id << "' has no flag named '" << f << "'";
+ return false;
+ }
+
class UseRequirement
{
private:
- const UseFlagName _name;
+ const ChoiceNameWithPrefix _name;
public:
- UseRequirement(const UseFlagName & n) :
+ UseRequirement(const ChoiceNameWithPrefix & n) :
_name(n)
{
}
virtual ~UseRequirement() { }
- const UseFlagName flag() const PALUDIS_ATTRIBUTE((warn_unused_result))
+ const ChoiceNameWithPrefix flag() const PALUDIS_ATTRIBUTE((warn_unused_result))
{
return _name;
}
@@ -60,15 +83,16 @@ namespace
public UseRequirement
{
public:
- EnabledUseRequirement(const UseFlagName & n) :
+ EnabledUseRequirement(const ChoiceNameWithPrefix & n) :
UseRequirement(n)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return env->query_use(flag(), pkg);
+ return icky_use_query(flag(), pkg);
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' enabled";
@@ -79,15 +103,16 @@ namespace
public UseRequirement
{
public:
- DisabledUseRequirement(const UseFlagName & n) :
+ DisabledUseRequirement(const ChoiceNameWithPrefix & n) :
UseRequirement(n)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return ! env->query_use(flag(), pkg);
+ return ! icky_use_query(flag(), pkg);
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' disabled";
@@ -101,7 +126,7 @@ namespace
const std::tr1::shared_ptr<const PackageID> _id;
public:
- ConditionalUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ ConditionalUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
UseRequirement(n),
_id(i)
{
@@ -117,15 +142,16 @@ namespace
public ConditionalUseRequirement
{
public:
- IfMineThenUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ IfMineThenUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
ConditionalUseRequirement(n, i)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return ! env->query_use(flag(), *package_id()) || env->query_use(flag(), pkg);
+ return ! icky_use_query(flag(), *package_id()) || icky_use_query(flag(), pkg);
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' enabled if it is enabled for '" + stringify(*package_id()) + "'";
@@ -136,15 +162,16 @@ namespace
public ConditionalUseRequirement
{
public:
- IfNotMineThenUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ IfNotMineThenUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
ConditionalUseRequirement(n, i)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return env->query_use(flag(), *package_id()) || env->query_use(flag(), pkg);
+ return icky_use_query(flag(), *package_id()) || icky_use_query(flag(), pkg);
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' enabled if it is disabled for '" + stringify(*package_id()) + "'";
@@ -155,15 +182,16 @@ namespace
public ConditionalUseRequirement
{
public:
- IfMineThenNotUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ IfMineThenNotUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
ConditionalUseRequirement(n, i)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return ! env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg);
+ return ! icky_use_query(flag(), *package_id()) || ! icky_use_query(flag(), pkg);
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' disabled if it is enabled for '" + stringify(*package_id()) + "'";
@@ -174,15 +202,16 @@ namespace
public ConditionalUseRequirement
{
public:
- IfNotMineThenNotUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ IfNotMineThenNotUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
ConditionalUseRequirement(n, i)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return env->query_use(flag(), *package_id()) || ! env->query_use(flag(), pkg);
+ return icky_use_query(flag(), *package_id()) || ! icky_use_query(flag(), pkg);
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' disabled if it is disabled for '" + stringify(*package_id()) + "'";
@@ -193,15 +222,16 @@ namespace
public ConditionalUseRequirement
{
public:
- EqualUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ EqualUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
ConditionalUseRequirement(n, i)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return env->query_use(flag(), pkg) == env->query_use(flag(), *package_id());
+ return icky_use_query(flag(), pkg) == icky_use_query(flag(), *package_id());
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' enabled or disabled like it is for '" + stringify(*package_id()) + "'";
@@ -212,15 +242,16 @@ namespace
public ConditionalUseRequirement
{
public:
- NotEqualUseRequirement(const UseFlagName & n, const std::tr1::shared_ptr<const PackageID> & i) :
+ NotEqualUseRequirement(const ChoiceNameWithPrefix & n, const std::tr1::shared_ptr<const PackageID> & i) :
ConditionalUseRequirement(n, i)
{
}
- virtual bool requirement_met(const Environment * const env, const PackageID & pkg) const
+ virtual bool requirement_met(const Environment * const, const PackageID & pkg) const
{
- return env->query_use(flag(), pkg) != env->query_use(flag(), *package_id());
+ return icky_use_query(flag(), pkg) != icky_use_query(flag(), *package_id());
}
+
virtual const std::string as_human_string() const
{
return "Flag '" + stringify(flag()) + "' enabled or disabled opposite to how it is for '" + stringify(*package_id()) + "'";
@@ -294,7 +325,7 @@ namespace
flag.erase(flag.length() - 1, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return make_shared_ptr(new NotEqualUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new NotEqualUseRequirement(ChoiceNameWithPrefix(flag), id));
}
else if ('!' == flag.at(0))
{
@@ -310,10 +341,10 @@ namespace
flag.erase(0, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return make_shared_ptr(new NotEqualUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new NotEqualUseRequirement(ChoiceNameWithPrefix(flag), id));
}
else
- return make_shared_ptr(new EqualUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new EqualUseRequirement(ChoiceNameWithPrefix(flag), id));
}
else if ('?' == flag.at(flag.length() - 1))
{
@@ -345,7 +376,7 @@ namespace
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new IfNotMineThenNotUseRequirement(ChoiceNameWithPrefix(flag), id));
}
else
{
@@ -358,7 +389,7 @@ namespace
<< "[use!?] not safe for use here";
}
- return make_shared_ptr(new IfNotMineThenUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new IfNotMineThenUseRequirement(ChoiceNameWithPrefix(flag), id));
}
}
else if ('!' == flag.at(0))
@@ -376,7 +407,7 @@ namespace
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return make_shared_ptr(new IfNotMineThenNotUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new IfNotMineThenNotUseRequirement(ChoiceNameWithPrefix(flag), id));
}
else
{
@@ -395,10 +426,10 @@ namespace
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return make_shared_ptr(new IfMineThenNotUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new IfMineThenNotUseRequirement(ChoiceNameWithPrefix(flag), id));
}
else
- return make_shared_ptr(new IfMineThenUseRequirement(UseFlagName(flag), id));
+ return make_shared_ptr(new IfMineThenUseRequirement(ChoiceNameWithPrefix(flag), id));
}
}
else if ('-' == flag.at(0))
@@ -406,10 +437,10 @@ namespace
flag.erase(0, 1);
if (flag.empty())
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return make_shared_ptr(new DisabledUseRequirement(UseFlagName(flag)));
+ return make_shared_ptr(new DisabledUseRequirement(ChoiceNameWithPrefix(flag)));
}
else
- return make_shared_ptr(new EnabledUseRequirement(UseFlagName(flag)));
+ return make_shared_ptr(new EnabledUseRequirement(ChoiceNameWithPrefix(flag)));
}
}
diff --git a/paludis/elike_use_requirement_TEST.cc b/paludis/elike_use_requirement_TEST.cc
index 02d21ca..8ca98ca 100644
--- a/paludis/elike_use_requirement_TEST.cc
+++ b/paludis/elike_use_requirement_TEST.cc
@@ -23,12 +23,28 @@
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/choice.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
+#include <list>
using namespace paludis;
using namespace test;
+namespace
+{
+ void set_conditionals(const std::tr1::shared_ptr<FakePackageID> & id, const std::string & s)
+ {
+ std::list<std::string> tokens;
+ tokenise_whitespace(s, std::back_inserter(tokens));
+
+ for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ id->choices_key()->add("", *t);
+ }
+}
+
namespace test_cases
{
struct SimpleUseRequirementsTest : TestCase
@@ -41,7 +57,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
- id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions());
+ set_conditionals(id, "enabled disabled");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_strict_parsing));
@@ -79,7 +95,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
- id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions());
+ set_conditionals(id, "enabled disabled");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("enabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax + euro_strict_parsing));
@@ -117,7 +133,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "pkg1", "1"));
- id->iuse_key()->set_from_string("enabled disabled", IUseFlagParseOptions());
+ set_conditionals(id, "enabled disabled");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("enabled,-disabled", std::tr1::shared_ptr<const PackageID>(), ELikeUseRequirementOptions() + euro_portage_syntax + euro_strict_parsing));
@@ -161,9 +177,9 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id, "pkgname");
std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
- id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id2, "pkgname");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing));
@@ -261,9 +277,9 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id, "pkgname");
std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
- id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id2, "pkgname");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing));
@@ -333,9 +349,9 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id, "pkgname");
std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
- id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id2, "pkgname");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing));
@@ -461,9 +477,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
-
- TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), NameError);
+ set_conditionals(id, "pkgname");
TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_strict_parsing), ELikeUseRequirementError);
@@ -490,9 +504,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
-
- TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), NameError);
+ set_conditionals(id, "pkgname");
TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax + euro_strict_parsing), ELikeUseRequirementError);
@@ -523,9 +535,7 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
-
- TEST_CHECK_THROWS(parse_elike_use_requirement("te/st", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), NameError);
+ set_conditionals(id, "pkgname");
TEST_CHECK_THROWS(parse_elike_use_requirement("", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
TEST_CHECK_THROWS(parse_elike_use_requirement("-", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_both_syntaxes + euro_strict_parsing), ELikeUseRequirementError);
@@ -551,9 +561,9 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id, "pkgname");
std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
- id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id2, "pkgname");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps));
@@ -679,9 +689,9 @@ namespace test_cases
std::tr1::shared_ptr<FakeRepository> fake(new FakeRepository(&env, RepositoryName("fake")));
env.package_database()->add_repository(1, fake);
std::tr1::shared_ptr<FakePackageID> id(fake->add_version("cat", "enabled", "1"));
- id->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id, "pkgname");
std::tr1::shared_ptr<FakePackageID> id2(fake->add_version("cat", "disabled", "1"));
- id2->iuse_key()->set_from_string("pkgname", IUseFlagParseOptions());
+ set_conditionals(id2, "pkgname");
std::tr1::shared_ptr<const AdditionalPackageDepSpecRequirement> req1(
parse_elike_use_requirement("pkgname?", id, ELikeUseRequirementOptions() + euro_allow_self_deps + euro_portage_syntax));
diff --git a/paludis/environment.hh b/paludis/environment.hh
index cc68aad..950ce3a 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -24,6 +24,7 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/options-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/tribool-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/hook-fwd.hh>
#include <paludis/repository-fwd.hh>
@@ -34,6 +35,7 @@
#include <paludis/package_database-fwd.hh>
#include <paludis/selection-fwd.hh>
#include <paludis/metadata_key_holder.hh>
+#include <paludis/choice-fwd.hh>
/** \file
* Declarations for the Environment class.
@@ -79,25 +81,39 @@ namespace paludis
///\}
- ///\name Use-related queries
+ ///\name Choice-related queries
///\{
/**
- * Is a particular use flag enabled for a particular package?
+ * Do we want a choice enabled for a particular package?
+ *
+ * Only for use by Repository, to get defaults from the environment.
+ * Clients should query the metadata key directly.
+ *
+ * The third parameter is the name of the value, which might not
+ * have been created yet.
*/
- virtual bool query_use(const UseFlagName &, const PackageID &) const
+ virtual const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
- * Return a collection of known use flag names for a particular package that start
- * with a particular use expand prefix.
+ * Return a collection of known value names for a particular
+ * choice.
+ *
+ * Only for use by Repository, to get defaults from the environment.
+ * Clients should query the metadata key directly.
*
- * It is up to subclasses to decide whether to return all known use flags with
- * the specified prefix or merely all enabled use flags. It is not safe to assume
- * that all flags in the returned value will be enabled for the specified package.
+ * This is to deal with cases like USE_EXPAND values, where the
+ * repository doesn't know all possible values.
*/
- virtual std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
+ virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
///\}
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index cde04cf..9b02684 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -140,35 +140,6 @@ EnvironmentImplementation::set(const SetName & s) const
return result;
}
-bool
-EnvironmentImplementation::query_use(const UseFlagName & f, const PackageID & e) const
-{
- if ((*e.repository()).use_interface())
- {
- if ((*e.repository()).use_interface()->query_use_mask(f, e))
- return false;
- if ((*e.repository()).use_interface()->query_use_force(f, e))
- return true;
-
- switch ((*e.repository()).use_interface()->query_use(f, e))
- {
- case use_disabled:
- case use_unspecified:
- return false;
-
- case use_enabled:
- return true;
-
- case last_use:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "bad state");
- }
- else
- return false;
-}
-
std::string
EnvironmentImplementation::distribution() const
{
diff --git a/paludis/environment_implementation.hh b/paludis/environment_implementation.hh
index d13d447..ae45c4a 100644
--- a/paludis/environment_implementation.hh
+++ b/paludis/environment_implementation.hh
@@ -64,9 +64,6 @@ namespace paludis
///\}
- virtual bool query_use(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::tr1::shared_ptr<const FSEntrySequence> bashrc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 6531582..324bd60 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -30,6 +30,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/distribution.hh>
#include <paludis/package_database.hh>
#include <paludis/hook.hh>
@@ -515,12 +516,6 @@ NoConfigEnvironment::hook_dirs() const
return make_shared_ptr(new FSEntrySequence);
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-NoConfigEnvironment::known_use_expand_names(const UseFlagName &, const PackageID &) const
-{
- return make_shared_ptr(new UseFlagNameSet);
-}
-
void
NoConfigEnvironment::need_keys_added() const
{
@@ -538,3 +533,22 @@ NoConfigEnvironment::config_location_key() const
return std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >();
}
+const Tribool
+NoConfigEnvironment::want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+{
+ return Tribool(indeterminate);
+}
+
+std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+NoConfigEnvironment::known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
+{
+ return make_shared_ptr(new Set<UnprefixedChoiceName>);
+}
+
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index 2c7d989..72b3ce6 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -107,6 +107,19 @@ namespace paludis
///\}
+ virtual const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
virtual std::tr1::shared_ptr<PackageDatabase> package_database()
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -118,10 +131,6 @@ namespace paludis
virtual void set_paludis_command(const std::string &);
- virtual std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual bool accept_license(const std::string &, const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index fc9a222..9532630 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -54,6 +54,7 @@
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/tribool.hh>
#include <tr1/functional>
#include <functional>
@@ -76,7 +77,6 @@ namespace paludis
std::tr1::shared_ptr<PaludisConfig> config;
std::string paludis_command;
- std::list<UseConfigEntry> forced_use;
std::tr1::shared_ptr<PackageDatabase> package_database;
@@ -165,63 +165,6 @@ PaludisEnvironment::~PaludisEnvironment()
}
bool
-PaludisEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
-{
- Context context("When querying use flag '" + stringify(f) + "' for '" + stringify(e) +
- "' in Paludis environment:");
-
- /* first check package database use masks... */
- if ((*e.repository()).use_interface())
- {
- if ((*e.repository()).use_interface()->query_use_mask(f, e))
- return false;
- if ((*e.repository()).use_interface()->query_use_force(f, e))
- return true;
- }
-
- /* check configs */
- do
- {
- switch (_imp->config->use_conf()->query(f, e))
- {
- case use_disabled:
- return false;
-
- case use_enabled:
- return true;
-
- case use_unspecified:
- continue;
-
- case last_use:
- ;
- }
- throw InternalError(PALUDIS_HERE, "bad state");
- } while (false);
-
- /* check use: package database config */
- if ((*e.repository()).use_interface())
- {
- switch ((*e.repository()).use_interface()->query_use(f, e))
- {
- case use_disabled:
- case use_unspecified:
- return false;
-
- case use_enabled:
- return true;
-
- case last_use:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "bad state");
- }
-
- return false;
-}
-
-bool
PaludisEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & k,
const PackageID & e) const
{
@@ -435,12 +378,6 @@ PaludisEnvironment::mirrors(const std::string & m) const
return _imp->config->mirrors_conf()->query(m);
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-PaludisEnvironment::known_use_expand_names(const UseFlagName & prefix, const PackageID & e) const
-{
- return _imp->config->use_conf()->known_use_expand_names(prefix, e);
-}
-
const FSEntry
PaludisEnvironment::root() const
{
@@ -582,3 +519,22 @@ PaludisEnvironment::config_location_key() const
return _imp->config_location_key;
}
+const Tribool
+PaludisEnvironment::want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & value
+ ) const
+{
+ return _imp->config->use_conf()->want_choice_enabled(id, choice, value);
+}
+
+std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+PaludisEnvironment::known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice
+ ) const
+{
+ return _imp->config->use_conf()->known_choice_value_names(id, choice);
+}
+
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index c6579bd..7993071 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -80,13 +80,6 @@ namespace paludis
///\}
- virtual bool query_use(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::tr1::shared_ptr<const FSEntrySequence> bashrc_files() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -156,6 +149,19 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+
+ virtual const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
#endif
diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc
index 0216792..057972e 100644
--- a/paludis/environments/paludis/paludis_environment_TEST.cc
+++ b/paludis/environments/paludis/paludis_environment_TEST.cc
@@ -30,6 +30,8 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/choice.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <cstdlib>
@@ -37,6 +39,17 @@
using namespace paludis;
using namespace test;
+namespace
+{
+ bool get_use(const std::string & f, const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ const std::tr1::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(f)));
+ if (! v)
+ return false;
+ return v->enabled();
+ }
+}
+
namespace test_cases
{
struct TestPaludisEnvironmentUse : TestCase
@@ -56,19 +69,19 @@ namespace test_cases
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-3",
env.get(), UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK(env->query_use(UseFlagName("foo"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), *one));
- TEST_CHECK(env->query_use(UseFlagName("moo"), *one));
- TEST_CHECK(env->query_use(UseFlagName("quoted-name"), *one));
+ TEST_CHECK(get_use("foo", one));
+ TEST_CHECK(! get_use("foofoo", one));
+ TEST_CHECK(get_use("moo", one));
+ TEST_CHECK(get_use("quoted-name", one));
- TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), *one));
- TEST_CHECK(env->query_use(UseFlagName("exp_two"), *one));
- TEST_CHECK(env->query_use(UseFlagName("exp_one"), *one));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), *one));
+ TEST_CHECK(get_use("more_exp_one", one));
+ TEST_CHECK(get_use("exp_two", one));
+ TEST_CHECK(get_use("exp_one", one));
+ TEST_CHECK(get_use("third_exp_one", one));
+ TEST_CHECK(! get_use("third_exp_two", one));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *three));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), *three));
+ TEST_CHECK(get_use("third_exp_one", three));
+ TEST_CHECK(get_use("third_exp_two", three));
}
} paludis_environment_use_test;
@@ -83,11 +96,18 @@ namespace test_cases
std::tr1::shared_ptr<Environment> env(new PaludisEnvironment(""));
- const std::tr1::shared_ptr<const PackageID> one(*(*env)[selection::RequireExactlyOne(
- generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
+ const std::tr1::shared_ptr<const PackageID> id1(*(*env)[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
env.get(), UserPackageDepSpecOptions()))))]->begin());
- std::tr1::shared_ptr<const UseFlagNameSet> k1(env->known_use_expand_names(UseFlagName("foo_cards"), *one));
- TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "foo_cards_one foo_cards_three foo_cards_two");
+ std::tr1::shared_ptr<const Choice> foo_cards;
+ for (Choices::ConstIterator c(id1->choices_key()->value()->begin()), c_end(id1->choices_key()->value()->end()) ;
+ c != c_end ; ++c)
+ if ((*c)->raw_name() == "FOO_CARDS")
+ foo_cards = *c;
+ if (! foo_cards)
+ throw InternalError(PALUDIS_HERE, "oops");
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > k1(env->known_choice_value_names(id1, foo_cards));
+ TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "one three two");
}
} paludis_environment_use_test_known;
@@ -109,18 +129,18 @@ namespace test_cases
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-3",
env.get(), UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK(env->query_use(UseFlagName("foo"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("moo"), *one));
+ TEST_CHECK(get_use("foo", one));
+ TEST_CHECK(! get_use("foofoo", one));
+ TEST_CHECK(! get_use("moo", one));
- TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), *one));
- TEST_CHECK(env->query_use(UseFlagName("exp_two"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("exp_one"), *one));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), *one));
+ TEST_CHECK(get_use("more_exp_one", one));
+ TEST_CHECK(get_use("exp_two", one));
+ TEST_CHECK(! get_use("exp_one", one));
+ TEST_CHECK(get_use("third_exp_one", one));
+ TEST_CHECK(! get_use("third_exp_two", one));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), *three));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), *three));
+ TEST_CHECK(! get_use("third_exp_one", three));
+ TEST_CHECK(get_use("third_exp_two", three));
}
} paludis_environment_use_test_minus_star;
@@ -142,18 +162,18 @@ namespace test_cases
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-two-3",
env.get(), UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK(env->query_use(UseFlagName("foo"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), *one));
- TEST_CHECK(env->query_use(UseFlagName("moo"), *one));
+ TEST_CHECK(get_use("foo", one));
+ TEST_CHECK(! get_use("foofoo", one));
+ TEST_CHECK(get_use("moo", one));
- TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), *one));
- TEST_CHECK(env->query_use(UseFlagName("exp_two"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("exp_one"), *one));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *one));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), *one));
+ TEST_CHECK(get_use("more_exp_one", one));
+ TEST_CHECK(get_use("exp_two", one));
+ TEST_CHECK(! get_use("exp_one", one));
+ TEST_CHECK(get_use("third_exp_one", one));
+ TEST_CHECK(! get_use("third_exp_two", one));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), *three));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), *three));
+ TEST_CHECK(! get_use("third_exp_one", three));
+ TEST_CHECK(get_use("third_exp_two", three));
}
} paludis_environment_use_test_minus_star_partial;
diff --git a/paludis/environments/paludis/use_conf.cc b/paludis/environments/paludis/use_conf.cc
index 5297510..6672075 100644
--- a/paludis/environments/paludis/use_conf.cc
+++ b/paludis/environments/paludis/use_conf.cc
@@ -37,6 +37,8 @@
#include <paludis/util/set.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/tribool.hh>
+#include <paludis/choice.hh>
#include <tr1/unordered_map>
#include <algorithm>
#include <list>
@@ -45,9 +47,11 @@
using namespace paludis;
using namespace paludis::paludis_environment;
-typedef std::tr1::unordered_map<UseFlagName, UseFlagState, Hash<UseFlagName> > UseFlagWithStateMap;
-typedef std::list<std::string> MinusStarPrefixList;
-typedef std::pair<UseFlagWithStateMap, MinusStarPrefixList> UseInfo;
+typedef std::pair<ChoicePrefixName, UnprefixedChoiceName> FlagNamePair;
+
+typedef std::tr1::unordered_map<FlagNamePair, Tribool, Hash<FlagNamePair> > FlagNamePairWithStateMap;
+typedef std::list<ChoicePrefixName> MinusStarPrefixList;
+typedef std::pair<FlagNamePairWithStateMap, MinusStarPrefixList> UseInfo;
typedef std::pair<std::tr1::shared_ptr<const PackageDepSpec>, UseInfo> PDSWithUseInfo;
typedef std::pair<std::tr1::shared_ptr<const SetSpecTree::ConstItem>, UseInfo> DSWithUseInfo;
typedef std::list<PDSWithUseInfo> PDSWithUseInfoList;
@@ -126,128 +130,119 @@ UseConf::add(const FSEntry & filename)
Qualified::iterator ii(_imp->qualified.insert(std::make_pair(*d->package_ptr(), PDSWithUseInfoList())).first);
PDSWithUseInfoList::iterator i(ii->second.insert(ii->second.end(), PDSWithUseInfo(d, UseInfo())));
- std::string prefix_upper, prefix_lower;
+ ChoicePrefixName prefix("");
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
{
if (*t == "-*")
- i->second.second.push_back(strip_trailing(prefix_lower, "_"));
+ i->second.second.push_back(prefix);
else if ('-' == t->at(0))
i->second.first.insert(std::make_pair(
- UseFlagName(prefix_lower + t->substr(1)), use_disabled)).first->second = use_disabled;
+ FlagNamePair(prefix, UnprefixedChoiceName(t->substr(1))), false)).first->second = false;
else if (':' == t->at(t->length() - 1))
{
- std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix_lower), &::tolower);
- std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix_upper), &::toupper);
- prefix_lower.append("_");
- prefix_upper.append("_");
+ std::string p;
+ std::transform(t->begin(), previous(t->end()), std::back_inserter(p), &::tolower);
+ prefix = ChoicePrefixName(p);
}
else
- i->second.first.insert(std::make_pair(UseFlagName(prefix_lower + *t), use_enabled)).first->second = use_enabled;
+ i->second.first.insert(std::make_pair(FlagNamePair(prefix, UnprefixedChoiceName(*t)), true)).first->second = true;
}
}
else
{
Unqualified::iterator i(_imp->unqualified.insert(_imp->unqualified.end(), PDSWithUseInfo(d, UseInfo())));
- std::string prefix_upper, prefix_lower;
+ ChoicePrefixName prefix("");
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
{
if (*t == "-*")
- i->second.second.push_back(strip_trailing(prefix_lower, "_"));
+ i->second.second.push_back(prefix);
else if ('-' == t->at(0))
i->second.first.insert(
- std::make_pair(UseFlagName(prefix_lower + t->substr(1)), use_disabled)).first->second = use_disabled;
+ std::make_pair(FlagNamePair(prefix, UnprefixedChoiceName(t->substr(1))), false)).first->second = false;
else if (':' == t->at(t->length() - 1))
{
- std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix_lower), &::tolower);
- std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix_upper), &::toupper);
- prefix_lower.append("_");
- prefix_upper.append("_");
+ std::string p;
+ std::transform(t->begin(), previous(t->end()), std::back_inserter(p), &::tolower);
+ prefix = ChoicePrefixName(p);
}
else
- i->second.first.insert(std::make_pair(UseFlagName(prefix_lower + *t), use_enabled)).first->second = use_enabled;
+ i->second.first.insert(std::make_pair(FlagNamePair(prefix, UnprefixedChoiceName(*t)), true)).first->second = true;
}
}
}
catch (const GotASetNotAPackageDepSpec &)
{
Sets::iterator i(_imp->sets.insert(std::make_pair(SetName(tokens.at(0)), DSWithUseInfo())).first);
- std::string prefix_upper, prefix_lower;
+ ChoicePrefixName prefix("");
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
{
if (*t == "-*")
- i->second.second.second.push_back(strip_trailing(prefix_lower, "_"));
+ i->second.second.second.push_back(prefix);
else if ('-' == t->at(0))
i->second.second.first.insert(std::make_pair(
- UseFlagName(prefix_lower + t->substr(1)), use_disabled)).first->second = use_disabled;
+ FlagNamePair(prefix, UnprefixedChoiceName(t->substr(1))), false)).first->second = false;
else if (':' == t->at(t->length() - 1))
{
- std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix_lower), &::tolower);
- std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix_upper), &::toupper);
- prefix_lower.append("_");
- prefix_upper.append("_");
+ std::string p;
+ std::transform(t->begin(), previous(t->end()), std::back_inserter(p), &::tolower);
+ prefix = ChoicePrefixName(p);
}
else
i->second.second.first.insert(std::make_pair(
- UseFlagName(prefix_lower + *t), use_enabled)).first->second = use_enabled;
+ FlagNamePair(prefix, UnprefixedChoiceName(*t)), true)).first->second = true;
}
}
}
}
-UseFlagState
-UseConf::query(const UseFlagName & f, const PackageID & e) const
+const Tribool
+UseConf::want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & f
+ ) const
{
- Context context("When checking state of flag '" + stringify(f) + "' for '" + stringify(e) + "':");
+ Context context("When checking state of flag prefix '" + stringify(choice->prefix()) +
+ "' name '" + stringify(f) + "' for '" + stringify(*id) + "':");
- UseFlagState result(use_unspecified);
+ Tribool result(indeterminate);
- bool ignore_empty_minus_star(false);
- if ((*e.repository()).use_interface())
- {
- 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()))
- {
- ignore_empty_minus_star = true;
- break;
- }
- }
+ bool ignore_empty_minus_star(! stringify(choice->prefix()).empty());
/* highest priority: specific */
- Qualified::const_iterator q(_imp->qualified.find(e.name()));
+ Qualified::const_iterator q(_imp->qualified.find(id->name()));
if (_imp->qualified.end() != q)
{
for (PDSWithUseInfoList::const_iterator p(q->second.begin()), p_end(q->second.end()) ; p != p_end ; ++p)
{
- if (! match_package(*_imp->env, *p->first, e))
+ if (! match_package(*_imp->env, *p->first, *id))
continue;
- UseFlagWithStateMap::const_iterator i(p->second.first.find(f));
+ FlagNamePairWithStateMap::const_iterator i(p->second.first.find(std::make_pair(choice->prefix(), f)));
if (p->second.first.end() != i)
result = i->second;
- if (use_unspecified == result)
+ if (result.is_indeterminate())
for (MinusStarPrefixList::const_iterator m(p->second.second.begin()), m_end(p->second.second.end()) ;
m != m_end ; ++m)
{
- if (m->empty() && ignore_empty_minus_star)
+ if (stringify(*m).empty() && ignore_empty_minus_star)
continue;
- if (0 == m->compare(0, m->length(), stringify(f), 0, m->length()))
+ if (choice->prefix() == *m)
{
- result = use_disabled;
+ result = false;
break;
}
}
}
}
- if (use_unspecified != result)
+ if (! result.is_indeterminate())
return result;
/* next: named sets */
@@ -266,52 +261,52 @@ UseConf::query(const UseFlagName & f, const PackageID & e) const
}
}
- if (! match_package_in_set(*_imp->env, *r->second.first, e))
+ if (! match_package_in_set(*_imp->env, *r->second.first, *id))
continue;
- UseFlagWithStateMap::const_iterator i(r->second.second.first.find(f));
+ FlagNamePairWithStateMap::const_iterator i(r->second.second.first.find(std::make_pair(choice->prefix(), f)));
if (i != r->second.second.first.end())
result = i->second;
- if (use_unspecified == result)
+ if (result.is_indeterminate())
for (MinusStarPrefixList::const_iterator m(r->second.second.second.begin()), m_end(r->second.second.second.end()) ;
m != m_end ; ++m)
{
- if (m->empty() && ignore_empty_minus_star)
+ if (stringify(*m).empty() && ignore_empty_minus_star)
continue;
- if (0 == m->compare(0, m->length(), stringify(f), 0, m->length()))
+ if (choice->prefix() == *m)
{
- result = use_disabled;
+ result = false;
break;
}
}
}
- if (use_unspecified != result)
+ if (! result.is_indeterminate())
return result;
/* last: unspecific */
for (Unqualified::const_iterator p(_imp->unqualified.begin()), p_end(_imp->unqualified.end()) ; p != p_end ; ++p)
{
- if (! match_package(*_imp->env, *p->first, e))
+ if (! match_package(*_imp->env, *p->first, *id))
continue;
- UseFlagWithStateMap::const_iterator i(p->second.first.find(f));
+ FlagNamePairWithStateMap::const_iterator i(p->second.first.find(std::make_pair(choice->prefix(), f)));
if (p->second.first.end() != i)
result = i->second;
- if (use_unspecified == result)
+ if (result.is_indeterminate())
for (MinusStarPrefixList::const_iterator m(p->second.second.begin()), m_end(p->second.second.end()) ;
m != m_end ; ++m)
{
- if (m->empty() && ignore_empty_minus_star)
+ if (stringify(*m).empty() && ignore_empty_minus_star)
continue;
- if (0 == m->compare(0, m->length(), stringify(f), 0, m->length()))
+ if (choice->prefix() == *m)
{
- result = use_disabled;
+ result = false;
break;
}
}
@@ -320,27 +315,27 @@ UseConf::query(const UseFlagName & f, const PackageID & e) const
return result;
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-UseConf::known_use_expand_names(const UseFlagName & prefix, const PackageID & e) const
+std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+UseConf::known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice
+ ) const
{
- Context context("When loading known use expand names for prefix '" + stringify(prefix) + ":");
+ Context context("When loading known use expand names for prefix '" + stringify(choice->prefix()) + ":");
- std::tr1::shared_ptr<UseFlagNameSet> result(new UseFlagNameSet);
- std::string prefix_lower;
- std::transform(prefix.data().begin(), prefix.data().end(), std::back_inserter(prefix_lower), &::tolower);
- prefix_lower.append("_");
+ std::tr1::shared_ptr<Set<UnprefixedChoiceName> > result(new Set<UnprefixedChoiceName>);
- Qualified::const_iterator q(_imp->qualified.find(e.name()));
+ Qualified::const_iterator q(_imp->qualified.find(id->name()));
if (_imp->qualified.end() != q)
for (PDSWithUseInfoList::const_iterator p(q->second.begin()), p_end(q->second.end()) ; p != p_end ; ++p)
{
- if (! match_package(*_imp->env, *p->first, e))
+ if (! match_package(*_imp->env, *p->first, *id))
continue;
- for (UseFlagWithStateMap::const_iterator i(p->second.first.begin()), i_end(p->second.first.end()) ;
+ for (FlagNamePairWithStateMap::const_iterator i(p->second.first.begin()), i_end(p->second.first.end()) ;
i != i_end ; ++i)
- if (0 == i->first.data().compare(0, prefix_lower.length(), prefix_lower))
- result->insert(i->first);
+ if (i->first.first == choice->prefix())
+ result->insert(i->first.second);
}
{
@@ -359,25 +354,25 @@ UseConf::known_use_expand_names(const UseFlagName & prefix, const PackageID & e)
}
}
- if (! match_package_in_set(*_imp->env, *r->second.first, e))
+ if (! match_package_in_set(*_imp->env, *r->second.first, *id))
continue;
- for (UseFlagWithStateMap::const_iterator i(r->second.second.first.begin()), i_end(r->second.second.first.end()) ;
+ for (FlagNamePairWithStateMap::const_iterator i(r->second.second.first.begin()), i_end(r->second.second.first.end()) ;
i != i_end ; ++i)
- if (0 == i->first.data().compare(0, prefix_lower.length(), prefix_lower))
- result->insert(i->first);
+ if (i->first.first == choice->prefix())
+ result->insert(i->first.second);
}
}
for (Unqualified::const_iterator p(_imp->unqualified.begin()), p_end(_imp->unqualified.end()) ; p != p_end ; ++p)
{
- if (! match_package(*_imp->env, *p->first, e))
+ if (! match_package(*_imp->env, *p->first, *id))
continue;
- for (UseFlagWithStateMap::const_iterator i(p->second.first.begin()), i_end(p->second.first.end()) ;
+ for (FlagNamePairWithStateMap::const_iterator i(p->second.first.begin()), i_end(p->second.first.end()) ;
i != i_end ; ++i)
- if (0 == i->first.data().compare(0, prefix_lower.length(), prefix_lower))
- result->insert(i->first);
+ if (i->first.first == choice->prefix())
+ result->insert(i->first.second);
}
return result;
diff --git a/paludis/environments/paludis/use_conf.hh b/paludis/environments/paludis/use_conf.hh
index cd5cc75..c5f6a88 100644
--- a/paludis/environments/paludis/use_conf.hh
+++ b/paludis/environments/paludis/use_conf.hh
@@ -23,6 +23,8 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/util/tribool-fwd.hh>
+#include <paludis/choice-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
@@ -56,17 +58,17 @@ namespace paludis
*/
void add(const FSEntry &);
- /**
- * Query a use flag.
- */
- UseFlagState query(const UseFlagName &, const PackageID &) const
+ const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- /**
- * Fetch the known use expand names for a prefix.
- */
- std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/environments/paludis/use_config_entry.sr b/paludis/environments/paludis/use_config_entry.sr
index 3abaf8d..4ca8964 100644
--- a/paludis/environments/paludis/use_config_entry.sr
+++ b/paludis/environments/paludis/use_config_entry.sr
@@ -1,41 +1,6 @@
#!/usr/bin/env bash
# vim: set sw=4 sts=4 et :
-make_class_UseConfigEntry()
-{
- key dep_spec "std::tr1::shared_ptr<const PackageDepSpec>"
- key flag_name UseFlagName
- key flag_state UseFlagState
-
- doxygen_comment << "END"
- /**
- * Represents a PaludisConfig package use configuration entry.
- *
- * \see PaludisConfig
- * \ingroup grppaludisconfig
- * \nosubgrouping
- */
-END
-}
-
-make_class_SetUseConfigEntry()
-{
- key set_name "std::tr1::shared_ptr<const SetName>"
- key dep_spec "std::tr1::shared_ptr<const DepSpec>"
- key flag_name UseFlagName
- key flag_state UseFlagState
-
- doxygen_comment << "END"
- /**
- * Represents a PaludisConfig set use configuration entry.
- *
- * \see PaludisConfig
- * \ingroup grppaludisconfig
- * \nosubgrouping
- */
-END
-}
-
make_class_SetUseConfigMinusStarEntry()
{
key set_name "std::tr1::shared_ptr<const SetName>"
diff --git a/paludis/environments/portage/Makefile.am b/paludis/environments/portage/Makefile.am
index 0cfe0ff..eb0a9dc 100644
--- a/paludis/environments/portage/Makefile.am
+++ b/paludis/environments/portage/Makefile.am
@@ -40,16 +40,26 @@ EXTRA_DIST = \
TESTS = portage_environment_TEST
TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/e/ebuild/" \
- PALUDIS_SKIP_CONFIG="yes" \
+ TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
+ PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
+ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/e/ebuild/`" \
+ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/ebuild/`" \
+ PALUDIS_EXTRA_EBUILD_MODULES_DIRS="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \
PALUDIS_SUFFIXES_FILE="$(top_srcdir)/paludis/repositories/e/ebuild_entries_suffixes.conf" \
PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
PALUDIS_DISTRIBUTION="gentoo" \
PALUDIS_OPTIONS="" \
- PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
+ PALUDIS_FETCHERS_DIR="$(top_srcdir)/paludis/fetchers/" \
+ PALUDIS_SKIP_CONFIG="yes" \
TEST_SCRIPT_DIR="$(srcdir)/" \
+ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
+ PALUDIS_NO_CHOWN="yes" \
+ PALUDIS_TESTS_KEEP_STDERR="yes" \
SYSCONFDIR="$(sysconfdir)" \
+ LD_LIBRARY_PATH="`echo $$LD_LIBRARY_PATH: | sed -e 's,^:,,'`` \
+ $(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/`:` \
+ $(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/.libs/`" \
bash $(top_srcdir)/test/run_test.sh
portage_environment_TEST_SOURCES = portage_environment_TEST.cc
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 961f9bd..179c922 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -36,6 +36,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/config_file.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/hooker.hh>
#include <paludis/hook.hh>
#include <paludis/mask.hh>
@@ -48,6 +49,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <functional>
#include <algorithm>
@@ -544,64 +546,42 @@ PortageEnvironment::~PortageEnvironment()
{
}
-bool
-PortageEnvironment::query_use(const UseFlagName & f, const PackageID & e) const
+const Tribool
+PortageEnvironment::want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & suffix) const
{
- Context context("When querying use flag '" + stringify(f) + "' for '" + stringify(e) +
+ Context context("When querying flag '" + stringify(suffix) + "' for choice '" + choice->human_name() + "' for ID '" + stringify(*id) +
"' in Portage environment:");
- /* first check package database use masks... */
- if ((*e.repository()).use_interface())
- {
- if ((*e.repository()).use_interface()->query_use_mask(f, e))
- return false;
- if ((*e.repository()).use_interface()->query_use_force(f, e))
- return true;
- }
-
- UseFlagState state(use_unspecified);
-
- /* check use: repo */
- if ((*e.repository()).use_interface())
- state = (*e.repository()).use_interface()->query_use(f, e);
+ Tribool state(indeterminate);
+ ChoiceNameWithPrefix f(stringify(choice->prefix()) + (stringify(choice->prefix()).empty() ? "" : "_") + stringify(suffix));
/* 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()) ;
i != i_end ; ++i)
if (*i == "-*")
- state = use_disabled;
+ state = false;
else if (*i == stringify(f))
- state = use_enabled;
+ state = true;
else if (*i == "-" + stringify(f))
- state = use_disabled;
+ state = false;
/* check use: per package config */
for (PackageUse::const_iterator i(_imp->package_use.begin()), i_end(_imp->package_use.end()) ;
i != i_end ; ++i)
{
- if (! match_package(*this, *i->first, e))
+ if (! match_package(*this, *i->first, *id))
continue;
if (i->second == stringify(f))
- state = use_enabled;
+ state = true;
else if (i->second == "-" + stringify(f))
- state = use_disabled;
+ state = false;
}
- switch (state)
- {
- case use_disabled:
- case use_unspecified:
- return false;
-
- case use_enabled:
- return true;
-
- case last_use:
- ;
- }
-
- throw InternalError(PALUDIS_HERE, "bad state");
+ return state;
}
std::string
@@ -675,36 +655,30 @@ PortageEnvironment::unmasked_by_user(const PackageID & e) const
return false;
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-PortageEnvironment::known_use_expand_names(const UseFlagName & prefix,
- const PackageID & pde) const
+std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+PortageEnvironment::known_choice_value_names(const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice) const
{
- Context context("When loading known use expand names for prefix '" + stringify(prefix) + ":");
+ Context context("When loading known use expand names for prefix '" + stringify(choice->prefix()) + ":");
- std::tr1::shared_ptr<UseFlagNameSet> result(new UseFlagNameSet);
- std::string prefix_lower;
- std::transform(prefix.data().begin(), prefix.data().end(), std::back_inserter(prefix_lower), &::tolower);
- prefix_lower.append("_");
+ std::tr1::shared_ptr<Set<UnprefixedChoiceName> > result(new Set<UnprefixedChoiceName>);
+ std::string prefix_lower(stringify(choice->prefix()) + "_");
for (std::list<std::string>::const_iterator i(_imp->use_with_expands.begin()),
i_end(_imp->use_with_expands.end()) ; i != i_end ; ++i)
if (0 == i->compare(0, prefix_lower.length(), prefix_lower, 0, prefix_lower.length()))
- result->insert(UseFlagName(*i));
+ result->insert(UnprefixedChoiceName(i->substr(prefix_lower.length())));
for (PackageUse::const_iterator i(_imp->package_use.begin()), i_end(_imp->package_use.end()) ;
i != i_end ; ++i)
{
- if (! match_package(*this, *i->first, pde))
+ if (! match_package(*this, *i->first, *id))
continue;
if (0 == i->second.compare(0, prefix_lower.length(), prefix_lower, 0, prefix_lower.length()))
- result->insert(UseFlagName(i->second));
+ result->insert(UnprefixedChoiceName(i->second.substr(prefix_lower.length())));
}
- Log::get_instance()->message("portage_environment.known_use_expand_names", ll_debug, lc_no_context)
- << "PortageEnvironment::known_use_expand_names("
- << prefix << ", " << pde << ") -> (" << join(result->begin(), result->end(), ", ") << ")";
-
return result;
}
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index 52bbb60..b27dcdd 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -97,11 +97,17 @@ namespace paludis
///\}
- virtual bool query_use(const UseFlagName &, const PackageID &) const
+ virtual const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
+ virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual std::tr1::shared_ptr<const FSEntrySequence> bashrc_files() const
diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc
index 01dd9b1..d8e89d3 100644
--- a/paludis/environments/portage/portage_environment_TEST.cc
+++ b/paludis/environments/portage/portage_environment_TEST.cc
@@ -34,6 +34,8 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/choice.hh>
using namespace paludis;
using namespace test;
@@ -59,6 +61,14 @@ namespace
kk->insert(k);
return env.accept_keywords(kk, e);
}
+
+ bool get_use(const std::string & f, const Environment &, const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ const std::tr1::shared_ptr<const ChoiceValue> v(id->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(f)));
+ if (! v)
+ return false;
+ return v->enabled();
+ }
}
namespace test_cases
@@ -69,7 +79,7 @@ namespace test_cases
void run()
{
- PortageEnvironment env("portage_environment_TEST_dir/query_use");
+ PortageEnvironment env(stringify(FSEntry("portage_environment_TEST_dir/query_use").realpath()));
const std::tr1::shared_ptr<const PackageID> idx(*env[selection::RequireExactlyOne(
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-x-1",
@@ -79,19 +89,19 @@ namespace test_cases
generator::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
&env, UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK(env.query_use(UseFlagName("one"), *idx));
- TEST_CHECK(env.query_use(UseFlagName("two"), *idx));
- TEST_CHECK(! env.query_use(UseFlagName("three"), *idx));
- TEST_CHECK(! env.query_use(UseFlagName("four"), *idx));
- TEST_CHECK(! env.query_use(UseFlagName("five"), *idx));
- TEST_CHECK(! env.query_use(UseFlagName("six"), *idx));
-
- TEST_CHECK(! env.query_use(UseFlagName("one"), *id1));
- TEST_CHECK(env.query_use(UseFlagName("two"), *id1));
- TEST_CHECK(! env.query_use(UseFlagName("three"), *id1));
- TEST_CHECK(env.query_use(UseFlagName("four"), *id1));
- TEST_CHECK(! env.query_use(UseFlagName("five"), *id1));
- TEST_CHECK(! env.query_use(UseFlagName("six"), *id1));
+ TEST_CHECK(get_use("one", env, idx));
+ TEST_CHECK(get_use("two", env, idx));
+ TEST_CHECK(! get_use("three", env, idx));
+ TEST_CHECK(! get_use("four", env, idx));
+ TEST_CHECK(! get_use("five", env, idx));
+ TEST_CHECK(! get_use("six", env, idx));
+
+ TEST_CHECK(! get_use("one", env, id1));
+ TEST_CHECK(get_use("two", env, id1));
+ TEST_CHECK(! get_use("three", env, id1));
+ TEST_CHECK(get_use("four", env, id1));
+ TEST_CHECK(! get_use("five", env, id1));
+ TEST_CHECK(! get_use("six", env, id1));
}
} test_query_use;
@@ -101,13 +111,20 @@ namespace test_cases
void run()
{
- PortageEnvironment env("portage_environment_TEST_dir/known_use_expand_names");
+ PortageEnvironment env(stringify(FSEntry("portage_environment_TEST_dir/known_use_expand_names").realpath()));
const std::tr1::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
&env, UserPackageDepSpecOptions()))))]->begin());
- std::tr1::shared_ptr<const UseFlagNameSet> k1(env.known_use_expand_names(UseFlagName("foo_cards"), *id1));
- TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "foo_cards_one foo_cards_three");
+ std::tr1::shared_ptr<const Choice> foo_cards;
+ for (Choices::ConstIterator c(id1->choices_key()->value()->begin()), c_end(id1->choices_key()->value()->end()) ;
+ c != c_end ; ++c)
+ if ((*c)->raw_name() == "FOO_CARDS")
+ foo_cards = *c;
+ if (! foo_cards)
+ throw InternalError(PALUDIS_HERE, "oops");
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > k1(env.known_choice_value_names(id1, foo_cards));
+ TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "one three");
}
} test_known_use_expand;
diff --git a/paludis/environments/portage/portage_environment_TEST_setup.sh b/paludis/environments/portage/portage_environment_TEST_setup.sh
index 4f4d767..c103db9 100755
--- a/paludis/environments/portage/portage_environment_TEST_setup.sh
+++ b/paludis/environments/portage/portage_environment_TEST_setup.sh
@@ -21,11 +21,11 @@ cat <<"END" > repo/profiles/repo_name
repo
END
echo cat-one > repo/profiles/categories
-touch repo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
-touch repo/cat-one/pkg-two/pkg-two-1.ebuild || exit 4
-touch repo/cat-one/pkg-three/pkg-three-1.ebuild || exit 4
-touch repo/cat-one/pkg-four/pkg-four-1.ebuild || exit 4
-touch repo/cat-one/pkg-x/pkg-x-1.ebuild || exit 4
+echo -e "IUSE='one two three four five six'\nSLOT='0'\n" > repo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
+echo -e "IUSE='one two three four five six'\nSLOT='0'\n" > repo/cat-one/pkg-two/pkg-two-1.ebuild || exit 4
+echo -e "IUSE='one two three four five six'\nSLOT='0'\n" > repo/cat-one/pkg-three/pkg-three-1.ebuild || exit 4
+echo -e "IUSE='one two three four five six'\nSLOT='0'\n" > repo/cat-one/pkg-four/pkg-four-1.ebuild || exit 4
+echo -e "IUSE='one two three four five six'\nSLOT='0'\n" > repo/cat-one/pkg-x/pkg-x-1.ebuild || exit 4
mkdir -p query_use/${SYSCONFDIR}/portage
ln -s $(pwd )/profile query_use/${SYSCONFDIR}/make.profile
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 03440d8..0a7a5aa 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -26,6 +26,7 @@
#include <paludis/util/hashes.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/hook.hh>
@@ -75,15 +76,6 @@ TestEnvironment::~TestEnvironment()
}
bool
-TestEnvironment::query_use(const UseFlagName & u, const PackageID & p) const
-{
- if (UseFlagName("pkgname") == u)
- return PackageNamePart("enabled") == p.name().package;
-
- return (std::string::npos != u.data().find("enabled"));
-}
-
-bool
TestEnvironment::accept_keywords(const std::tr1::shared_ptr<const KeywordNameSet> & k, const PackageID &) const
{
return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"));
@@ -205,12 +197,6 @@ TestEnvironment::unmasked_by_user(const PackageID &) const
return false;
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-TestEnvironment::known_use_expand_names(const UseFlagName &, const PackageID &) const
-{
- return make_shared_ptr(new UseFlagNameSet);
-}
-
std::tr1::shared_ptr<SetSpecTree::ConstItem>
TestEnvironment::world_set() const
{
@@ -281,3 +267,37 @@ TestEnvironment::add_set(const SetName & s, const std::string & members_str)
_imp->sets[s] = top;
}
+const Tribool
+TestEnvironment::want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName & v
+ ) const
+{
+ if (stringify(v) == "pkgname")
+ {
+ if ("enabled" == stringify(id->name().package))
+ return Tribool(true);
+ else if ("disabled" == stringify(id->name().package))
+ return Tribool(false);
+ else
+ return Tribool(indeterminate);
+ }
+
+ if (std::string::npos != stringify(v).find("enabled"))
+ return Tribool(true);
+ else if (std::string::npos != stringify(v).find("disabled"))
+ return Tribool(false);
+ else
+ return Tribool(indeterminate);
+}
+
+std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+TestEnvironment::known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
+{
+ return make_shared_ptr(new Set<UnprefixedChoiceName>);
+}
+
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 5d25636..09bafad 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -66,9 +66,6 @@ namespace paludis
///\}
- virtual bool query_use(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::tr1::shared_ptr<PackageDatabase> package_database()
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -86,10 +83,6 @@ namespace paludis
const std::tr1::shared_ptr<const PackageID> fetch_package_id(const QualifiedPackageName &,
const VersionSpec &, const RepositoryName &) const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual bool accept_license(const std::string &, const PackageID &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -132,6 +125,20 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
void add_set(const SetName &, const std::string &);
+
+ virtual const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
};
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index dbde27f..7c74524 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -9,9 +9,10 @@ dnl `test', `impl', `testscript'. Note that there isn't much error checking done
dnl on this file at present...
add(`about', `hh', `test')
-add(`action', `hh', `cc', `fwd', `se')
+add(`action', `hh', `cc', `fwd')
add(`action_names', `hh', `cc', `fwd')
add(`condition_tracker', `hh', `cc')
+add(`choice', `hh', `cc', `fwd')
add(`contents', `hh', `cc', `fwd')
add(`dep_label', `hh', `cc', `fwd')
add(`dep_list', `hh', `cc', `fwd', `sr', `test', `fwd')
@@ -22,6 +23,7 @@ add(`dep_spec_flattener', `hh', `cc')
add(`dep_tree', `hh', `cc', `fwd')
add(`dep_tag', `hh', `cc', `fwd', `sr')
add(`distribution', `hh', `cc', `impl', `fwd')
+add(`elike_choices', `hh', `cc', `fwd')
add(`elike_dep_parser', `hh', `cc', `fwd', `test')
add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
@@ -49,7 +51,7 @@ add(`merger', `hh', `cc', `fwd', `se', `test', `tests
add(`merger_entry_type', `hh', `cc', `se')
add(`metadata_key', `hh', `cc', `se', `fwd')
add(`metadata_key_holder', `hh', `cc', `fwd')
-add(`name', `hh', `cc', `fwd', `test', `sr', `se')
+add(`name', `hh', `cc', `fwd', `test', `sr')
add(`ndbam', `hh', `cc', `fwd')
add(`ndbam_merger', `hh', `cc')
add(`ndbam_unmerger', `hh', `cc')
diff --git a/paludis/formatter.hh b/paludis/formatter.hh
index 82cbcba..ce5ab4f 100644
--- a/paludis/formatter.hh
+++ b/paludis/formatter.hh
@@ -23,6 +23,7 @@
#include <paludis/formatter-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/choice-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/util/attributes.hh>
#include <string>
@@ -190,21 +191,10 @@ namespace paludis
* particular class.
*
* \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct IUseRoles;
-
- /**
- * Used by CategorySelector<> to declare that format::Plain,
- * format::Enabled, format::Disabled, format::Forced and format::Masked
- * are the roles supported by a particular class.
- *
- * \ingroup g_formatters
- * \since 0.26
+ * \since 0.32
* \nosubgrouping
*/
- struct UseRoles;
+ struct ChoiceRoles;
/**
* Used by CategorySelector<> to declare that format::Plain,
@@ -257,35 +247,21 @@ namespace paludis
};
/**
- * IUseFlag supports IUseRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<IUseFlag>
- {
- /// The roles this type supports.
- typedef IUseRoles Category;
- };
-
- /**
- * UseFlagName supports UseRoles.
+ * ChoiceValue supports ChoiceRoles.
*
* \ingroup g_formatters
- * \since 0.26
+ * \since 0.32
* \nosubgrouping
*/
template <>
- struct CategorySelector<UseFlagName>
+ struct CategorySelector<ChoiceValue>
{
/// The roles this type supports.
- typedef UseRoles Category;
+ typedef ChoiceRoles Category;
};
/**
- * ConditionalDepSpec supports UseRoles.
+ * ConditionalDepSpec supports ChoiceRoles.
*
* \ingroup g_formatters
* \since 0.26
@@ -295,7 +271,7 @@ namespace paludis
struct CategorySelector<ConditionalDepSpec>
{
/// The roles this type supports.
- typedef UseRoles Category;
+ typedef ChoiceRoles Category;
};
/**
@@ -497,70 +473,14 @@ namespace paludis
/**
* Base class for anything that implements the format functions for
- * format::UseRoles on type T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- class PALUDIS_VISIBLE CanFormatBase<T_, format::UseRoles>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormatBase()
- {
- }
-
- virtual ~CanFormatBase()
- {
- }
-
- ///\}
-
- /**
- * Format this item as 'Plain'.
- */
- virtual std::string format(const T_ &, const format::Plain &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Enabled'.
- */
- virtual std::string format(const T_ &, const format::Enabled &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Disabled'.
- */
- virtual std::string format(const T_ &, const format::Disabled &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Forced'.
- */
- virtual std::string format(const T_ &, const format::Forced &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Masked'.
- */
- virtual std::string format(const T_ &, const format::Masked &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
- * Base class for anything that implements the format functions for
- * format::IUseRoles on type T_.
+ * format::ChoiceRoles on type T_.
*
* \ingroup g_formatters
* \since 0.26
* \nosubgrouping
*/
template <typename T_>
- class PALUDIS_VISIBLE CanFormatBase<T_, format::IUseRoles>
+ class PALUDIS_VISIBLE CanFormatBase<T_, format::ChoiceRoles>
{
public:
///\name Basic operations
@@ -825,62 +745,11 @@ namespace paludis
* Used by Formatter to implement the CanFormat<T_> interface.
*
* \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_, unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::UseRoles, u_> :
- public CanFormat<T_>
- {
- private:
- const CanFormat<T_> * const _proxy;
-
- public:
- ///\name Basic operations
- ///\{
-
- FormatFunctionsByProxy(const CanFormat<T_> * const p) :
- _proxy(p)
- {
- }
-
- ///\}
-
- virtual std::string format(const T_ & s, const format::Plain & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Enabled & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Disabled & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Forced & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Masked & p) const
- {
- return _proxy->format(s, p);
- }
- };
-
- /**
- * Used by Formatter to implement the CanFormat<T_> interface.
- *
- * \ingroup g_formatters
- * \since 0.26
+ * \since 0.32
* \nosubgrouping
*/
template <typename T_, unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::IUseRoles, u_> :
+ class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::ChoiceRoles, u_> :
public CanFormat<T_>
{
private:
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index f9b05fc..d95c857 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -100,8 +100,6 @@ namespace paludis
)),
install_options(
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>()),
value_for<n::used_this_for_config_protect>(std::tr1::bind(
&Implementation<InstallTask>::assign_config_protect,
@@ -1143,18 +1141,6 @@ InstallTask::set_preserve_world(const bool value)
}
void
-InstallTask::set_debug_mode(const InstallActionDebugOption value)
-{
- _imp->install_options.debug_build() = value;
-}
-
-void
-InstallTask::set_checks_mode(const InstallActionChecksOption value)
-{
- _imp->install_options.checks() = value;
-}
-
-void
InstallTask::set_add_to_world_spec(const std::string & value)
{
_imp->add_to_world_spec.reset(new std::string(value));
diff --git a/paludis/install_task.hh b/paludis/install_task.hh
index 3c1fe1e..f89a467 100644
--- a/paludis/install_task.hh
+++ b/paludis/install_task.hh
@@ -97,8 +97,6 @@ namespace paludis
void set_fetch_only(const bool value);
void set_pretend(const bool value);
void set_preserve_world(const bool value);
- void set_debug_mode(const InstallActionDebugOption value);
- void set_checks_mode(const InstallActionChecksOption value);
void set_add_to_world_spec(const std::string &);
void set_safe_resume(const bool);
void set_continue_on_failure(const InstallTaskContinueOnFailure);
diff --git a/paludis/metadata_key-fwd.hh b/paludis/metadata_key-fwd.hh
index e9ace57..d7f481d 100644
--- a/paludis/metadata_key-fwd.hh
+++ b/paludis/metadata_key-fwd.hh
@@ -38,7 +38,6 @@ namespace paludis
class MetadataSectionKey;
class MetadataTimeKey;
template <typename C_> class MetadataCollectionKey;
- template <> class MetadataCollectionKey<IUseFlagSet>;
template <typename C_> class MetadataSpecTreeKey;
template <typename V_> class MetadataValueKey;
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index a27571e..fd7241d 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -117,11 +117,6 @@ ExtraMetadataValueKeyMethods<std::tr1::shared_ptr<const PackageID> >::~ExtraMeta
{
}
-MetadataCollectionKey<IUseFlagSet>::MetadataCollectionKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
- MetadataKey(r, h, t)
-{
-}
-
template <typename C_>
MetadataSpecTreeKey<C_>::MetadataSpecTreeKey(const std::string & r, const std::string & h, const MetadataKeyType t) :
MetadataKey(r, h, t)
@@ -139,12 +134,8 @@ MetadataSpecTreeKey<DependencySpecTree>::MetadataSpecTreeKey(const std::string &
}
template class MetadataCollectionKey<KeywordNameSet>;
-#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
-template class MetadataCollectionKey<IUseFlagSet>;
-#endif
template class MetadataCollectionKey<Set<std::string> >;
template class MetadataCollectionKey<Sequence<std::string> >;
-template class MetadataCollectionKey<UseFlagNameSet>;
template class MetadataCollectionKey<PackageIDSequence>;
template class MetadataCollectionKey<FSEntrySequence>;
@@ -164,4 +155,5 @@ template class MetadataValueKey<FSEntry>;
template class MetadataValueKey<std::tr1::shared_ptr<const PackageID> >;
template class MetadataValueKey<std::tr1::shared_ptr<const Contents> >;
template class MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> >;
+template class MetadataValueKey<std::tr1::shared_ptr<const Choices> >;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 62c9f87..a404fc8 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -30,6 +30,7 @@
#include <paludis/repository-fwd.hh>
#include <paludis/formatter-fwd.hh>
#include <paludis/metadata_key_holder.hh>
+#include <paludis/choice-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/instantiation_policy.hh>
@@ -62,8 +63,6 @@ namespace paludis
VisitorTypes<
MetadataKeyVisitorTypes,
MetadataKey,
- MetadataCollectionKey<UseFlagNameSet>,
- MetadataCollectionKey<IUseFlagSet>,
MetadataCollectionKey<KeywordNameSet>,
MetadataCollectionKey<Set<std::string> >,
MetadataCollectionKey<Sequence<std::string> >,
@@ -82,6 +81,7 @@ namespace paludis
MetadataValueKey<std::tr1::shared_ptr<const PackageID> >,
MetadataValueKey<std::tr1::shared_ptr<const Contents> >,
MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> >,
+ MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
MetadataTimeKey,
MetadataSectionKey
>
@@ -344,58 +344,6 @@ namespace paludis
};
/**
- * A MetadataCollectionKey<IUseFlagSet> is a MetadataKey that holds an IUseFlagSet
- * as its value.
- *
- * This specialisation of MetadataCollectionKey provides an additional
- * pretty_print_flat_with_comparison method.
- *
- * \ingroup g_metadata_key
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- class PALUDIS_VISIBLE MetadataCollectionKey<IUseFlagSet> :
- public MetadataKey,
- public ConstAcceptInterfaceVisitsThis<MetadataKeyVisitorTypes, MetadataCollectionKey<IUseFlagSet> >
- {
- protected:
- ///\name Basic operations
- ///\{
-
- MetadataCollectionKey(const std::string &, const std::string &, const MetadataKeyType);
-
- ///\}
-
- public:
- /**
- * Fetch our value.
- */
- virtual const std::tr1::shared_ptr<const IUseFlagSet> value() const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Return a single-line formatted version of our value, using the
- * supplied Formatter to format individual items.
- */
- virtual std::string pretty_print_flat(const Formatter<IUseFlag> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Return a single-line formatted version of our value, using the
- * supplied Formatter to format individual items, and the supplied
- * PackageID to decorate using format::Added and format::Changed as
- * appropriate.
- */
- virtual std::string pretty_print_flat_with_comparison(
- const Environment * const,
- const std::tr1::shared_ptr<const PackageID> &,
- const Formatter<IUseFlag> &
- ) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
* A MetadataSpecTreeKey<> is a MetadataKey that holds a spec tree of some
* kind as its value.
*
diff --git a/paludis/name-fwd.hh b/paludis/name-fwd.hh
index ae3a0fa..4ad1fa2 100644
--- a/paludis/name-fwd.hh
+++ b/paludis/name-fwd.hh
@@ -24,7 +24,6 @@
#include <paludis/util/set-fwd.hh>
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/attributes.hh>
-#include <paludis/util/options-fwd.hh>
#include <string>
/** \file
@@ -71,36 +70,7 @@ namespace paludis
*/
typedef Set<CategoryNamePart> CategoryNamePartSet;
- class UseFlagNameError;
- class IUseFlagNameError;
- class UseFlagNameValidator;
-
- /**
- * A UseFlagName holds a std::string that is a valid name for a USE flag.
- *
- * \ingroup g_names
- */
- typedef Validated<std::string, UseFlagNameValidator> UseFlagName;
-
- /**
- * A collection of UseFlagName instances.
- *
- * \ingroup g_names
- */
- typedef Set<UseFlagName> UseFlagNameSet;
-
-#include <paludis/name-se.hh>
-
class QualifiedPackageName;
- class IUseFlag;
-
- /**
- * Options for IUseFlag.
- *
- * \ingroup g_names
- * \since 0.26
- */
- typedef Options<IUseFlagParseOption> IUseFlagParseOptions;
/**
* Output a QualifiedPackageName to a stream.
@@ -110,13 +80,6 @@ namespace paludis
std::ostream & operator<< (std::ostream &, const QualifiedPackageName &) PALUDIS_VISIBLE;
/**
- * Output an IUseFlag to a stream.
- *
- * \ingroup g_names
- */
- std::ostream & operator<< (std::ostream &, const IUseFlag &) PALUDIS_VISIBLE;
-
- /**
* Holds a collection of QualifiedPackageName instances.
*
* \ingroup g_names
@@ -204,13 +167,6 @@ namespace paludis
* \ingroup g_names
*/
typedef Set<SetName> SetNameSet;
-
- /**
- * A collection of use flags.
- *
- * \ingroup g_names
- */
- typedef Set<IUseFlag> IUseFlagSet;
}
#endif
diff --git a/paludis/name.cc b/paludis/name.cc
index 8919b98..a88b7a6 100644
--- a/paludis/name.cc
+++ b/paludis/name.cc
@@ -33,7 +33,6 @@
using namespace paludis;
#include <paludis/name-sr.cc>
-#include <paludis/name-se.cc>
template struct Sequence<RepositoryName>;
template struct WrappedForwardIterator<Sequence<RepositoryName>::ConstIteratorTag, const RepositoryName>;
@@ -50,10 +49,6 @@ template struct Set<CategoryNamePart>;
template struct WrappedForwardIterator<Set<CategoryNamePart>::ConstIteratorTag, const CategoryNamePart>;
template struct WrappedOutputIterator<Set<CategoryNamePart>::InserterTag, CategoryNamePart>;
-template struct Set<UseFlagName>;
-template struct WrappedForwardIterator<Set<UseFlagName>::ConstIteratorTag, const UseFlagName>;
-template struct WrappedOutputIterator<Set<UseFlagName>::InserterTag, UseFlagName>;
-
template struct Set<QualifiedPackageName>;
template struct WrappedForwardIterator<Set<QualifiedPackageName>::ConstIteratorTag, const QualifiedPackageName>;
template struct WrappedOutputIterator<Set<QualifiedPackageName>::InserterTag, QualifiedPackageName>;
@@ -66,10 +61,6 @@ template struct Set<SetName>;
template struct WrappedForwardIterator<Set<SetName>::ConstIteratorTag, const SetName>;
template struct WrappedOutputIterator<Set<SetName>::InserterTag, SetName>;
-template struct Set<IUseFlag>;
-template struct WrappedForwardIterator<Set<IUseFlag>::ConstIteratorTag, const IUseFlag>;
-template struct WrappedOutputIterator<Set<IUseFlag>::InserterTag, IUseFlag>;
-
template struct Set<std::string>;
template struct WrappedForwardIterator<Set<std::string>::ConstIteratorTag, const std::string>;
template struct WrappedOutputIterator<Set<std::string>::InserterTag, std::string>;
@@ -86,61 +77,6 @@ paludis::operator<< (std::ostream & s, const QualifiedPackageName & q)
return s;
}
-void
-UseFlagNameValidator::validate(const std::string & s)
-{
- static const std::string allowed_chars(
- "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789-+_:@");
-
- static const std::string alphanum_chars(
- "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789");
-
- static const std::string special_chars(
- ":_");
-
- do
- {
- if (s.empty())
- break;
-
- if (std::string::npos == alphanum_chars.find(s[0]))
- break;
-
- if (std::string::npos != s.find_first_not_of(allowed_chars))
- break;
-
- std::string::size_type t;
- if (std::string::npos != ((t = s.find_first_of(special_chars))))
- {
- try
- {
- validate(s.substr(0, t));
- validate(s.substr(t + 1));
- }
- catch (const UseFlagNameError &)
- {
- break;
- }
- }
-
- return;
-
- } while (false);
-
- Context c("When validating use flag name '" + s + "':");
-
- throw UseFlagNameError(s);
-}
-
-UseFlagNameError::UseFlagNameError(const std::string & name) throw () :
- NameError(name, "use flag name")
-{
-}
-
SlotNameError::SlotNameError(const std::string & name) throw () :
NameError(name, "slot name")
{
@@ -419,84 +355,6 @@ SetNameError::SetNameError(const std::string & name) throw () :
{
}
-namespace
-{
- UseFlagName get_flag(const std::string & s)
- {
- Context c("When extracting USE flag name from IUSE flag '" + s + "':");
- if (s.empty() || ('-' != s[0] && '+' != s[0]))
- return UseFlagName(s);
- else
- return UseFlagName(s.substr(1));
- }
-
- UseFlagState get_state(const std::string & s, const IUseFlagParseOptions & o)
- {
- Context c("When extracting USE flag state from IUSE flag '" + s + "':");
-
- if (s.empty())
- return use_unspecified;
- if ('-' == s[0] || '+' == s[0])
- {
- if (! o[iufpo_allow_iuse_defaults])
- {
- if (o[iufpo_strict_parsing])
- throw IUseFlagNameError(s, "+/- prefixed IUSE flag names not allowed in this EAPI");
- else
- Log::get_instance()->message("name.iuse.prefix_not_allowed", ll_warning, lc_context)
- << "+/- prefixed IUSE flag names not allowed in this EAPI";
- }
-
- return '-' == s[0] ? use_disabled : use_enabled;
- }
- return use_unspecified;
- }
-}
-
-IUseFlag::IUseFlag(const std::string & s, const IUseFlagParseOptions & o, const std::string::size_type p) try:
- flag(get_flag(s)),
- state(get_state(s, o)),
- prefix_delim_pos(p)
-{
-}
-catch (const UseFlagNameError &)
-{
- throw IUseFlagNameError(s);
-}
-
-IUseFlagNameError::IUseFlagNameError(const std::string & s) throw () :
- NameError(s, "IUse flag")
-{
-}
-
-IUseFlagNameError::IUseFlagNameError(const std::string & s, const std::string & m) throw () :
- NameError(s, "IUse flag", m)
-{
-}
-
-std::ostream &
-paludis::operator<< (std::ostream & s, const IUseFlag & i)
-{
- switch (i.state)
- {
- case use_enabled:
- s << "+";
- break;
-
- case use_disabled:
- s << "-";
- break;
-
- case use_unspecified:
- case last_use:
- break;
- }
-
- s << i.flag;
-
- return s;
-}
-
std::size_t
QualifiedPackageName::hash() const
{
diff --git a/paludis/name.hh b/paludis/name.hh
index d5ac975..c9b925f 100644
--- a/paludis/name.hh
+++ b/paludis/name.hh
@@ -107,60 +107,6 @@ namespace paludis
static void validate(const std::string &);
};
- /**
- * A UseFlagNameError is thrown if an invalid value is assigned to
- * a UseFlagName.
- *
- * \ingroup g_names
- * \ingroup g_exceptions
- */
- class PALUDIS_VISIBLE UseFlagNameError :
- public NameError
- {
- public:
- /**
- * Constructor.
- */
- UseFlagNameError(const std::string & name) throw ();
- };
-
- /**
- * An IUseFlagNameError is thrown if an invalid value is assigned to
- * an IUseFlagName.
- *
- * \ingroup g_names
- * \ingroup g_exceptions
- */
- class PALUDIS_VISIBLE IUseFlagNameError :
- public NameError
- {
- public:
- ///\name Basic operations
- ///\{
-
- IUseFlagNameError(const std::string & name, const std::string & msg) throw ();
-
- IUseFlagNameError(const std::string & name) throw ();
-
- ///\}
- };
-
- /**
- * A UseFlagNameValidator handles validation rules for the value of a
- * UseFlagName.
- *
- * \ingroup g_names
- */
- struct PALUDIS_VISIBLE UseFlagNameValidator :
- private InstantiationPolicy<UseFlagNameValidator, instantiation_method::NonInstantiableTag>
- {
- /**
- * If the parameter is not a valid value for a UseFlagName,
- * throw a UseFlagNameError.
- */
- static void validate(const std::string &);
- };
-
#include <paludis/name-sr.hh>
/**
diff --git a/paludis/name.sr b/paludis/name.sr
index 9ed0bde..c975309 100644
--- a/paludis/name.sr
+++ b/paludis/name.sr
@@ -28,27 +28,3 @@ END
END
}
-make_class_IUseFlag()
-{
- visible
-
- key flag UseFlagName
- key state UseFlagState
- key prefix_delim_pos "std::string::size_type"
-
- comparison_operators all flag
-
- extra_constructors <<END
- IUseFlag(const std::string &, const IUseFlagParseOptions &, const std::string::size_type);
-END
-
- doxygen_comment << "END"
- /**
- * Represents an IUse flag.
- *
- * \ingroup g_names
- * \nosubgrouping
- */
-END
-}
-
diff --git a/paludis/name_TEST.cc b/paludis/name_TEST.cc
index cbd0c97..b150557 100644
--- a/paludis/name_TEST.cc
+++ b/paludis/name_TEST.cc
@@ -264,46 +264,6 @@ namespace test_cases
} test_slot_name_validation;
/**
- * \test Test UseFlagName creation.
- *
- */
- struct UseFlagNameCreationTest : public TestCase
- {
- UseFlagNameCreationTest() : TestCase("creation") { }
-
- void run()
- {
- UseFlagName u("foo");
- TEST_CHECK(true);
- }
- } test_use_flag_name_creation;
-
- /**
- * \test Test UseFlagName validation.
- *
- */
- struct UseFlagNameValidationTest : public TestCase
- {
- UseFlagNameValidationTest() : TestCase("validation") { }
-
- void run()
- {
- UseFlagName u("use0+_x@-x");
- TEST_CHECK_THROWS(u = UseFlagName(""), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("!!!"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("-foo"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("_foo"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("@foo"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("+foo"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("fo$o"), NameError);
-
- TEST_CHECK_THROWS(u = UseFlagName("foo:"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName(":foo"), NameError);
- TEST_CHECK_THROWS(u = UseFlagName("foo:_"), NameError);
- }
- } test_use_flag_name_validation;
-
- /**
* \test Test KeywordName creation.
*
*/
diff --git a/paludis/package_id.hh b/paludis/package_id.hh
index 2462fdd..cee5fa9 100644
--- a/paludis/package_id.hh
+++ b/paludis/package_id.hh
@@ -38,6 +38,7 @@
#include <paludis/repository-fwd.hh>
#include <paludis/contents-fwd.hh>
#include <paludis/version_spec-fwd.hh>
+#include <paludis/choice-fwd.hh>
#include <tr1/memory>
@@ -172,13 +173,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const = 0;
/**
- * The iuse_key, if non-zero, is used when displaying single-line
- * install-pretend output, and when resolving where DepList's
- * DepListReinstallOption is dl_reinstall_if_use_changed.
- */
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const = 0;
-
- /**
* The provide_key, if non-zero, indicates that a package provides
* certain old-style virtuals. This affects dependency resolution.
*/
@@ -277,6 +271,13 @@ namespace paludis
*/
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const = 0;
+ /**
+ * The choices_key, if non-zero, contains zero or more
+ * MetadataValueKey<std::tr1::shared_ptr<const Choice> > child
+ * keys holding choice information for this ID.
+ */
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const = 0;
+
///\}
///\name Actions
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index e29806a..955b868 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -172,7 +172,6 @@ CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryPa
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)),
diff --git a/paludis/repositories/cran/cran_package_id.cc b/paludis/repositories/cran/cran_package_id.cc
index 0212b73..ce88c49 100644
--- a/paludis/repositories/cran/cran_package_id.cc
+++ b/paludis/repositories/cran/cran_package_id.cc
@@ -337,12 +337,6 @@ CRANPackageID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-CRANPackageID::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
CRANPackageID::provide_key() const
{
@@ -547,3 +541,9 @@ CRANPackageID::transient_key() const
return std::tr1::shared_ptr<const MetadataValueKey<bool> >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+CRANPackageID::choices_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >();
+}
+
diff --git a/paludis/repositories/cran/cran_package_id.hh b/paludis/repositories/cran/cran_package_id.hh
index daaecc3..cff80a0 100644
--- a/paludis/repositories/cran/cran_package_id.hh
+++ b/paludis/repositories/cran/cran_package_id.hh
@@ -58,8 +58,8 @@ namespace paludis
virtual const std::tr1::shared_ptr<const Repository> repository() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 9d68758..9af0595 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -117,7 +117,6 @@ CRANRepository::CRANRepository(const CRANRepositoryParams & p) :
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))),
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index f8e30b9..08d30b6 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -7,6 +7,7 @@ DISTCLEANFILES = \
e_repository_params-se.hh e_repository_params-se.cc \
vdb_repository-sr.hh vdb_repository-sr.cc \
dep_parser-se.hh dep_parser-se.cc \
+ iuse-se.hh iuse-se.cc \
manifest2_entry-sr.hh manifest2_entry-sr.cc
MAINTAINERCLEANFILES = Makefile.in
@@ -38,6 +39,7 @@ paludis_repositories_e_include_HEADERS = \
dep_parser-fwd.hh \
dep_spec_pretty_printer.hh \
dependencies_rewriter.hh \
+ e_choice_value.hh \
e_installed_repository.hh \
e_installed_repository-sr.hh \
e_installed_repository_id.hh \
@@ -71,6 +73,8 @@ paludis_repositories_e_include_HEADERS = \
extra_distribution_data.hh \
fetch_visitor.hh \
info_metadata_key.hh \
+ iuse.hh \
+ iuse-se.hh \
pretend_fetch_visitor.hh \
fix_locked_dependencies.hh \
glsa-sr.hh \
@@ -95,6 +99,7 @@ libpaludiserepository_@PALUDIS_PC_SLOT@_la_SOURCES = \
dep_parser.cc \
dep_spec_pretty_printer.cc \
dependencies_rewriter.cc \
+ e_choice_value.cc \
e_installed_repository.cc \
e_installed_repository_id.cc \
e_key.cc \
@@ -123,6 +128,7 @@ libpaludiserepository_@PALUDIS_PC_SLOT@_la_SOURCES = \
extra_distribution_data.cc \
fetch_visitor.cc \
info_metadata_key.cc \
+ iuse.cc \
pretend_fetch_visitor.cc \
fix_locked_dependencies.cc \
glsa.cc \
@@ -351,6 +357,9 @@ EXTRA_DIST = \
fetch_visitor_TEST_setup.sh \
fetch_visitor_TEST_cleanup.sh \
fix_locked_dependencies_TEST.cc \
+ iuse.se \
+ iuse-se.hh \
+ iuse-se.cc \
manifest2_entry.sr \
manifest2_entry-sr.hh \
manifest2_entry-sr.cc \
@@ -382,6 +391,8 @@ BUILT_SOURCES = \
e_repository_params-se.cc \
glsa-sr.hh \
glsa-sr.cc \
+ iuse-se.hh \
+ iuse-se.cc \
exndbam_repository-sr.hh \
exndbam_repository-sr.cc \
vdb_repository-sr.hh \
@@ -462,6 +473,12 @@ dep_parser-se.hh : dep_parser.se $(top_srcdir)/misc/make_se.bash
dep_parser-se.cc : dep_parser.se $(top_srcdir)/misc/make_se.bash
if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/dep_parser.se > $@ ; then rm -f $@ ; exit 1 ; fi
+iuse-se.hh : iuse.se $(top_srcdir)/misc/make_se.bash
+ if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/iuse.se > $@ ; then rm -f $@ ; exit 1 ; fi
+
+iuse-se.cc : iuse.se $(top_srcdir)/misc/make_se.bash
+ if ! $(top_srcdir)/misc/make_se.bash --source $(srcdir)/iuse.se > $@ ; then rm -f $@ ; exit 1 ; fi
+
e_repository_params-se.hh : e_repository_params.se $(top_srcdir)/misc/make_se.bash
if ! $(top_srcdir)/misc/make_se.bash --header $(srcdir)/e_repository_params.se > $@ ; then rm -f $@ ; exit 1 ; fi
diff --git a/paludis/repositories/e/dep_parser.cc b/paludis/repositories/e/dep_parser.cc
index b1c8030..8668f99 100644
--- a/paludis/repositories/e/dep_parser.cc
+++ b/paludis/repositories/e/dep_parser.cc
@@ -36,6 +36,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/action.hh>
#include <list>
#include <set>
#include <ostream>
@@ -224,6 +225,17 @@ namespace
annotations_go_here(spec);
}
+ template <typename T_>
+ void plain_text_label_handler(
+ const typename ParseStackTypes<T_>::Stack & h,
+ const typename ParseStackTypes<T_>::AnnotationsGoHere & annotations_go_here,
+ const std::string & s)
+ {
+ std::tr1::shared_ptr<PlainTextLabelDepSpec> spec(parse_plain_text_label(s));
+ (*h.begin()).add_handler()(make_shared_ptr(new TreeLeaf<T_, PlainTextLabelDepSpec>(spec)));
+ annotations_go_here(spec);
+ }
+
template <typename T_, typename A_>
void any_all_handler(typename ParseStackTypes<T_>::Stack & stack)
{
@@ -246,7 +258,8 @@ namespace
const std::tr1::shared_ptr<const PackageID> & id)
{
using namespace std::tr1::placeholders;
- std::tr1::shared_ptr<ConditionalDepSpec> spec(new ConditionalDepSpec(parse_elike_conditional_dep_spec(u, env, id)));
+ std::tr1::shared_ptr<ConditionalDepSpec> spec(new ConditionalDepSpec(parse_elike_conditional_dep_spec(u, env, id,
+ id->supports_action(SupportsActionTest<InstalledAction>()))));
std::tr1::shared_ptr<ConstTreeSequence<T_, ConditionalDepSpec> > item(new ConstTreeSequence<T_, ConditionalDepSpec>(spec));
(*stack.begin()).add_handler()(item);
stack.push_front(make_named_values<typename ParseStackTypes<T_>::Item>(
@@ -565,6 +578,49 @@ paludis::erepository::parse_plain_text(const std::string & s,
return (*stack.begin()).item();
}
+std::tr1::shared_ptr<PlainTextSpecTree::ConstItem>
+paludis::erepository::parse_myoptions(const std::string & s,
+ const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const EAPI &)
+{
+ using namespace std::tr1::placeholders;
+
+ ParseStackTypes<PlainTextSpecTree>::Stack stack;
+ std::tr1::shared_ptr<AllDepSpec> spec(new AllDepSpec);
+ std::tr1::shared_ptr<DepSpec> thing_to_annotate(spec);
+ std::tr1::shared_ptr<ConstTreeSequence<PlainTextSpecTree, AllDepSpec> > top(
+ new ConstTreeSequence<PlainTextSpecTree, AllDepSpec>(spec));
+ stack.push_front(make_named_values<ParseStackTypes<PlainTextSpecTree>::Item>(
+ value_for<n::add_handler>(std::tr1::bind(&ConstTreeSequence<PlainTextSpecTree, AllDepSpec>::add, top.get(), _1)),
+ value_for<n::item>(top),
+ value_for<n::spec>(spec)
+ ));
+
+ ELikeDepParserCallbacks callbacks(
+ make_named_values<ELikeDepParserCallbacks>(
+ value_for<n::on_all>(std::tr1::bind(&any_all_handler<PlainTextSpecTree, AllDepSpec>, std::tr1::ref(stack))),
+ value_for<n::on_annotations>(std::tr1::bind(&set_annotations, std::tr1::ref(thing_to_annotate), _1)),
+ 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(&plain_text_label_handler<PlainTextSpecTree>, std::tr1::ref(stack),
+ ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::tr1::bind(
+ &set_thing_to_annotate, std::tr1::ref(thing_to_annotate), _1)), _1)),
+ value_for<n::on_pop>(std::tr1::bind(&pop_handler<PlainTextSpecTree>, std::tr1::ref(stack),
+ ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::tr1::bind(
+ &set_thing_to_annotate, std::tr1::ref(thing_to_annotate), _1)), s)),
+ value_for<n::on_should_be_empty>(std::tr1::bind(&should_be_empty_handler<PlainTextSpecTree>, std::tr1::ref(stack), s)),
+ value_for<n::on_string>(std::tr1::bind(&plain_text_handler<PlainTextSpecTree>, std::tr1::ref(stack),
+ ParseStackTypes<PlainTextSpecTree>::AnnotationsGoHere(std::tr1::bind(
+ &set_thing_to_annotate, std::tr1::ref(thing_to_annotate), _1)), _1)),
+ value_for<n::on_use>(std::tr1::bind(&use_handler<PlainTextSpecTree>, std::tr1::ref(stack), _1, env, id)),
+ value_for<n::on_use_under_any>(&do_nothing)
+ ));
+
+ parse_elike_dependencies(s, callbacks);
+
+ return (*stack.begin()).item();
+}
+
std::tr1::shared_ptr<URILabelsDepSpec>
paludis::erepository::parse_uri_label(const std::string & s, const EAPI & e)
{
@@ -597,6 +653,21 @@ paludis::erepository::parse_uri_label(const std::string & s, const EAPI & e)
return l;
}
+std::tr1::shared_ptr<PlainTextLabelDepSpec>
+paludis::erepository::parse_plain_text_label(const std::string & s)
+{
+ Context context("When parsing label string '" + s + "':");
+
+ if (s.empty())
+ throw EDepParseError(s, "Empty label");
+
+ std::string c(s.substr(0, s.length() - 1));
+ if (c.empty())
+ throw EDepParseError(s, "Unknown label");
+
+ return make_shared_ptr(new PlainTextLabelDepSpec(s));
+}
+
std::tr1::shared_ptr<DependencyLabelsDepSpec>
paludis::erepository::parse_dependency_label(const std::string & s, const EAPI & e)
{
diff --git a/paludis/repositories/e/dep_parser.hh b/paludis/repositories/e/dep_parser.hh
index 506dd09..d00f955 100644
--- a/paludis/repositories/e/dep_parser.hh
+++ b/paludis/repositories/e/dep_parser.hh
@@ -74,6 +74,12 @@ namespace paludis
const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
/**
+ * Parse a myoptions heirarchy.
+ */
+ std::tr1::shared_ptr<PlainTextSpecTree::ConstItem> parse_myoptions(const std::string & s,
+ const Environment * const, const std::tr1::shared_ptr<const PackageID> &, const EAPI &) PALUDIS_VISIBLE;
+
+ /**
* Parse a fetchable uri heirarchy.
*/
std::tr1::shared_ptr<FetchableURISpecTree::ConstItem> parse_fetchable_uri(const std::string & s,
@@ -95,6 +101,11 @@ namespace paludis
* Parse a URI label.
*/
std::tr1::shared_ptr<URILabelsDepSpec> parse_uri_label(const std::string & s, const EAPI &) PALUDIS_VISIBLE;
+
+ /**
+ * Parse a plain text label.
+ */
+ std::tr1::shared_ptr<PlainTextLabelDepSpec> parse_plain_text_label(const std::string & s) PALUDIS_VISIBLE;
}
}
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index 7cd184f..72f9624 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -143,6 +143,11 @@ namespace
{
}
+ void visit_leaf(const PlainTextLabelDepSpec &)
+ {
+ result = true;
+ }
+
void visit_leaf(const URILabelsDepSpec &)
{
result = true;
@@ -484,6 +489,36 @@ DepSpecPrettyPrinter::visit_leaf(const URILabelsDepSpec & l)
}
void
+DepSpecPrettyPrinter::visit_leaf(const PlainTextLabelDepSpec & l)
+{
+ if (_imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = false;
+ _imp->indent -= 1;
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->formatter.indent(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->formatter.format(l, format::Plain());
+
+ do_annotations(l);
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->formatter.newline();
+ else
+ _imp->need_space = true;
+
+ if (! _imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = true;
+ _imp->indent += 1;
+ }
+}
+
+void
DepSpecPrettyPrinter::visit_leaf(const DependencyLabelsDepSpec & l)
{
if (_imp->extra_label_indent)
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.hh b/paludis/repositories/e/dep_spec_pretty_printer.hh
index e563f82..949dd9a 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.hh
+++ b/paludis/repositories/e/dep_spec_pretty_printer.hh
@@ -122,6 +122,8 @@ namespace paludis
void visit_leaf(const NamedSetDepSpec &);
+ void visit_leaf(const PlainTextLabelDepSpec &);
+
///}
};
diff --git a/paludis/repositories/e/e_choice_value.cc b/paludis/repositories/e/e_choice_value.cc
new file mode 100644
index 0000000..dbc5766
--- /dev/null
+++ b/paludis/repositories/e/e_choice_value.cc
@@ -0,0 +1,77 @@
+/* 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
+ */
+
+#include <paludis/repositories/e/e_choice_value.hh>
+#include <paludis/repositories/e/use_desc.hh>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+EChoiceValue::EChoiceValue(const ChoicePrefixName & r, const UnprefixedChoiceName & v, const ChoiceNameWithPrefix & np, const QualifiedPackageName & p,
+ const std::tr1::shared_ptr<const UseDesc> & d,
+ bool b, bool l, bool x) :
+ _prefix(r),
+ _unprefixed_name(v),
+ _name_with_prefix(np),
+ _package_name(p),
+ _use_desc(d),
+ _enabled(b),
+ _locked(l),
+ _explicitly_listed(x)
+{
+}
+
+const UnprefixedChoiceName
+EChoiceValue::unprefixed_name() const
+{
+ return _unprefixed_name;
+}
+
+const ChoiceNameWithPrefix
+EChoiceValue::name_with_prefix() const
+{
+ return _name_with_prefix;
+}
+
+const std::string
+EChoiceValue::description() const
+{
+ if (! _use_desc)
+ return "";
+ return _use_desc->describe(_package_name, _prefix, _unprefixed_name);
+}
+
+bool
+EChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+EChoiceValue::locked() const
+{
+ return _locked;
+}
+
+bool
+EChoiceValue::explicitly_listed() const
+{
+ return _explicitly_listed;
+}
+
diff --git a/paludis/repositories/e/e_choice_value.hh b/paludis/repositories/e/e_choice_value.hh
new file mode 100644
index 0000000..a1870ba
--- /dev/null
+++ b/paludis/repositories/e/e_choice_value.hh
@@ -0,0 +1,68 @@
+/* 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_REPOSITORIES_E_E_CHOICE_VALUE_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_CHOICE_VALUE_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/validated.hh>
+#include <paludis/choice.hh>
+#include <paludis/name.hh>
+#include <tr1/functional>
+#include <string>
+
+namespace paludis
+{
+ struct UseDesc;
+
+ namespace erepository
+ {
+ class PALUDIS_VISIBLE EChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const ChoicePrefixName _prefix;
+ const UnprefixedChoiceName _unprefixed_name;
+ const ChoiceNameWithPrefix _name_with_prefix;
+ const QualifiedPackageName _package_name;
+ const std::tr1::shared_ptr<const UseDesc> _use_desc;
+ const bool _enabled;
+ const bool _locked;
+ const bool _explicitly_listed;
+
+ public:
+ EChoiceValue(const ChoicePrefixName & r,
+ const UnprefixedChoiceName & n,
+ const ChoiceNameWithPrefix & np,
+ const QualifiedPackageName & p,
+ const std::tr1::shared_ptr<const UseDesc> & d,
+ bool b,
+ bool l, bool x);
+
+ const UnprefixedChoiceName unprefixed_name() const;
+ const ChoiceNameWithPrefix name_with_prefix() const;
+ bool enabled() const;
+ bool locked() const;
+ const std::string description() const;
+ bool explicitly_listed() const;
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 4e7b2d1..9425199 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -154,33 +154,6 @@ EInstalledRepository::want_pre_post_phases() const
return true;
}
-UseFlagState
-EInstalledRepository::query_use(const UseFlagName & f, const PackageID & e) const
-{
- if (this != e.repository().get())
- return use_unspecified;
-
- if (! static_cast<const ERepositoryID *>(&e)->use_key())
- return use_unspecified;
-
- if (static_cast<const ERepositoryID *>(&e)->use_key()->value()->end() != static_cast<const ERepositoryID *>(&e)->use_key()->value()->find(f))
- return use_enabled;
- else
- return use_disabled;
-}
-
-bool
-EInstalledRepository::query_use_mask(const UseFlagName & u, const PackageID & e) const
-{
- return use_disabled == query_use(u, e);
-}
-
-bool
-EInstalledRepository::query_use_force(const UseFlagName & u, const PackageID & e) const
-{
- return use_enabled == query_use(u, e);
-}
-
HookResult
EInstalledRepository::perform_hook(const Hook & hook) const
{
@@ -190,30 +163,6 @@ EInstalledRepository::perform_hook(const Hook & hook) const
return HookResult(0, "");
}
-std::string
-EInstalledRepository::describe_use_flag(const UseFlagName &, const PackageID &) const
-{
- return "";
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-EInstalledRepository::use_expand_flags() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-EInstalledRepository::use_expand_prefixes() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-EInstalledRepository::use_expand_hidden_prefixes() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
std::tr1::shared_ptr<SetSpecTree::ConstItem>
EInstalledRepository::package_set(const SetName & s) const
{
@@ -288,21 +237,6 @@ EInstalledRepository::unimportant_category_names() const
return result;
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-EInstalledRepository::arch_flags() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
-char
-EInstalledRepository::use_expand_separator(const PackageID & id) const
-{
- if (this != id.repository().get())
- return '\0';
- const std::tr1::shared_ptr<const EAPI> & eapi(static_cast<const ERepositoryID &>(id).eapi());
- return eapi->supported() ? eapi->supported()->ebuild_options()->use_expand_separator() : '\0';
-}
-
std::string
EInstalledRepository::get_environment_variable(
const std::tr1::shared_ptr<const PackageID> & id,
@@ -484,7 +418,8 @@ EInstalledRepository::perform_info(const std::tr1::shared_ptr<const ERepositoryI
value_for<n::root>(stringify(_imp->params.root)),
value_for<n::use>(""),
value_for<n::use_ebuild_file>(false),
- value_for<n::use_expand>("")
+ value_for<n::use_expand>(""),
+ value_for<n::use_expand_hidden>("")
));
info_cmd();
diff --git a/paludis/repositories/e/e_installed_repository.hh b/paludis/repositories/e/e_installed_repository.hh
index d23b7be..5b0049d 100644
--- a/paludis/repositories/e/e_installed_repository.hh
+++ b/paludis/repositories/e/e_installed_repository.hh
@@ -32,7 +32,6 @@ namespace paludis
class EInstalledRepository :
public Repository,
- public RepositoryUseInterface,
public RepositorySetsInterface,
public RepositoryEnvironmentVariableInterface,
public RepositoryDestinationInterface,
@@ -47,36 +46,6 @@ namespace paludis
~EInstalledRepository();
public:
- /* RepositoryUseInterface */
-
- virtual UseFlagState query_use(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool query_use_mask(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool query_use_force(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> arch_flags() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_flags() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_hidden_prefixes() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_prefixes() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual char use_expand_separator(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string describe_use_flag(const UseFlagName &,
- const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositorySetsInterface */
virtual std::tr1::shared_ptr<SetSpecTree::ConstItem> package_set(const SetName & id) const
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 4c4dd0f..e7abc8e 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -24,6 +24,7 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/dependencies_rewriter.hh>
+#include <paludis/repositories/e/e_choice_value.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -77,9 +78,13 @@ namespace paludis
std::tr1::shared_ptr<const EAPI> eapi;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location;
- std::tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use;
+ std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use;
std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited;
- std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse;
+ std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string > > > raw_iuse;
+ std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > raw_myoptions;
+ std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string > > > raw_use_expand;
+ std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string > > > raw_use_expand_hidden;
+ std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices;
std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license;
std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide;
std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies;
@@ -181,15 +186,15 @@ EInstalledRepositoryID::need_keys_added() const
if (! env->env_use().empty())
if ((_imp->dir / env->env_use()).exists())
{
- _imp->use.reset(new EUseKey(_imp->environment, shared_from_this(), env->env_use(), env->description_use(),
+ _imp->raw_use.reset(new EStringSetKey(shared_from_this(), env->env_use(), env->description_use(),
file_contents(_imp->dir / env->env_use()), mkt_internal));
- add_metadata_key(_imp->use);
+ add_metadata_key(_imp->raw_use);
}
if (! vars->inherited().name().empty())
if ((_imp->dir / vars->inherited().name()).exists())
{
- _imp->inherited.reset(new EInheritedKey(shared_from_this(), vars->inherited().name(), vars->inherited().description(),
+ _imp->inherited.reset(new EStringSetKey(shared_from_this(), vars->inherited().name(), vars->inherited().description(),
file_contents(_imp->dir / vars->inherited().name()), mkt_internal));
add_metadata_key(_imp->inherited);
}
@@ -197,9 +202,33 @@ EInstalledRepositoryID::need_keys_added() const
if (! vars->iuse().name().empty())
if ((_imp->dir / vars->iuse().name()).exists())
{
- _imp->iuse.reset(new EIUseKey(_imp->environment, shared_from_this(), vars->iuse().name(), vars->iuse().description(),
- file_contents(_imp->dir / vars->iuse().name()), mkt_normal));
- add_metadata_key(_imp->iuse);
+ _imp->raw_iuse.reset(new EStringSetKey(shared_from_this(), vars->iuse().name(), vars->iuse().description(),
+ file_contents(_imp->dir / vars->iuse().name()), mkt_internal));
+ add_metadata_key(_imp->raw_iuse);
+ }
+
+ if (! vars->myoptions().name().empty())
+ if ((_imp->dir / vars->myoptions().name()).exists())
+ {
+ _imp->raw_myoptions.reset(new EMyOptionsKey(_imp->environment, shared_from_this(), vars->myoptions().name(),
+ vars->myoptions().description(), file_contents(_imp->dir / vars->myoptions().name()), mkt_internal));
+ add_metadata_key(_imp->raw_myoptions);
+ }
+
+ if (! vars->use_expand().name().empty())
+ if ((_imp->dir / vars->use_expand().name()).exists())
+ {
+ _imp->raw_use_expand.reset(new EStringSetKey(shared_from_this(), vars->use_expand().name(), vars->use_expand().description(),
+ file_contents(_imp->dir / vars->use_expand().name()), mkt_internal));
+ add_metadata_key(_imp->raw_use_expand);
+ }
+
+ if (! vars->use_expand_hidden().name().empty())
+ if ((_imp->dir / vars->use_expand_hidden().name()).exists())
+ {
+ _imp->raw_use_expand_hidden.reset(new EStringSetKey(shared_from_this(), vars->use_expand_hidden().name(), vars->use_expand_hidden().description(),
+ file_contents(_imp->dir / vars->use_expand_hidden().name()), mkt_internal));
+ add_metadata_key(_imp->raw_use_expand_hidden);
}
if (! vars->license().name().empty())
@@ -396,6 +425,16 @@ EInstalledRepositoryID::need_keys_added() const
_imp->dir / contents_filename(), mkt_normal));
add_metadata_key(_imp->installed_time);
+ if (_imp->eapi->supported())
+ _imp->choices.reset(new EChoicesKey(_imp->environment, shared_from_this(), "PALUDIS_CHOICES",
+ _imp->eapi->supported()->ebuild_environment_variables()->description_choices(),
+ mkt_normal, std::tr1::shared_ptr<const ERepository>()));
+ else
+ _imp->choices.reset(new EChoicesKey(_imp->environment, shared_from_this(), "PALUDIS_CHOICES", "Choices", mkt_normal,
+ std::tr1::shared_ptr<const ERepository>()));
+
+ add_metadata_key(_imp->choices);
+
std::tr1::shared_ptr<Set<std::string> > from_repositories_value(new Set<std::string>);
if ((_imp->dir / "REPOSITORY").exists())
from_repositories_value->insert(file_contents(_imp->dir / "REPOSITORY"));
@@ -577,18 +616,39 @@ EInstalledRepositoryID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> >
-EInstalledRepositoryID::use_key() const
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EInstalledRepositoryID::raw_use_key() const
+{
+ need_keys_added();
+ return _imp->raw_use;
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EInstalledRepositoryID::raw_iuse_key() const
+{
+ need_keys_added();
+ return _imp->raw_iuse;
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> >
+EInstalledRepositoryID::raw_myoptions_key() const
+{
+ need_keys_added();
+ return _imp->raw_myoptions;
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EInstalledRepositoryID::raw_use_expand_key() const
{
need_keys_added();
- return _imp->use;
+ return _imp->raw_use_expand;
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-EInstalledRepositoryID::iuse_key() const
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EInstalledRepositoryID::raw_use_expand_hidden_key() const
{
need_keys_added();
- return _imp->iuse;
+ return _imp->raw_use_expand_hidden;
}
const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> >
@@ -659,6 +719,13 @@ EInstalledRepositoryID::properties_key() const
return _imp->properties;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+EInstalledRepositoryID::choices_key() const
+{
+ need_keys_added();
+ return _imp->choices;
+}
+
const std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
EInstalledRepositoryID::fetches_key() const
{
@@ -871,4 +938,34 @@ EInstalledRepositoryID::contained_in_key() const
return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >();
}
+std::tr1::shared_ptr<ChoiceValue>
+EInstalledRepositoryID::make_choice_value(const std::tr1::shared_ptr<const Choice> & c, const UnprefixedChoiceName & v,
+ const Tribool, const bool explicitly_listed) const
+{
+ if (! eapi()->supported())
+ throw InternalError(PALUDIS_HERE, "Unsupported EAPI");
+
+ std::string name_with_prefix;
+ if (stringify(c->prefix()).empty())
+ name_with_prefix = stringify(v);
+ else
+ {
+ char use_expand_separator(eapi()->supported()->ebuild_options()->use_expand_separator());
+ if (! use_expand_separator)
+ throw InternalError(PALUDIS_HERE, "No use_expand_separator defined");
+ name_with_prefix = stringify(c->prefix()) + std::string(1, use_expand_separator) + stringify(v);
+ }
+
+ bool enabled(false);
+ if (raw_use_key())
+ enabled = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix));
+
+ return make_shared_ptr(new EChoiceValue(c->prefix(), v, ChoiceNameWithPrefix(name_with_prefix), name(), std::tr1::shared_ptr<const UseDesc>(),
+ enabled, true, explicitly_listed));
+}
+
+void
+EInstalledRepositoryID::add_build_options(const std::tr1::shared_ptr<Choices> &) const
+{
+}
diff --git a/paludis/repositories/e/e_installed_repository_id.hh b/paludis/repositories/e/e_installed_repository_id.hh
index faec334..8b22ea6 100644
--- a/paludis/repositories/e/e_installed_repository_id.hh
+++ b/paludis/repositories/e/e_installed_repository_id.hh
@@ -60,7 +60,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
@@ -79,7 +78,12 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_iuse_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > raw_myoptions_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_hidden_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
@@ -98,6 +102,12 @@ namespace paludis
virtual std::string fs_location_human_name() const = 0;
virtual std::string contents_filename() const = 0;
virtual std::tr1::shared_ptr<MetadataValueKey<std::tr1::shared_ptr<const Contents> > > make_contents_key() const = 0;
+
+ virtual std::tr1::shared_ptr<ChoiceValue> make_choice_value(
+ const std::tr1::shared_ptr<const Choice> &, const UnprefixedChoiceName &, const Tribool,
+ const bool) const;
+
+ virtual void add_build_options(const std::tr1::shared_ptr<Choices> &) const;
};
}
}
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 8e9ed36..40caed6 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -23,6 +23,8 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/vdb_contents_tokeniser.hh>
+#include <paludis/repositories/e/e_repository_profile.hh>
+#include <paludis/repositories/e/e_repository.hh>
#include <paludis/util/pretty_print.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -35,17 +37,22 @@
#include <paludis/util/join.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/create_iterator-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/tribool.hh>
+#include <paludis/util/member_iterator-impl.hh>
#include <paludis/contents.hh>
#include <paludis/repository.hh>
#include <paludis/environment.hh>
#include <paludis/stringify_formatter-impl.hh>
#include <paludis/dep_spec_flattener.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <list>
#include <vector>
#include <fstream>
+#include <set>
#include <map>
using namespace paludis;
@@ -463,13 +470,13 @@ EPlainTextSpecKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f)
namespace paludis
{
template <>
- struct Implementation<EProvideKey>
+ struct Implementation<EMyOptionsKey>
{
const Environment * const env;
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<const ProvideSpecTree::ConstItem> value;
+ mutable std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem> value;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
env(e),
@@ -480,20 +487,21 @@ namespace paludis
};
}
-EProvideKey::EProvideKey(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & id,
+EMyOptionsKey::EMyOptionsKey(const Environment * const e,
+ const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataSpecTreeKey<ProvideSpecTree>(r, h, t),
- PrivateImplementationPattern<EProvideKey>(new Implementation<EProvideKey>(e, id, v)),
- _imp(PrivateImplementationPattern<EProvideKey>::_imp)
+ MetadataSpecTreeKey<PlainTextSpecTree>(r, h, t),
+ PrivateImplementationPattern<EMyOptionsKey>(new Implementation<EMyOptionsKey>(e, id, v)),
+ _imp(PrivateImplementationPattern<EMyOptionsKey>::_imp)
{
}
-EProvideKey::~EProvideKey()
+EMyOptionsKey::~EMyOptionsKey()
{
}
-const std::tr1::shared_ptr<const ProvideSpecTree::ConstItem>
-EProvideKey::value() const
+const std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem>
+EMyOptionsKey::value() const
{
Lock l(_imp->value_mutex);
@@ -501,12 +509,12 @@ EProvideKey::value() const
return _imp->value;
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value = parse_provide(_imp->string_value, _imp->env, _imp->id, *_imp->id->eapi());
+ _imp->value = parse_myoptions(_imp->string_value, _imp->env, _imp->id, *_imp->id->eapi());
return _imp->value;
}
std::string
-EProvideKey::pretty_print(const ProvideSpecTree::ItemFormatter & f) const
+EMyOptionsKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
@@ -515,7 +523,7 @@ EProvideKey::pretty_print(const ProvideSpecTree::ItemFormatter & f) const
}
std::string
-EProvideKey::pretty_print_flat(const ProvideSpecTree::ItemFormatter & f) const
+EMyOptionsKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f) const
{
StringifyFormatter ff(f);
DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
@@ -526,232 +534,64 @@ EProvideKey::pretty_print_flat(const ProvideSpecTree::ItemFormatter & f) const
namespace paludis
{
template <>
- struct Implementation<EIUseKey>
+ struct Implementation<EProvideKey>
{
- const std::tr1::shared_ptr<const ERepositoryID> id;
const Environment * const env;
+ const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<IUseFlagSet> value;
- mutable std::tr1::function<void () throw ()> value_used;
+ mutable std::tr1::shared_ptr<const ProvideSpecTree::ConstItem> value;
- Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const Environment * const e, const std::string & v) :
- id(i),
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i, const std::string & v) :
env(e),
+ id(i),
string_value(v)
{
}
};
}
-EIUseKey::EIUseKey(
- const Environment * const e,
- const std::tr1::shared_ptr<const ERepositoryID> & id,
+EProvideKey::EProvideKey(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataCollectionKey<IUseFlagSet>(r, h, t),
- PrivateImplementationPattern<EIUseKey>(new Implementation<EIUseKey>(id, e, v)),
- _imp(PrivateImplementationPattern<EIUseKey>::_imp)
+ MetadataSpecTreeKey<ProvideSpecTree>(r, h, t),
+ PrivateImplementationPattern<EProvideKey>(new Implementation<EProvideKey>(e, id, v)),
+ _imp(PrivateImplementationPattern<EProvideKey>::_imp)
{
}
-EIUseKey::~EIUseKey()
+EProvideKey::~EProvideKey()
{
}
-const std::tr1::shared_ptr<const IUseFlagSet>
-EIUseKey::value() const
+const std::tr1::shared_ptr<const ProvideSpecTree::ConstItem>
+EProvideKey::value() const
{
Lock l(_imp->value_mutex);
+
if (_imp->value)
- {
- if (_imp->value_used)
- {
- _imp->value_used();
- _imp->value_used = std::tr1::function<void () throw ()>();
- }
return _imp->value;
- }
Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- _imp->value.reset(new IUseFlagSet);
- std::list<std::string> tokens;
- tokenise_whitespace(_imp->string_value, std::back_inserter(tokens));
-
- std::tr1::shared_ptr<const UseFlagNameSet> prefixes;
- if ((*_imp->id->repository()).use_interface())
- prefixes = (*_imp->id->repository()).use_interface()->use_expand_prefixes();
- else
- prefixes.reset(new UseFlagNameSet);
-
- for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
- t != t_end ; ++t)
- {
- IUseFlag f(*t, _imp->id->eapi()->supported()->iuse_flag_parse_options(), std::string::npos);
- for (UseFlagNameSet::ConstIterator p(prefixes->begin()), p_end(prefixes->end()) ;
- p != p_end ; ++p)
- if (0 == stringify(f.flag).compare(0, stringify(*p).length(), stringify(*p), 0, stringify(*p).length()))
- f.prefix_delim_pos = stringify(*p).length();
- _imp->value->insert(f);
- }
-
+ _imp->value = parse_provide(_imp->string_value, _imp->env, _imp->id, *_imp->id->eapi());
return _imp->value;
}
std::string
-EIUseKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
+EProvideKey::pretty_print(const ProvideSpecTree::ItemFormatter & f) const
{
- std::string result;
- std::multimap<std::string, IUseFlag> prefixes;
- for (IUseFlagSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (std::string::npos != i->prefix_delim_pos)
- {
- prefixes.insert(std::make_pair(stringify(i->flag).substr(0, i->prefix_delim_pos), *i));
- continue;
- }
-
- if (! result.empty())
- result.append(" ");
-
- 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()).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()));
- else
- result.append(f.format(*i, format::Disabled()));
- }
-
- for (std::multimap<std::string, IUseFlag>::const_iterator j(prefixes.begin()), j_end(prefixes.end()) ;
- j != j_end ; ++j)
- {
- if (! result.empty())
- result.append(" ");
-
- 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()).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()));
- else
- result.append(f.format(j->second, format::Disabled()));
- }
-
- return result;
+ StringifyFormatter ff(f);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
+ value()->accept(p);
+ return stringify(p);
}
std::string
-EIUseKey::pretty_print_flat_with_comparison(
- const Environment * const env,
- const std::tr1::shared_ptr<const PackageID> & id,
- const Formatter<IUseFlag> & f) const
+EProvideKey::pretty_print_flat(const ProvideSpecTree::ItemFormatter & f) const
{
- std::string result;
- std::multimap<std::string, IUseFlag> prefixes;
- for (IUseFlagSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (std::string::npos != i->prefix_delim_pos)
- {
- prefixes.insert(std::make_pair(stringify(i->flag).substr(0, i->prefix_delim_pos), *i));
- continue;
- }
-
- if (! result.empty())
- result.append(" ");
-
- std::string l;
- bool n;
-
- 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()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(i->flag, *_imp->id))
- {
- l = f.format(*i, format::Forced());
- n = true;
- }
- else if (_imp->env->query_use(i->flag, *_imp->id))
- {
- l = f.format(*i, format::Enabled());
- n = true;
- }
- else
- {
- l = f.format(*i, format::Disabled());
- n = false;
- }
-
- if (! id->iuse_key())
- l = f.decorate(*i, l, format::Added());
- else
- {
- using namespace std::tr1::placeholders;
- IUseFlagSet::ConstIterator p(std::find_if(id->iuse_key()->value()->begin(), id->iuse_key()->value()->end(),
- std::tr1::bind(std::equal_to<UseFlagName>(), i->flag, std::tr1::bind<const UseFlagName>(&IUseFlag::flag, _1))));
-
- if (p == id->iuse_key()->value()->end())
- l = f.decorate(*i, l, format::Added());
- else if (n != env->query_use(i->flag, *id))
- l = f.decorate(*i, l, format::Changed());
- }
-
- result.append(l);
- }
-
- for (std::multimap<std::string, IUseFlag>::const_iterator j(prefixes.begin()), j_end(prefixes.end()) ;
- j != j_end ; ++j)
- {
- if (! result.empty())
- result.append(" ");
-
- std::string l;
- bool n;
-
- 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()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(j->second.flag, *_imp->id))
- {
- l = f.format(j->second, format::Forced());
- n = true;
- }
- else if (_imp->env->query_use(j->second.flag, *_imp->id))
- {
- l = f.format(j->second, format::Enabled());
- n = true;
- }
- else
- {
- l = f.format(j->second, format::Disabled());
- n = false;
- }
-
- if (! id->iuse_key())
- l = f.decorate(j->second, l, format::Added());
- else
- {
- using namespace std::tr1::placeholders;
- IUseFlagSet::ConstIterator p(std::find_if(id->iuse_key()->value()->begin(), id->iuse_key()->value()->end(),
- std::tr1::bind(std::equal_to<UseFlagName>(), j->second.flag, std::tr1::bind<const UseFlagName>(&IUseFlag::flag, _1))));
-
- if (p == id->iuse_key()->value()->end())
- l = f.decorate(j->second, l, format::Added());
- else if (n != env->query_use(j->second.flag, *id))
- l = f.decorate(j->second, l, format::Changed());
- }
-
- result.append(l);
- }
-
- return result;
+ StringifyFormatter ff(f);
+ DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
+ value()->accept(p);
+ return stringify(p);
}
namespace paludis
@@ -831,94 +671,7 @@ EKeywordsKey::pretty_print_flat(const Formatter<KeywordName> & f) const
namespace paludis
{
template <>
- struct Implementation<EUseKey>
- {
- const std::tr1::shared_ptr<const ERepositoryID> id;
- const Environment * const env;
- const std::string string_value;
- mutable Mutex value_mutex;
- mutable std::tr1::shared_ptr<UseFlagNameSet> value;
-
- Implementation(const std::tr1::shared_ptr<const ERepositoryID> & i, const Environment * const e, const std::string & v) :
- id(i),
- env(e),
- string_value(v)
- {
- }
- };
-}
-
-EUseKey::EUseKey(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & id,
- const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
- MetadataCollectionKey<UseFlagNameSet>(r, h, t),
- PrivateImplementationPattern<EUseKey>(new Implementation<EUseKey>(id, e, v)),
- _imp(PrivateImplementationPattern<EUseKey>::_imp)
-{
-}
-
-EUseKey::~EUseKey()
-{
-}
-
-const std::tr1::shared_ptr<const UseFlagNameSet>
-EUseKey::value() const
-{
- Lock l(_imp->value_mutex);
-
- if (_imp->value)
- return _imp->value;
-
- _imp->value.reset(new UseFlagNameSet);
- Context context("When parsing metadata key '" + raw_name() + "' from '" + stringify(*_imp->id) + "':");
- std::list<std::string> tokens;
- tokenise_whitespace(_imp->string_value, std::back_inserter(tokens));
- try
- {
- for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
- t != t_end ; ++t)
- if ('-' != t->at(0))
- _imp->value->insert(UseFlagName(*t));
- }
- catch (const InternalError &)
- {
- throw;
- }
- catch (const Exception & e)
- {
- Log::get_instance()->message("e.use.malformed", ll_warning, lc_context) << "Error loading " << raw_name() << " for '" << *_imp->id << "' due to exception '"
- << e.message() << "' (" << e.what() << "), pretending " << raw_name() << " is empty for this package";
- }
-
- return _imp->value;
-}
-
-std::string
-EUseKey::pretty_print_flat(const Formatter<UseFlagName> & f) const
-{
- std::string result;
- for (UseFlagNameSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (! result.empty())
- result.append(" ");
-
- 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()).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()));
- else
- result.append(f.format(*i, format::Disabled()));
- }
-
- return result;
-}
-
-namespace paludis
-{
- template <>
- struct Implementation<EInheritedKey>
+ struct Implementation<EStringSetKey>
{
const std::tr1::shared_ptr<const ERepositoryID> id;
const std::string string_value;
@@ -933,20 +686,20 @@ namespace paludis
};
}
-EInheritedKey::EInheritedKey(const std::tr1::shared_ptr<const ERepositoryID> & id,
+EStringSetKey::EStringSetKey(const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::string & r, const std::string & h, const std::string & v, const MetadataKeyType t) :
MetadataCollectionKey<Set<std::string> >(r, h, t),
- PrivateImplementationPattern<EInheritedKey>(new Implementation<EInheritedKey>(id, v)),
- _imp(PrivateImplementationPattern<EInheritedKey>::_imp)
+ PrivateImplementationPattern<EStringSetKey>(new Implementation<EStringSetKey>(id, v)),
+ _imp(PrivateImplementationPattern<EStringSetKey>::_imp)
{
}
-EInheritedKey::~EInheritedKey()
+EStringSetKey::~EStringSetKey()
{
}
const std::tr1::shared_ptr<const Set<std::string> >
-EInheritedKey::value() const
+EStringSetKey::value() const
{
Lock l(_imp->value_mutex);
@@ -968,7 +721,7 @@ namespace
}
std::string
-EInheritedKey::pretty_print_flat(const Formatter<std::string> & f) const
+EStringSetKey::pretty_print_flat(const Formatter<std::string> & f) const
{
using namespace std::tr1::placeholders;
return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_string, _1, f));
@@ -1113,3 +866,300 @@ EMTimeKey::value() const
return *_imp->value;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<EChoicesKey>
+ {
+ mutable Mutex mutex;
+ mutable std::tr1::shared_ptr<Choices> value;
+
+ const Environment * const env;
+ const std::tr1::shared_ptr<const ERepositoryID> id;
+ const std::tr1::shared_ptr<const ERepository> maybe_e_repository;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const ERepositoryID> & i,
+ const std::tr1::shared_ptr<const ERepository> & p) :
+ env(e),
+ id(i),
+ maybe_e_repository(p)
+ {
+ }
+ };
+}
+
+EChoicesKey::EChoicesKey(
+ const Environment * const e,
+ const std::tr1::shared_ptr<const ERepositoryID> & i,
+ const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::tr1::shared_ptr<const ERepository> & p) :
+ MetadataValueKey<std::tr1::shared_ptr<const Choices> > (r, h, t),
+ PrivateImplementationPattern<EChoicesKey>(new Implementation<EChoicesKey>(e, i, p)),
+ _imp(PrivateImplementationPattern<EChoicesKey>::_imp)
+{
+}
+
+EChoicesKey::~EChoicesKey()
+{
+}
+
+namespace
+{
+ struct IsExpand
+ {
+ ChoiceNameWithPrefix flag;
+ std::string delim;
+
+ IsExpand(const ChoiceNameWithPrefix & f, const std::string & d) :
+ flag(f),
+ delim(d)
+ {
+ }
+
+ bool operator() (const std::string & s) const
+ {
+ std::string lower_s;
+ std::transform(s.begin(), s.end(), std::back_inserter(lower_s), &::tolower);
+ lower_s.append(delim);
+ return (0 == flag.data().compare(0, lower_s.length(), lower_s, 0, lower_s.length()));
+ }
+ };
+
+ struct MyOptionsFinder :
+ ConstVisitor<PlainTextSpecTree>
+ {
+ typedef std::list<std::tr1::shared_ptr<const PlainTextDepSpec> > Values;
+ typedef std::map<ChoicePrefixName, Values> Prefixes;
+
+ Prefixes prefixes;
+ std::list<ChoicePrefixName> current_prefix_stack;
+
+ MyOptionsFinder()
+ {
+ current_prefix_stack.push_front(ChoicePrefixName(""));
+ }
+
+ void visit_leaf(const PlainTextDepSpec & s)
+ {
+ prefixes[*current_prefix_stack.begin()].push_back(std::tr1::static_pointer_cast<const PlainTextDepSpec>(s.clone()));
+ }
+
+ void visit_leaf(const PlainTextLabelDepSpec & s)
+ {
+ *current_prefix_stack.begin() = ChoicePrefixName(s.label());
+ }
+
+ void visit_sequence(const ConditionalDepSpec &,
+ PlainTextSpecTree::ConstSequenceIterator cur,
+ PlainTextSpecTree::ConstSequenceIterator end)
+ {
+ if (cur != end)
+ throw InternalError(PALUDIS_HERE, "Don't know how to handle conditionals here yet");
+ }
+
+ void visit_sequence(const AllDepSpec &,
+ PlainTextSpecTree::ConstSequenceIterator cur,
+ PlainTextSpecTree::ConstSequenceIterator end)
+ {
+ current_prefix_stack.push_front(*current_prefix_stack.begin());
+ std::for_each(cur, end, accept_visitor(*this));
+ current_prefix_stack.pop_front();
+ }
+ };
+}
+
+#include <iostream>
+#include <paludis/util/join.hh>
+#include <paludis/util/member_iterator-impl.hh>
+
+const std::tr1::shared_ptr<const Choices>
+EChoicesKey::value() const
+{
+ Lock l(_imp->mutex);
+ if (_imp->value)
+ return _imp->value;
+
+ Context context("When making Choices key for '" + stringify(*_imp->id) + "':");
+
+ _imp->value.reset(new Choices);
+ if (! _imp->id->eapi()->supported())
+ return _imp->value;
+
+ std::tr1::shared_ptr<Choice> use(new Choice(
+ _imp->id->eapi()->supported()->ebuild_environment_variables()->env_use(),
+ _imp->id->eapi()->supported()->ebuild_environment_variables()->env_use(),
+ ChoicePrefixName(""),
+ false,
+ false,
+ true,
+ true));
+ _imp->value->add(use);
+
+ std::tr1::shared_ptr<const Set<std::string> > hidden;
+ if (_imp->id->raw_use_expand_hidden_key())
+ hidden = _imp->id->raw_use_expand_hidden_key()->value();
+
+ if (_imp->id->raw_myoptions_key())
+ {
+ Context local_context("When using raw_myoptions_key to populate choices:");
+
+ /* yay. myoptions is easy. */
+ MyOptionsFinder myoptions;
+ _imp->id->raw_myoptions_key()->value()->accept(myoptions);
+
+ for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()),
+ u_end(_imp->id->raw_use_expand_key()->value()->end()) ;
+ u != u_end ; ++u)
+ {
+ Context local_local_context("When using raw_use_expand_key value '" + *u + "' to populate choices:");
+
+ std::string lower_u;
+ std::transform(u->begin(), u->end(), std::back_inserter(lower_u), &::tolower);
+ std::tr1::shared_ptr<Choice> exp(new Choice(stringify(*u), lower_u, ChoicePrefixName(lower_u),
+ false, hidden ? hidden->end() != hidden->find(*u) : false, false, true));
+ _imp->value->add(exp);
+
+ MyOptionsFinder::Prefixes::iterator p(myoptions.prefixes.find(ChoicePrefixName(lower_u)));
+ if (myoptions.prefixes.end() != p)
+ {
+ for (MyOptionsFinder::Values::const_iterator v(p->second.begin()), v_end(p->second.end()) ;
+ v != v_end ; ++v)
+ exp->add(_imp->id->make_choice_value(exp, UnprefixedChoiceName((*v)->text()), indeterminate, true));
+ myoptions.prefixes.erase(p);
+ }
+ }
+
+ MyOptionsFinder::Prefixes::iterator p(myoptions.prefixes.find(ChoicePrefixName("")));
+ if (myoptions.prefixes.end() != p)
+ {
+ Context local_local_context("When using empty prefix to populate choices:");
+ for (MyOptionsFinder::Values::const_iterator v(p->second.begin()), v_end(p->second.end()) ;
+ v != v_end ; ++v)
+ use->add(_imp->id->make_choice_value(use, UnprefixedChoiceName((*v)->text()), indeterminate, true));
+ myoptions.prefixes.erase(p);
+ }
+
+ if (! myoptions.prefixes.empty())
+ {
+ Log::get_instance()->message("e.myoptions_key.invalid", ll_warning, lc_context) << "Key '" << raw_name() << "' for '"
+ << *_imp->id << "' uses unknown prefixes { '" << join(first_iterator(myoptions.prefixes.begin()),
+ first_iterator(myoptions.prefixes.end()), "', '") << "' }";
+ }
+ }
+ else
+ {
+ /* ugh. iuse and all that mess. */
+ Context local_context("When using raw_iuse_key and raw_use_key to populate choices:");
+
+ std::map<ChoiceNameWithPrefix, Tribool> i_values;
+ std::string delim(1, _imp->id->eapi()->supported()->ebuild_options()->use_expand_separator());
+
+ if (_imp->id->raw_iuse_key())
+ {
+ for (Set<std::string>::ConstIterator u(_imp->id->raw_iuse_key()->value()->begin()), u_end(_imp->id->raw_iuse_key()->value()->end()) ;
+ u != u_end ; ++u)
+ {
+ std::pair<ChoiceNameWithPrefix, Tribool> flag(parse_iuse(_imp->id->eapi(), *u));
+ if (_imp->id->raw_use_expand_key() &&
+ _imp->id->raw_use_expand_key()->value()->end() != std::find_if(
+ _imp->id->raw_use_expand_key()->value()->begin(),
+ _imp->id->raw_use_expand_key()->value()->end(),
+ IsExpand(flag.first, delim)))
+ i_values.insert(flag);
+ else
+ use->add(_imp->id->make_choice_value(use, UnprefixedChoiceName(stringify(flag.first)), flag.second, true));
+ }
+
+ /* pain in the ass: installed packages with DEPEND="x86? ( blah )" need to work,
+ * even if x86 isn't listed in IUSE. */
+ if (_imp->id->raw_use_key())
+ {
+ for (Set<std::string>::ConstIterator u(_imp->id->raw_use_key()->value()->begin()), u_end(_imp->id->raw_use_key()->value()->end()) ;
+ u != u_end ; ++u)
+ {
+ if (_imp->id->raw_iuse_key()->value()->end() != _imp->id->raw_iuse_key()->value()->find(*u))
+ continue;
+
+ std::pair<ChoiceNameWithPrefix, Tribool> flag(ChoiceNameWithPrefix("x"), indeterminate);
+ if (0 == u->compare(0, 1, "-", 0, 1))
+ flag = std::make_pair(ChoiceNameWithPrefix(u->substr(1)), false);
+ else
+ flag = std::make_pair(ChoiceNameWithPrefix(*u), true);
+
+ if (_imp->id->raw_use_expand_key() &&
+ _imp->id->raw_use_expand_key()->value()->end() != std::find_if(
+ _imp->id->raw_use_expand_key()->value()->begin(),
+ _imp->id->raw_use_expand_key()->value()->end(),
+ IsExpand(flag.first, delim)))
+ {
+ /* don't need to worry */
+ }
+ else
+ use->add(_imp->id->make_choice_value(use, UnprefixedChoiceName(stringify(flag.first)), flag.second, false));
+ }
+ }
+ }
+
+ std::string env_arch(_imp->id->eapi()->supported()->ebuild_environment_variables()->env_arch());
+ if ((! env_arch.empty()) && _imp->maybe_e_repository)
+ {
+ std::tr1::shared_ptr<Choice> arch(new Choice(env_arch, env_arch, ChoicePrefixName(""), false, true, false, false));
+ _imp->value->add(arch);
+
+ for (Set<UnprefixedChoiceName>::ConstIterator a(_imp->maybe_e_repository->arch_flags()->begin()), a_end(_imp->maybe_e_repository->arch_flags()->end()) ;
+ a != a_end ; ++a)
+ arch->add(_imp->id->make_choice_value(arch, *a, indeterminate, false));
+ }
+
+ if (_imp->id->raw_use_expand_key())
+ {
+ for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()),
+ u_end(_imp->id->raw_use_expand_key()->value()->end()) ;
+ u != u_end ; ++u)
+ {
+ std::string lower_u;
+ std::transform(u->begin(), u->end(), std::back_inserter(lower_u), &::tolower);
+ std::tr1::shared_ptr<Choice> exp(new Choice(stringify(*u), lower_u, ChoicePrefixName(lower_u),
+ ! _imp->id->eapi()->supported()->ebuild_options()->require_use_expand_in_iuse(),
+ hidden ? hidden->end() != hidden->find(*u) : false, false, true));
+ _imp->value->add(exp);
+
+ std::set<UnprefixedChoiceName> values;
+
+ if (! _imp->id->eapi()->supported()->ebuild_options()->require_use_expand_in_iuse())
+ {
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+ e_values(_imp->env->known_choice_value_names(_imp->id, exp)),
+ r_values;
+
+ if (_imp->maybe_e_repository)
+ r_values = _imp->maybe_e_repository->profile()->known_choice_value_names(_imp->id, exp);
+ else
+ r_values = make_shared_ptr(new Set<UnprefixedChoiceName>);
+
+ std::set_union(e_values->begin(), e_values->end(), r_values->begin(), r_values->end(),
+ std::inserter(values, values.begin()));
+ }
+
+ for (std::map<ChoiceNameWithPrefix, Tribool>::const_iterator i(i_values.begin()), i_end(i_values.end()) ;
+ i != i_end ; ++i)
+ if (IsExpand(i->first, delim)(*u))
+ values.insert(UnprefixedChoiceName(i->first.data().substr(u->length() + delim.length())));
+
+ for (std::set<UnprefixedChoiceName>::const_iterator v(values.begin()), v_end(values.end()) ;
+ v != v_end ; ++v)
+ {
+ std::map<ChoiceNameWithPrefix, Tribool>::const_iterator i(i_values.find(ChoiceNameWithPrefix(lower_u + delim + stringify(*v))));
+ if (i_values.end() != i)
+ exp->add(_imp->id->make_choice_value(exp, *v, i->second, true));
+ else
+ exp->add(_imp->id->make_choice_value(exp, *v, indeterminate, false));
+ }
+ }
+ }
+ }
+
+ _imp->id->add_build_options(_imp->value);
+ return _imp->value;
+}
+
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 5c3738a..a5958ad 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -26,6 +26,8 @@
namespace paludis
{
+ class ERepository;
+
namespace erepository
{
class ERepositoryID;
@@ -148,6 +150,29 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class EMyOptionsKey :
+ public MetadataSpecTreeKey<PlainTextSpecTree>,
+ private PrivateImplementationPattern<EMyOptionsKey>
+ {
+ private:
+ PrivateImplementationPattern<EMyOptionsKey>::ImpPtr & _imp;
+
+ public:
+ EMyOptionsKey(const Environment * const,
+ const std::tr1::shared_ptr<const ERepositoryID> &,
+ const std::string &, const std::string &, const std::string &, const MetadataKeyType);
+ ~EMyOptionsKey();
+
+ virtual const std::tr1::shared_ptr<const PlainTextSpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print(const PlainTextSpecTree::ItemFormatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print_flat(const PlainTextSpecTree::ItemFormatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class EProvideKey :
public MetadataSpecTreeKey<ProvideSpecTree>,
private PrivateImplementationPattern<EProvideKey>
@@ -195,34 +220,6 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
- class EIUseKey :
- public MetadataCollectionKey<IUseFlagSet>,
- private PrivateImplementationPattern<EIUseKey>
- {
- private:
- PrivateImplementationPattern<EIUseKey>::ImpPtr & _imp;
-
- public:
- EIUseKey(
- const Environment * const,
- const std::tr1::shared_ptr<const ERepositoryID> &,
- const std::string &, const std::string &, const std::string &, const MetadataKeyType);
- ~EIUseKey();
-
- const std::tr1::shared_ptr<const IUseFlagSet> value() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const Formatter<IUseFlag> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat_with_comparison(
- const Environment * const,
- const std::tr1::shared_ptr<const PackageID> &,
- const Formatter<IUseFlag> &
- ) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
class EKeywordsKey :
public MetadataCollectionKey<KeywordNameSet>,
private PrivateImplementationPattern<EKeywordsKey>
@@ -244,38 +241,17 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
- class EUseKey :
- public MetadataCollectionKey<UseFlagNameSet>,
- private PrivateImplementationPattern<EUseKey>
- {
- private:
- PrivateImplementationPattern<EUseKey>::ImpPtr & _imp;
-
- public:
- EUseKey(
- const Environment * const,
- const std::tr1::shared_ptr<const ERepositoryID> &,
- const std::string &, const std::string &, const std::string &, const MetadataKeyType);
- ~EUseKey();
-
- const std::tr1::shared_ptr<const UseFlagNameSet> value() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const Formatter<UseFlagName> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- class EInheritedKey :
+ class EStringSetKey :
public MetadataCollectionKey<Set<std::string> >,
- private PrivateImplementationPattern<EInheritedKey>
+ private PrivateImplementationPattern<EStringSetKey>
{
private:
- PrivateImplementationPattern<EInheritedKey>::ImpPtr & _imp;
+ PrivateImplementationPattern<EStringSetKey>::ImpPtr & _imp;
public:
- EInheritedKey(const std::tr1::shared_ptr<const ERepositoryID> &,
+ EStringSetKey(const std::tr1::shared_ptr<const ERepositoryID> &,
const std::string &, const std::string &, const std::string &, const MetadataKeyType);
- ~EInheritedKey();
+ ~EStringSetKey();
const std::tr1::shared_ptr<const Set<std::string> > value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -316,6 +292,27 @@ namespace paludis
time_t value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class EChoicesKey :
+ public MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
+ private PrivateImplementationPattern<EChoicesKey>
+ {
+ private:
+ PrivateImplementationPattern<EChoicesKey>::ImpPtr & _imp;
+
+ public:
+ EChoicesKey(
+ const Environment * const,
+ const std::tr1::shared_ptr<const ERepositoryID> &,
+ const std::string &,
+ const std::string &,
+ const MetadataKeyType,
+ const std::tr1::shared_ptr<const ERepository> & maybe_profile);
+
+ ~EChoicesKey();
+
+ const std::tr1::shared_ptr<const Choices> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index ea43aa9..55bcc92 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -56,6 +56,7 @@
#include <paludis/qa.hh>
#include <paludis/elike_package_dep_spec.hh>
#include <paludis/about.hh>
+#include <paludis/choice.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
@@ -183,7 +184,8 @@ namespace paludis
const std::map<QualifiedPackageName, QualifiedPackageName> provide_map;
- mutable std::tr1::shared_ptr<UseFlagNameSet> arch_flags;
+ mutable std::tr1::shared_ptr<Set<UnprefixedChoiceName> > arch_flags;
+ mutable std::tr1::shared_ptr<const UseDesc> use_desc;
mutable bool has_mirrors;
mutable MirrorMap mirrors;
@@ -191,8 +193,6 @@ namespace paludis
mutable bool has_profiles_desc;
mutable ProfilesDesc profiles_desc;
- mutable std::list<std::tr1::shared_ptr<UseDesc> > use_desc;
-
mutable std::tr1::shared_ptr<ERepositoryProfile> profile_ptr;
mutable std::tr1::shared_ptr<ERepositoryNews> news_ptr;
@@ -471,7 +471,6 @@ ERepository::ERepository(const ERepositoryParams & p) :
#endif
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)),
@@ -611,130 +610,14 @@ ERepository::repository_masked(const PackageID & id) const
return std::tr1::shared_ptr<const RepositoryMaskInfo>();
}
-UseFlagState
-ERepository::query_use(const UseFlagName & f, const PackageID & e) const
-{
- if (this != e.repository().get())
- return use_unspecified;
-
- const ERepositoryID & id(static_cast<const ERepositoryID &>(e));
-
- if (! id.eapi()->supported())
- {
- Log::get_instance()->message("e.query_use.unsupported_eapi", ll_qa, lc_no_context)
- << "Was asked for the state of USE flag '" << f << "' for ID '" << e
- << "', but this ID has an unsupported EAPI";
- return use_disabled;
- }
-
- if (id.use_key())
- {
- if (id.use_key()->value()->end() != id.use_key()->value()->find(f))
- return use_enabled;
- else
- return use_disabled;
- }
- else
- {
- _imp->need_profiles();
-
- /* Check that the value is in iuse, and return false if it isn't. Otherwise weird stuff
- * happens, like ticket:560. But don't for USE_EXPAND and ARCH things on EAPIs where
- * they don't have to be listed. */
- do
- {
- if (! id.iuse_key())
- break;
-
- if (id.iuse_key()->value()->end() != id.iuse_key()->value()->find(IUseFlag(f, use_disabled, 0)))
- break;
-
- if (! id.eapi()->supported()->ebuild_options()->require_use_expand_in_iuse())
- {
- if (arch_flags()->end() != arch_flags()->find(f))
- break;
-
- bool is_expand(false);
- const std::tr1::shared_ptr<const UseFlagNameSet> prefixes(use_expand_prefixes());
- for (UseFlagNameSet::ConstIterator p(prefixes->begin()), p_end(prefixes->end()) ;
- p != p_end && ! is_expand ; ++p)
- if (0 == stringify(*p).compare(0, stringify(*p).length(), stringify(f), 0, stringify(*p).length()))
- is_expand = true;
-
- if (is_expand)
- break;
-
- Log::get_instance()->message("e.query_use.not_in_iuse", ll_qa, lc_context)
- << "Was asked for the state of "
- << id.eapi()->supported()->ebuild_environment_variables()->env_use()
- << " flag '" << f << "' for ID '" << e
- << "', but that flag is not listed in " << id.iuse_key()->raw_name() << " and is not a "
- << id.eapi()->supported()->ebuild_environment_variables()->env_use_expand() << " or "
- << id.eapi()->supported()->ebuild_environment_variables()->env_arch() << " value";
- }
- else
- Log::get_instance()->message("e.query_use.not_in_iuse", ll_qa, lc_context)
- << "Was asked for the state of "
- << id.eapi()->supported()->ebuild_environment_variables()->env_use()
- << " flag '" << f << "' for ID '" << e
- << "', but that flag is not listed in " << id.iuse_key()->raw_name();
-
- return use_disabled;
- } while (false);
-
- if (query_use_mask(f, e))
- return use_disabled;
- else if (query_use_force(f, e))
- return use_enabled;
- else
- return _imp->profile_ptr->use_state_ignoring_masks(f, e);
- }
-}
-
-bool
-ERepository::query_use_mask(const UseFlagName & u, const PackageID & e) const
-{
- if (this != e.repository().get())
- return use_unspecified;
-
- const ERepositoryID & id(static_cast<const ERepositoryID &>(e));
- if (id.use_key())
- {
- return (id.use_key()->value()->end() == id.use_key()->value()->find(u));
- }
- else
- {
- _imp->need_profiles();
- return _imp->profile_ptr->use_masked(u, e);
- }
-}
-
-bool
-ERepository::query_use_force(const UseFlagName & u, const PackageID & e) const
-{
- if (this != e.repository().get())
- return use_unspecified;
-
- const ERepositoryID & id(static_cast<const ERepositoryID &>(e));
- if (id.use_key())
- {
- return (id.use_key()->value()->end() != id.use_key()->value()->find(u));
- }
- else
- {
- _imp->need_profiles();
- return _imp->profile_ptr->use_forced(u, e);
- }
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
+const std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
ERepository::arch_flags() const
{
Lock l(_imp->mutexes->arch_flags_mutex);
if (! _imp->arch_flags)
{
Context context("When loading arch list:");
- _imp->arch_flags.reset(new UseFlagNameSet);
+ _imp->arch_flags.reset(new Set<UnprefixedChoiceName>);
bool found_one(false);
std::tr1::shared_ptr<const FSEntrySequence> arch_list_files(_imp->layout->arch_list_files());
@@ -745,7 +628,7 @@ ERepository::arch_flags() const
continue;
LineConfigFile archs(*p, LineConfigFileOptions() + lcfo_disallow_continuations);
- std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(_imp->arch_flags->inserter()));
+ std::copy(archs.begin(), archs.end(), create_inserter<UnprefixedChoiceName>(_imp->arch_flags->inserter()));
found_one = true;
}
@@ -973,75 +856,6 @@ ERepository::virtual_packages() const
return result;
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-ERepository::use_expand_flags() const
-{
- _imp->need_profiles();
-
- std::string expand_sep(stringify(EAPIData::get_instance()->eapi_from_string(
- _imp->params.profile_eapi)->supported()->ebuild_options()->use_expand_separator()));
- std::tr1::shared_ptr<UseFlagNameSet> result(new UseFlagNameSet);
- for (ERepositoryProfile::UseExpandConstIterator i(_imp->profile_ptr->begin_use_expand()),
- i_end(_imp->profile_ptr->end_use_expand()) ; i != i_end ; ++i)
- {
- std::list<std::string> values;
- tokenise_whitespace(_imp->profile_ptr->environment_variable(
- stringify(*i)), std::back_inserter(values));
- for (std::list<std::string>::const_iterator j(values.begin()), j_end(values.end()) ;
- j != j_end ; ++j)
- {
- std::string f(stringify(*i) + expand_sep + *j), lower_f;
- std::transform(f.begin(), f.end(), std::back_inserter(lower_f), &::tolower);
- result->insert(UseFlagName(lower_f));
- }
- }
-
- return result;
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-ERepository::use_expand_prefixes() const
-{
- _imp->need_profiles();
-
- std::tr1::shared_ptr<UseFlagNameSet> result(new UseFlagNameSet);
- for (ERepositoryProfile::UseExpandConstIterator i(_imp->profile_ptr->begin_use_expand()),
- i_end(_imp->profile_ptr->end_use_expand()) ; i != i_end ; ++i)
- {
- std::string lower_i;
- std::transform(i->data().begin(), i->data().end(), std::back_inserter(lower_i), &::tolower);
- result->insert(UseFlagName(lower_i));
- }
-
- return result;
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-ERepository::use_expand_hidden_prefixes() const
-{
- _imp->need_profiles();
-
- std::tr1::shared_ptr<UseFlagNameSet> result(new UseFlagNameSet);
- for (ERepositoryProfile::UseExpandConstIterator i(_imp->profile_ptr->begin_use_expand_hidden()),
- i_end(_imp->profile_ptr->end_use_expand_hidden()) ; i != i_end ; ++i)
- {
- std::string lower_i;
- std::transform(i->data().begin(), i->data().end(), std::back_inserter(lower_i), &::tolower);
- result->insert(UseFlagName(lower_i));
- }
-
- return result;
-}
-
-char
-ERepository::use_expand_separator(const PackageID & id) const
-{
- if (this != id.repository().get())
- return '\0';
- const std::tr1::shared_ptr<const EAPI> & eapi(static_cast<const ERepositoryID &>(id).eapi());
- return eapi->supported() ? eapi->supported()->ebuild_options()->use_expand_separator() : '\0';
-}
-
void
ERepository::regenerate_cache() const
{
@@ -1104,7 +918,7 @@ ERepository::set_profile(const ProfilesConstIterator & iter)
}
void
-ERepository::set_profile_by_arch(const UseFlagName & arch)
+ERepository::set_profile_by_arch(const std::string & arch)
{
Context context("When setting profile by arch '" + stringify(arch) + "':");
@@ -1125,31 +939,6 @@ ERepository::set_profile_by_arch(const UseFlagName & arch)
throw ConfigurationError("Cannot find a profile appropriate for '" + stringify(arch) + "'");
}
-std::string
-ERepository::describe_use_flag(const UseFlagName & f,
- const PackageID & e) const
-{
- Lock l(_imp->mutexes->use_desc_mutex);
-
- if (_imp->use_desc.empty())
- {
- std::string expand_sep(stringify(EAPIData::get_instance()->eapi_from_string(
- _imp->params.profile_eapi)->supported()->ebuild_options()->use_expand_separator()));
- std::tr1::shared_ptr<const UseDescFileInfoSequence> use_desc_info(_imp->layout->use_desc_files());
- _imp->use_desc.push_back(std::tr1::shared_ptr<UseDesc>(new UseDesc(use_desc_info, expand_sep)));
- }
-
- std::string result;
- for (std::list<std::tr1::shared_ptr<UseDesc> >::const_iterator i(_imp->use_desc.begin()),
- i_end(_imp->use_desc.end()) ; i != i_end ; ++i)
- {
- std::string new_result((*i)->describe(f, e));
- if (! new_result.empty())
- result = new_result;
- }
- return result;
-}
-
const ERepositoryParams &
ERepository::params() const
{
@@ -1835,3 +1624,15 @@ ERepository::repository_factory_dependencies(
return result;
}
+const std::tr1::shared_ptr<const UseDesc>
+ERepository::use_desc() const
+{
+ Lock l(_imp->mutexes->use_desc_mutex);
+ if (! _imp->use_desc)
+ {
+ _imp->use_desc.reset(new UseDesc(_imp->layout->use_desc_files()));
+ }
+
+ return _imp->use_desc;
+}
+
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 6ed3cd3..f083020 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -51,7 +51,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE ERepository :
public Repository,
- public RepositoryUseInterface,
public RepositorySyncableInterface,
public RepositorySetsInterface,
public RepositoryEnvironmentVariableInterface,
@@ -136,36 +135,6 @@ namespace paludis
virtual bool sync() const;
- /* RepositoryUseInterface */
-
- virtual UseFlagState query_use(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool query_use_mask(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool query_use_force(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> arch_flags() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_flags() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_hidden_prefixes() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_prefixes() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual char use_expand_separator(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string describe_use_flag(const UseFlagName &,
- const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositoryEnvironmentVariableInterface */
virtual std::string get_environment_variable(
@@ -217,7 +186,7 @@ namespace paludis
ProfilesConstIterator find_profile(const FSEntry & location) const;
void set_profile(const ProfilesConstIterator & iter);
- void set_profile_by_arch(const UseFlagName &);
+ void set_profile_by_arch(const std::string &);
///\}
@@ -262,6 +231,9 @@ namespace paludis
const std::tr1::function<std::string (const std::string &)> &);
///\}
+
+ const std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > arch_flags() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::tr1::shared_ptr<const UseDesc> use_desc() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index c9dc9ea..5a1d1f8 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -43,6 +43,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <tr1/functional>
@@ -603,19 +604,20 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-2",
&env, UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK(repo->query_use(UseFlagName("flag1"), *p1) == use_enabled);
- TEST_CHECK(repo->query_use(UseFlagName("flag2"), *p1) == use_disabled);
- TEST_CHECK(repo->query_use_mask(UseFlagName("flag2"), *p1));
- TEST_CHECK(repo->query_use_mask(UseFlagName("flag3"), *p2));
- TEST_CHECK(! repo->query_use_mask(UseFlagName("flag3"), *p1));
- TEST_CHECK(repo->query_use_mask(UseFlagName("flag3"), *p4));
- TEST_CHECK(repo->query_use(UseFlagName("flag3"), *p1) == use_enabled);
- TEST_CHECK(repo->query_use(UseFlagName("flag5"), *p2) == use_enabled);
- TEST_CHECK(repo->query_use(UseFlagName("flag5"), *p1) == use_unspecified);
- TEST_CHECK(repo->query_use(UseFlagName("test"), *p1) == use_enabled);
- TEST_CHECK(repo->query_use(UseFlagName("test2"), *p1) == use_disabled);
- TEST_CHECK(! repo->query_use_mask(UseFlagName("test"), *p1));
- TEST_CHECK(repo->query_use_mask(UseFlagName("test2"), *p1));
+ TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1"))->enabled());
+ TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->enabled());
+ TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->enabled());
+ TEST_CHECK(p2->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag5"))->enabled());
+ TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag5"))->enabled());
+ TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->enabled());
+ TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2"))->enabled());
+
+ TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->locked());
+ TEST_CHECK(p2->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->locked());
+ TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->locked());
+ TEST_CHECK(p4->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->locked());
+ TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->locked());
+ TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2"))->locked());
}
}
} test_e_repository_query_use;
@@ -1065,8 +1067,6 @@ namespace test_cases
#endif
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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -1321,8 +1321,6 @@ namespace test_cases
env.package_database()->add_repository(2, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -1416,8 +1414,6 @@ namespace test_cases
env.package_database()->add_repository(2, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -1541,8 +1537,6 @@ namespace test_cases
env.package_database()->add_repository(2, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -1744,8 +1738,6 @@ namespace test_cases
#endif
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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -2338,8 +2330,6 @@ namespace test_cases
env.package_database()->add_repository(1, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 25201c0..1060cd2 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -220,15 +220,15 @@ cat <<END >profiles/profile/package.use.force || exit 1
cat-two/pkg-two flag5
END
cat <<END > cat-one/pkg-one/pkg-one-1.ebuild || exit 1
-IUSE="flag1 flag2 flag3 flag4 flag5 test1 test2"
+IUSE="flag1 flag2 flag3 flag4 flag5"
SLOT="0"
END
cat <<END > cat-one/pkg-one/pkg-one-2.ebuild || exit 1
-IUSE="flag1 flag2 flag3 flag4 flag5 test1 test2"
+IUSE="flag1 flag2 flag3 flag4 flag5"
SLOT="0"
END
cat <<END > cat-two/pkg-two/pkg-two-1.ebuild || exit 1
-IUSE="flag1 flag2 flag3 flag4 flag5 test1 test2"
+IUSE="flag1 flag2 flag3 flag4 flag5"
SLOT="0"
END
cd ..
@@ -1181,7 +1181,7 @@ LICENSE="GPL-2"
KEYWORDS="test"
pkg_setup() {
- [[ $USE == "enabled-weasel test linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 " ]] \
+ [[ $USE == "enabled-weasel linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 test " ]] \
|| die "USE=$USE is wrong"
[[ $USERLAND == "GNU" ]] || die "USERLAND=$USERLAND is wrong"
[[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
@@ -1199,7 +1199,7 @@ END
echo "cat" >> metadata/categories.conf || exit 1
cat <<END > profiles/profile/make.defaults
CHOST="i286-badger-linux-gnu"
-SUBOPTIONS="linguas"
+SUBOPTIONS="LINGUAS"
LINGUAS="en en_GB en_GB@UTF-8"
USERLAND="GNU"
OPTIONS="weasel spinach"
@@ -2102,12 +2102,13 @@ SUMMARY="The Short Description"
HOMEPAGE="http://example.com/"
DOWNLOADS=""
SLOT="0"
-MYOPTIONS="enabled-weasel broccoli linguas:enabled-en_GB"
+MYOPTIONS="enabled-weasel broccoli linguas: enabled-en_GB"
LICENCES="GPL-2"
PLATFORMS="test"
pkg_setup() {
[[ ${OPTIONS%%+( )} == "enabled-weasel linguas:enabled-en_GB" ]] || die "OPTIONS=$OPTIONS is wrong"
+ [[ ${LINGUAS%%+( )} == "enabled-en_GB" ]] || die "LINGUAS=$LINGUAS is wrong"
}
END
mkdir -p "packages/cat/doman-success"
diff --git a/paludis/repositories/e/e_repository_id.hh b/paludis/repositories/e/e_repository_id.hh
index e564ddb..3b6b8b0 100644
--- a/paludis/repositories/e/e_repository_id.hh
+++ b/paludis/repositories/e/e_repository_id.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_E_REPOSITORY_ID_HH 1
#include <paludis/package_id.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/repositories/e/eapi-fwd.hh>
namespace paludis
@@ -36,9 +37,20 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const = 0;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > restrict_key() const = 0;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > properties_key() const = 0;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const = 0;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_key() const = 0;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_iuse_key() const = 0;
+ virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > raw_myoptions_key() const = 0;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_key() const = 0;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_hidden_key() const = 0;
virtual std::tr1::shared_ptr<const Set<std::string> > breaks_portage() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::tr1::shared_ptr<ChoiceValue> make_choice_value(
+ const std::tr1::shared_ptr<const Choice> &, const UnprefixedChoiceName &, const Tribool,
+ const bool)
+ const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ virtual void add_build_options(const std::tr1::shared_ptr<Choices> &) const = 0;
};
}
}
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 4c0480a..0ca03bb 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -30,6 +30,7 @@
#include <paludis/util/save.hh>
#include <paludis/util/system.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/join.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
@@ -38,6 +39,8 @@
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/choice.hh>
#include <paludis/dep_tag.hh>
#include <paludis/environment.hh>
#include <paludis/match_package.hh>
@@ -57,20 +60,20 @@
using namespace paludis;
-template class WrappedForwardIterator<ERepositoryProfile::UseExpandConstIteratorTag, const UseFlagName>;
template class WrappedForwardIterator<ERepositoryProfile::VirtualsConstIteratorTag,
const std::pair<const QualifiedPackageName, std::tr1::shared_ptr<const PackageDepSpec> > >;
+typedef std::tr1::unordered_map<std::string, std::tr1::shared_ptr<Set<UnprefixedChoiceName> > > KnownMap;
+
namespace
{
- typedef std::tr1::unordered_set<UseFlagName, Hash<UseFlagName> > UseFlagSet;
typedef std::tr1::unordered_map<std::string, std::string, Hash<std::string> > EnvironmentVariablesMap;
typedef std::tr1::unordered_map<QualifiedPackageName, std::tr1::shared_ptr<const PackageDepSpec>, Hash<QualifiedPackageName> > VirtualsMap;
typedef std::tr1::unordered_map<QualifiedPackageName,
std::list<std::pair<std::tr1::shared_ptr<const PackageDepSpec>, std::tr1::shared_ptr<const RepositoryMaskInfo> > >,
Hash<QualifiedPackageName> > PackageMaskMap;
- typedef std::tr1::unordered_map<UseFlagName, bool, Hash<UseFlagName> > FlagStatusMap;
+ typedef std::tr1::unordered_map<ChoiceNameWithPrefix, bool, Hash<ChoiceNameWithPrefix> > FlagStatusMap;
typedef std::list<std::pair<std::tr1::shared_ptr<const PackageDepSpec>, FlagStatusMap> > PackageFlagStatusMapList;
struct StackedValues
@@ -113,6 +116,7 @@ namespace paludis
void load_spec_use_file(const FSEntry & file, PackageFlagStatusMapList & m);
void add_use_expand_to_use();
+ void fish_out_use_expand_names();
void make_vars_from_file_vars();
void handle_profile_arch_var(const std::string &);
void load_special_make_defaults_vars();
@@ -157,9 +161,10 @@ namespace paludis
///\name USE related values
///\{
- UseFlagSet use;
- UseFlagSet use_expand;
- UseFlagSet use_expand_hidden;
+ std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> > use;
+ std::tr1::shared_ptr<Set<std::string> > use_expand;
+ std::tr1::shared_ptr<Set<std::string> > use_expand_hidden;
+ KnownMap known_choice_value_names;
StackedValuesList stacked_values_list;
///\}
@@ -181,7 +186,9 @@ namespace paludis
repository(p),
system_packages(new ConstTreeSequence<SetSpecTree, AllDepSpec>(
std::tr1::shared_ptr<AllDepSpec>(new AllDepSpec))),
- system_tag(new GeneralSetDepTag(SetName("system"), stringify(name)))
+ system_tag(new GeneralSetDepTag(SetName("system"), stringify(name))),
+ use_expand(new Set<std::string>),
+ use_expand_hidden(new Set<std::string>)
{
Context context("When loading profiles '" + join(dirs.begin(), dirs.end(), "' '") + "' for repository '" + stringify(name) + "':");
load_environment();
@@ -202,6 +209,7 @@ namespace paludis
make_vars_from_file_vars();
load_special_make_defaults_vars();
add_use_expand_to_use();
+ fish_out_use_expand_names();
if (! arch_var_if_special.empty())
handle_profile_arch_var(arch_var_if_special);
}
@@ -340,10 +348,9 @@ Implementation<ERepositoryProfile>::load_profile_make_defaults(const FSEntry & d
repository->params().profile_eapi)->supported()->ebuild_environment_variables()->env_use_expand());
try
{
- use_expand.clear();
+ use_expand->clear();
if (! use_expand_var.empty())
- tokenise_whitespace(environment_variables[use_expand_var],
- create_inserter<UseFlagName>(std::inserter(use_expand, use_expand.end())));
+ tokenise_whitespace(environment_variables[use_expand_var], use_expand->inserter());
}
catch (const InternalError &)
{
@@ -365,8 +372,13 @@ Implementation<ERepositoryProfile>::load_special_make_defaults_vars()
{
use.clear();
if (! use_var.empty())
- tokenise_whitespace(environment_variables[use_var],
- create_inserter<UseFlagName>(std::inserter(use, use.end())));
+ {
+ std::list<std::string> tokens;
+ tokenise_whitespace(environment_variables[use_var], std::back_inserter(tokens));
+ for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ use.insert(std::make_pair("", *t));
+ }
}
catch (const InternalError &)
{
@@ -382,10 +394,9 @@ Implementation<ERepositoryProfile>::load_special_make_defaults_vars()
repository->params().profile_eapi)->supported()->ebuild_environment_variables()->env_use_expand());
try
{
- use_expand.clear();
+ use_expand->clear();
if (! use_expand_var.empty())
- tokenise_whitespace(environment_variables[use_expand_var],
- create_inserter<UseFlagName>(std::inserter(use_expand, use_expand.end())));
+ tokenise_whitespace(environment_variables[use_expand_var], use_expand->inserter());
}
catch (const InternalError &)
{
@@ -401,10 +412,9 @@ Implementation<ERepositoryProfile>::load_special_make_defaults_vars()
repository->params().profile_eapi)->supported()->ebuild_environment_variables()->env_use_expand_hidden());
try
{
- use_expand_hidden.clear();
+ use_expand_hidden->clear();
if (! use_expand_hidden_var.empty())
- tokenise_whitespace(environment_variables[use_expand_hidden_var],
- create_inserter<UseFlagName>(std::inserter(use_expand_hidden, use_expand_hidden.end())));
+ tokenise_whitespace(environment_variables[use_expand_hidden_var], use_expand_hidden->inserter());
}
catch (const InternalError &)
{
@@ -423,35 +433,15 @@ Implementation<ERepositoryProfile>::is_incremental(const std::string & s) const
{
std::tr1::shared_ptr<const erepository::EAPI> e(erepository::EAPIData::get_instance()->eapi_from_string(repository->params().profile_eapi));
- try
- {
- Context c("When checking whether '" + s + "' is incremental:");
+ Context c("When checking whether '" + s + "' is incremental:");
- return (! s.empty()) && (
- (s == e->supported()->ebuild_environment_variables()->env_use())
- || (s == e->supported()->ebuild_environment_variables()->env_use_expand())
- || (s == e->supported()->ebuild_environment_variables()->env_use_expand_hidden())
- || s == "CONFIG_PROTECT"
- || s == "CONFIG_PROTECT_MASK"
- || use_expand.end() != use_expand.find(UseFlagName(s)));
- }
- catch (const InternalError &)
- {
- throw;
- }
- catch (const Exception & x)
- {
- Log::get_instance()->message("e.profile.make_defaults.incremental_check_failure", ll_qa, lc_context)
- << "Caught exception '" << x.message() << "' (" << x.what()
- << "), possibly due to weird variable name being used in profile";
-
- return (! s.empty()) && (
- (s == e->supported()->ebuild_environment_variables()->env_use())
- || (s == e->supported()->ebuild_environment_variables()->env_use_expand())
- || (s == e->supported()->ebuild_environment_variables()->env_use_expand_hidden())
- || s == "CONFIG_PROTECT"
- || s == "CONFIG_PROTECT_MASK");
- }
+ return (! s.empty()) && (
+ (s == e->supported()->ebuild_environment_variables()->env_use())
+ || (s == e->supported()->ebuild_environment_variables()->env_use_expand())
+ || (s == e->supported()->ebuild_environment_variables()->env_use_expand_hidden())
+ || s == "CONFIG_PROTECT"
+ || s == "CONFIG_PROTECT_MASK"
+ || use_expand->end() != use_expand->find(s));
}
void
@@ -572,9 +562,9 @@ Implementation<ERepositoryProfile>::load_basic_use_file(const FSEntry & file, Fl
if (t->empty())
continue;
if ('-' == t->at(0))
- m[UseFlagName(t->substr(1))] = false;
+ m[ChoiceNameWithPrefix(t->substr(1))] = false;
else
- m[UseFlagName(*t)] = true;
+ m[ChoiceNameWithPrefix(*t)] = true;
}
catch (const InternalError &)
{
@@ -622,9 +612,9 @@ Implementation<ERepositoryProfile>::load_spec_use_file(const FSEntry & file, Pac
if (t->empty())
continue;
if ('-' == t->at(0))
- n->second[UseFlagName(t->substr(1))] = false;
+ n->second[ChoiceNameWithPrefix(t->substr(1))] = false;
else
- n->second[UseFlagName(*t)] = true;
+ n->second[ChoiceNameWithPrefix(*t)] = true;
}
catch (const InternalError &)
{
@@ -652,22 +642,43 @@ Implementation<ERepositoryProfile>::add_use_expand_to_use()
stacked_values_list.push_back(StackedValues("use_expand special values"));
- std::string expand_sep(stringify(erepository::EAPIData::get_instance()->eapi_from_string(
- repository->params().profile_eapi)->supported()->ebuild_options()->use_expand_separator()));
-
- for (UseFlagSet::const_iterator x(use_expand.begin()), x_end(use_expand.end()) ;
+ for (Set<std::string>::ConstIterator x(use_expand->begin()), x_end(use_expand->end()) ;
x != x_end ; ++x)
{
std::string lower_x;
- std::transform(x->data().begin(), x->data().end(), std::back_inserter(lower_x),
- &::tolower);
+ std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
std::list<std::string> uses;
- tokenise_whitespace(environment_variables[stringify(*x)],
- std::back_inserter(uses));
+ tokenise_whitespace(environment_variables[stringify(*x)], std::back_inserter(uses));
for (std::list<std::string>::const_iterator u(uses.begin()), u_end(uses.end()) ;
u != u_end ; ++u)
- use.insert(UseFlagName(lower_x + expand_sep + *u));
+ use.insert(std::make_pair(lower_x, *u));
+ }
+}
+
+void
+Implementation<ERepositoryProfile>::fish_out_use_expand_names()
+{
+ Context context("When finding all known USE_EXPAND names:");
+
+ for (Set<std::string>::ConstIterator x(use_expand->begin()), x_end(use_expand->end()) ;
+ x != x_end ; ++x)
+ {
+ std::string lower_x;
+ std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
+ known_choice_value_names.insert(std::make_pair(lower_x, make_shared_ptr(new Set<UnprefixedChoiceName>)));
+ }
+
+ for (std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> >::const_iterator u(use.begin()), u_end(use.end()) ;
+ u != u_end ; ++u)
+ {
+ if (! stringify(u->first).empty())
+ {
+ KnownMap::iterator i(known_choice_value_names.find(stringify(u->first)));
+ if (i == known_choice_value_names.end())
+ throw InternalError(PALUDIS_HERE, stringify(u->first));
+ i->second->insert(u->second);
+ }
}
}
@@ -683,10 +694,10 @@ Implementation<ERepositoryProfile>::handle_profile_arch_var(const std::string &
stacked_values_list.push_back(StackedValues("arch special values"));
try
{
- UseFlagName arch(arch_s);
+ std::string arch(arch_s);
- use.insert(arch);
- stacked_values_list.back().use_force[arch] = true;
+ use.insert(std::make_pair(ChoicePrefixName(""), arch));
+ stacked_values_list.back().use_force[ChoiceNameWithPrefix(arch)] = true;
}
catch (const InternalError &)
{
@@ -712,28 +723,33 @@ ERepositoryProfile::~ERepositoryProfile()
}
bool
-ERepositoryProfile::use_masked(const UseFlagName & u,
- const PackageID & e) const
+ERepositoryProfile::use_masked(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & value_unprefixed,
+ const ChoiceNameWithPrefix & value_prefixed
+ ) const
{
- if (_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(u) &&
- use_enabled != use_state_ignoring_masks(u, e))
+ if (stringify(choice->prefix()).empty() &&
+ _imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(value_unprefixed) &&
+ (! use_state_ignoring_masks(id, choice, value_unprefixed, value_prefixed).is_true()))
return true;
bool result(false);
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
{
- FlagStatusMap::const_iterator f(i->use_mask.find(u));
+ FlagStatusMap::const_iterator f(i->use_mask.find(value_prefixed));
if (i->use_mask.end() != f)
result = f->second;
for (PackageFlagStatusMapList::const_iterator g(i->package_use_mask.begin()),
g_end(i->package_use_mask.end()) ; g != g_end ; ++g)
{
- if (! match_package(*_imp->env, *g->first, e))
+ if (! match_package(*_imp->env, *g->first, *id))
continue;
- FlagStatusMap::const_iterator h(g->second.find(u));
+ FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
if (g->second.end() != h)
result = h->second;
}
@@ -743,28 +759,33 @@ ERepositoryProfile::use_masked(const UseFlagName & u,
}
bool
-ERepositoryProfile::use_forced(const UseFlagName & u, const PackageID & e) const
+ERepositoryProfile::use_forced(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & value_unprefixed,
+ const ChoiceNameWithPrefix & value_prefixed
+ ) const
{
- if (use_masked(u, e))
+ if (use_masked(id, choice, value_unprefixed, value_prefixed))
return false;
- if (_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(u))
+ if (stringify(choice->prefix()).empty() && (_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(value_unprefixed)))
return true;
bool result(false);
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
{
- FlagStatusMap::const_iterator f(i->use_force.find(u));
+ FlagStatusMap::const_iterator f(i->use_force.find(value_prefixed));
if (i->use_force.end() != f)
result = f->second;
for (PackageFlagStatusMapList::const_iterator g(i->package_use_force.begin()),
g_end(i->package_use_force.end()) ; g != g_end ; ++g)
{
- if (! match_package(*_imp->env, *g->first, e))
+ if (! match_package(*_imp->env, *g->first, *id))
continue;
- FlagStatusMap::const_iterator h(g->second.find(u));
+ FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
if (g->second.end() != h)
result = h->second;
}
@@ -773,13 +794,16 @@ ERepositoryProfile::use_forced(const UseFlagName & u, const PackageID & e) const
return result;
}
-UseFlagState
-ERepositoryProfile::use_state_ignoring_masks(const UseFlagName & u,
- const PackageID & e) const
+Tribool
+ERepositoryProfile::use_state_ignoring_masks(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & value_unprefixed,
+ const ChoiceNameWithPrefix & value_prefixed
+ ) const
{
- UseFlagState result(use_unspecified);
-
- result = _imp->use.end() != _imp->use.find(u) ? use_enabled : use_unspecified;
+ std::pair<ChoicePrefixName, UnprefixedChoiceName> prefix_value(choice->prefix(), value_unprefixed);
+ Tribool result(_imp->use.end() != _imp->use.find(prefix_value) ? Tribool(true) : Tribool(indeterminate));
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
@@ -787,28 +811,32 @@ ERepositoryProfile::use_state_ignoring_masks(const UseFlagName & u,
for (PackageFlagStatusMapList::const_iterator g(i->package_use.begin()),
g_end(i->package_use.end()) ; g != g_end ; ++g)
{
- if (! match_package(*_imp->env, *g->first, e))
+ if (! match_package(*_imp->env, *g->first, *id))
continue;
- FlagStatusMap::const_iterator h(g->second.find(u));
+ FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
if (g->second.end() != h)
- result = h->second ? use_enabled : use_disabled;
- }
- }
-
- if (use_unspecified == result)
- {
- if (e.iuse_key())
- {
- IUseFlagSet::ConstIterator i(e.iuse_key()->value()->find(IUseFlag(u, use_unspecified, std::string::npos)));
- if (i != e.iuse_key()->value()->end())
- result = i->state;
+ result = h->second ? true : false;
}
}
return result;
}
+std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
+ERepositoryProfile::known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> & choice
+ ) const
+{
+ std::string lower_x;
+ std::transform(choice->raw_name().begin(), choice->raw_name().end(), std::back_inserter(lower_x), &::tolower);
+ KnownMap::const_iterator i(_imp->known_choice_value_names.find(lower_x));
+ if (_imp->known_choice_value_names.end() == i)
+ throw InternalError(PALUDIS_HERE, lower_x);
+ return i->second;
+}
+
std::string
ERepositoryProfile::environment_variable(const std::string & s) const
{
@@ -825,30 +853,6 @@ ERepositoryProfile::system_packages() const
return _imp->system_packages;
}
-ERepositoryProfile::UseExpandConstIterator
-ERepositoryProfile::begin_use_expand() const
-{
- return UseExpandConstIterator(_imp->use_expand.begin());
-}
-
-ERepositoryProfile::UseExpandConstIterator
-ERepositoryProfile::end_use_expand() const
-{
- return UseExpandConstIterator(_imp->use_expand.end());
-}
-
-ERepositoryProfile::UseExpandConstIterator
-ERepositoryProfile::begin_use_expand_hidden() const
-{
- return UseExpandConstIterator(_imp->use_expand_hidden.begin());
-}
-
-ERepositoryProfile::UseExpandConstIterator
-ERepositoryProfile::end_use_expand_hidden() const
-{
- return UseExpandConstIterator(_imp->use_expand_hidden.end());
-}
-
ERepositoryProfile::VirtualsConstIterator
ERepositoryProfile::begin_virtuals() const
{
@@ -884,3 +888,15 @@ ERepositoryProfile::profile_masked(const PackageID & id) const
return std::tr1::shared_ptr<const RepositoryMaskInfo>();
}
+const std::tr1::shared_ptr<const Set<std::string> >
+ERepositoryProfile::use_expand() const
+{
+ return _imp->use_expand;
+}
+
+const std::tr1::shared_ptr<const Set<std::string> >
+ERepositoryProfile::use_expand_hidden() const
+{
+ return _imp->use_expand_hidden;
+}
+
diff --git a/paludis/repositories/e/e_repository_profile.hh b/paludis/repositories/e/e_repository_profile.hh
index b689128..3dcded6 100644
--- a/paludis/repositories/e/e_repository_profile.hh
+++ b/paludis/repositories/e/e_repository_profile.hh
@@ -26,9 +26,12 @@
#include <paludis/name-fwd.hh>
#include <paludis/version_spec-fwd.hh>
#include <paludis/mask-fwd.hh>
+#include <paludis/metadata_key-fwd.hh>
+#include <paludis/choice-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/tribool.hh>
#include <string>
/** \file
@@ -70,26 +73,41 @@ namespace paludis
///\{
/// Is a use flag masked?
- bool use_masked(const UseFlagName &, const PackageID &) const;
+ bool use_masked(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName & value_unprefixed,
+ const ChoiceNameWithPrefix & value_prefixed
+ ) const PALUDIS_ATTRIBUTE((warn_unused_result));
/// Is a use flag forced?
- bool use_forced(const UseFlagName &, const PackageID &) const;
+ bool use_forced(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName & value_unprefixed,
+ const ChoiceNameWithPrefix & value_prefixed
+ ) const PALUDIS_ATTRIBUTE((warn_unused_result));
/// Use flag state, ignoring mask and force?
- UseFlagState use_state_ignoring_masks(const UseFlagName &, const PackageID &) const;
+ Tribool use_state_ignoring_masks(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName & value_unprefixed,
+ const ChoiceNameWithPrefix & value_prefixed
+ ) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &
+ ) const PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
///\name Iterate over USE_EXPAND, USE_EXPAND_HIDDEN
///\{
- struct UseExpandConstIteratorTag;
- typedef WrappedForwardIterator<UseExpandConstIteratorTag, const UseFlagName> UseExpandConstIterator;
-
- UseExpandConstIterator begin_use_expand() const;
- UseExpandConstIterator end_use_expand() const;
- UseExpandConstIterator begin_use_expand_hidden() const;
- UseExpandConstIterator end_use_expand_hidden() const;
+ const std::tr1::shared_ptr<const Set<std::string> > use_expand() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::tr1::shared_ptr<const Set<std::string> > use_expand_hidden() const PALUDIS_ATTRIBUTE((warn_unused_result));
///\}
diff --git a/paludis/repositories/e/e_stripper.cc b/paludis/repositories/e/e_stripper.cc
index 23c24e5..ada0484 100644
--- a/paludis/repositories/e/e_stripper.cc
+++ b/paludis/repositories/e/e_stripper.cc
@@ -42,9 +42,10 @@ namespace paludis
EStripper::EStripper(const EStripperOptions & options) :
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())
+ value_for<n::image_dir>(options.image_dir()),
+ value_for<n::split>(options.split()),
+ value_for<n::strip>(options.strip())
)),
PrivateImplementationPattern<EStripper>(new Implementation<EStripper>(options)),
_imp(PrivateImplementationPattern<EStripper>::_imp)
diff --git a/paludis/repositories/e/e_stripper.hh b/paludis/repositories/e/e_stripper.hh
index 7bbd33c..c1dfb51 100644
--- a/paludis/repositories/e/e_stripper.hh
+++ b/paludis/repositories/e/e_stripper.hh
@@ -29,20 +29,22 @@ namespace paludis
{
namespace n
{
- struct debug_build;
struct debug_dir;
struct image_dir;
struct package_id;
+ struct split;
+ struct strip;
}
namespace erepository
{
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;
+ NamedValue<n::split, bool> split;
+ NamedValue<n::strip, bool> strip;
};
class EStripper :
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 37c89b0..f9e0fd7 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -71,6 +71,7 @@ namespace
std::tr1::shared_ptr<const EAPIEbuildEnvironmentVariables> make_ebuild_environment_variables(const KeyValueConfigFile & k)
{
return make_shared_ptr(new EAPIEbuildEnvironmentVariables(make_named_values<EAPIEbuildEnvironmentVariables>(
+ value_for<n::description_choices>(check_get(k, "description_choices")),
value_for<n::description_use>(check_get(k, "description_use")),
value_for<n::env_a>(check_get(k, "env_a")),
value_for<n::env_aa>(check_get(k, "env_aa")),
@@ -113,6 +114,7 @@ namespace
value_for<n::license>(make_metadata_variable(k, "license")),
value_for<n::long_description>(make_metadata_variable(k, "long_description")),
value_for<n::minimum_flat_list_size>(destringify_key<int>(k, "flat_list_minimum_size")),
+ value_for<n::myoptions>(make_metadata_variable(k, "myoptions")),
value_for<n::pdepend>(make_metadata_variable(k, "pdepend")),
value_for<n::properties>(make_metadata_variable(k, "properties")),
value_for<n::provide>(make_metadata_variable(k, "provide")),
@@ -125,7 +127,9 @@ namespace
value_for<n::upstream_changelog>(make_metadata_variable(k, "upstream_changelog")),
value_for<n::upstream_documentation>(make_metadata_variable(k, "upstream_documentation")),
value_for<n::upstream_release_notes>(make_metadata_variable(k, "upstream_release_notes")),
- value_for<n::use>(make_metadata_variable(k, "use"))
+ value_for<n::use>(make_metadata_variable(k, "use")),
+ value_for<n::use_expand>(make_metadata_variable(k, "use_expand")),
+ value_for<n::use_expand_hidden>(make_metadata_variable(k, "use_expand_hidden"))
)));
}
@@ -257,6 +261,8 @@ namespace
value_for<n::ebuild_metadata_variables>(make_ebuild_metadata_variables(k)),
value_for<n::ebuild_options>(make_ebuild_options(k)),
value_for<n::ebuild_phases>(make_ebuild_phases(k)),
+ value_for<n::has_optional_tests>(destringify_key<bool>(k, "has_optional_tests")),
+ value_for<n::has_recommended_tests>(destringify_key<bool>(k, "has_recommended_tests")),
value_for<n::iuse_flag_parse_options>(iuse_flag_parse_options),
value_for<n::merger_options>(merger_options),
value_for<n::package_dep_spec_parse_options>(package_dep_spec_parse_options),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 69052b2..8af5737 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -22,6 +22,7 @@
#include <paludis/repositories/e/eapi-fwd.hh>
#include <paludis/repositories/e/dep_parser-fwd.hh>
+#include <paludis/repositories/e/iuse.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/sr.hh>
#include <paludis/util/instantiation_policy.hh>
@@ -47,6 +48,7 @@ namespace paludis
struct dependency_labels;
struct dependency_spec_tree_parse_options;
struct description;
+ struct description_choices;
struct description_use;
struct directory_if_exists_variables;
struct directory_variables;
@@ -89,6 +91,8 @@ namespace paludis
struct f_function_prefix;
struct failure_is_fatal;
struct flat_list_index;
+ struct has_optional_tests;
+ struct has_recommended_tests;
struct homepage;
struct ignore_pivot_env_functions;
struct ignore_pivot_env_variables;
@@ -102,6 +106,7 @@ namespace paludis
struct merger_options;
struct metadata_key;
struct minimum_flat_list_size;
+ struct myoptions;
struct must_not_change_variables;
struct name;
struct no_slot_or_repo;
@@ -138,6 +143,8 @@ namespace paludis
struct upstream_release_notes;
struct uri_labels;
struct use;
+ struct use_expand;
+ struct use_expand_hidden;
struct use_expand_separator;
struct userpriv_cannot_use_root;
struct utility_path_suffixes;
@@ -220,6 +227,8 @@ namespace paludis
NamedValue<n::ebuild_metadata_variables, std::tr1::shared_ptr<const EAPIEbuildMetadataVariables> > ebuild_metadata_variables;
NamedValue<n::ebuild_options, std::tr1::shared_ptr<const EAPIEbuildOptions> > ebuild_options;
NamedValue<n::ebuild_phases, std::tr1::shared_ptr<const EAPIEbuildPhases> > ebuild_phases;
+ NamedValue<n::has_optional_tests, bool> has_optional_tests;
+ NamedValue<n::has_recommended_tests, bool> has_recommended_tests;
NamedValue<n::iuse_flag_parse_options, IUseFlagParseOptions> iuse_flag_parse_options;
NamedValue<n::merger_options, MergerOptions> merger_options;
NamedValue<n::package_dep_spec_parse_options, ELikePackageDepSpecOptions> package_dep_spec_parse_options;
@@ -231,6 +240,7 @@ namespace paludis
struct EAPIEbuildEnvironmentVariables
{
+ NamedValue<n::description_choices, std::string> description_choices;
NamedValue<n::description_use, std::string> description_use;
NamedValue<n::env_a, std::string> env_a;
NamedValue<n::env_aa, std::string> env_aa;
@@ -269,6 +279,7 @@ namespace paludis
NamedValue<n::license, EAPIMetadataVariable> license;
NamedValue<n::long_description, EAPIMetadataVariable> long_description;
NamedValue<n::minimum_flat_list_size, int> minimum_flat_list_size;
+ NamedValue<n::myoptions, EAPIMetadataVariable> myoptions;
NamedValue<n::pdepend, EAPIMetadataVariable> pdepend;
NamedValue<n::properties, EAPIMetadataVariable> properties;
NamedValue<n::provide, EAPIMetadataVariable> provide;
@@ -282,6 +293,8 @@ namespace paludis
NamedValue<n::upstream_documentation, EAPIMetadataVariable> upstream_documentation;
NamedValue<n::upstream_release_notes, EAPIMetadataVariable> upstream_release_notes;
NamedValue<n::use, EAPIMetadataVariable> use;
+ NamedValue<n::use_expand, EAPIMetadataVariable> use_expand;
+ NamedValue<n::use_expand_hidden, EAPIMetadataVariable> use_expand_hidden;
};
struct EAPIEbuildOptions
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 885cc38..6802b83 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -21,12 +21,14 @@ f_function_prefix = ebuild_f
ignore_pivot_env_functions =
ignore_pivot_env_variables =
userpriv_cannot_use_root = false
+has_optional_tests = true
+has_recommended_tests = false
vdb_from_env_variables = \
CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \
HOMEPAGE INHERITED IUSE KEYWORDS LICENSE PDEPEND PF \
PROVIDE RDEPEND SLOT SRC_URI USE CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT PKGMANAGER USE_EXPAND
+ VDB_FORMAT PKGMANAGER USE_EXPAND USE_EXPAND_HIDDEN
vdb_from_env_unless_empty_variables = \
ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
@@ -101,7 +103,7 @@ ebuild_install = \
userpriv sandbox : init saveenv ; \
: loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack compile saveenv ; \
- sandbox userpriv checkphase checks=always : loadenv test saveenv ; \
+ sandbox userpriv optional_tests : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
strip : ; \
prepost : loadenv preinst saveenv ; \
@@ -158,6 +160,9 @@ description_src_uri = Source URI
description_use =
description_dependencies =
description_properties = Properties
+description_choices = Use flags
+description_use_expand = USE expand flags
+description_use_expand_hidden = USE expand hidden flags
metadata_build_depend = DEPEND
metadata_short_description = DESCRIPTION
@@ -176,6 +181,8 @@ metadata_src_uri = SRC_URI
metadata_use =
metadata_dependencies =
metadata_properties = PROPERTIES
+metadata_use_expand = USE_EXPAND
+metadata_use_expand_hidden = USE_EXPAND_HIDDEN
flat_list_minimum_size = 16
flat_list_build_depend = 0
@@ -186,6 +193,7 @@ flat_list_dependencies = -1
flat_list_homepage = 5
flat_list_inherited = 9
flat_list_iuse = 10
+flat_list_myoptions = -1
flat_list_keywords = 8
flat_list_license = 6
flat_list_pdepend = 12
@@ -201,6 +209,8 @@ flat_list_upstream_changelog = -1
flat_list_upstream_release_notes = -1
flat_list_upstream_documentation = -1
flat_list_properties = 15
+flat_list_use_expand = -1
+flat_list_use_expand_hidden = -1
env_use = USE
env_use_expand = USE_EXPAND
diff --git a/paludis/repositories/e/eapis/2.conf b/paludis/repositories/e/eapis/2.conf
index 9aedde9..58927f6 100644
--- a/paludis/repositories/e/eapis/2.conf
+++ b/paludis/repositories/e/eapis/2.conf
@@ -16,7 +16,7 @@ ebuild_install = \
userpriv sandbox : init saveenv ; \
: loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack prepare configure compile saveenv ; \
- sandbox userpriv checkphase checks=always : loadenv test saveenv ; \
+ sandbox userpriv optional_tests : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
strip : ; \
prepost : loadenv preinst saveenv ; \
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 96fc3db..57aae5c 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -24,12 +24,14 @@ f_function_prefix = exheres_internal
ignore_pivot_env_functions =
ignore_pivot_env_variables =
userpriv_cannot_use_root = true
+has_optional_tests = false
+has_recommended_tests = true
vdb_from_env_variables = \
CATEGORY CHOST DEPENDENCIES SUMMARY EAPI \
HOMEPAGE INHERITED MYOPTIONS PLATFORMS LICENCES PNVR \
SLOT DOWNLOADS OPTIONS CONFIG_PROTECT CONFIG_PROTECT_MASK \
- VDB_FORMAT PKGMANAGER SUBOPTIONS
+ VDB_FORMAT PKGMANAGER SUBOPTIONS HIDDEN_SUBOPTIONS
vdb_from_env_unless_empty_variables = \
ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX CXXFLAGS \
@@ -63,11 +65,10 @@ eclass_must_not_set_variables = PLATFORMS
must_not_change_variables =
-source_merged_variables = \
- MYOPTIONS
+source_merged_variables =
bracket_merged_variables = \
- DEPENDENCIES
+ DEPENDENCIES MYOPTIONS
save_variables = \
OPTIONS SUBOPTIONS HIDDEN_SUBOPTIONS \$SUBOPTIONS
@@ -107,7 +108,7 @@ ebuild_install = \
userpriv sandbox : init saveenv ; \
sandbox : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack prepare configure compile saveenv ; \
- sandbox userpriv checkphase checks=default checks=always : loadenv test saveenv ; \
+ sandbox userpriv recommended_tests : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
strip : ; \
sandbox : loadenv preinst saveenv ; \
@@ -159,7 +160,8 @@ metadata_short_description = SUMMARY
metadata_long_description = DESCRIPTION
metadata_keywords = PLATFORMS
metadata_inherited = INHERITED
-metadata_iuse = MYOPTIONS
+metadata_iuse =
+metadata_myoptions = MYOPTIONS
metadata_pdepend =
metadata_provide =
metadata_eapi = EAPI
@@ -171,6 +173,8 @@ metadata_upstream_changelog = UPSTREAM_CHANGELOG
metadata_upstream_release_notes = UPSTREAM_RELEASE_NOTES
metadata_upstream_documentation = UPSTREAM_DOCUMENTATION
metadata_properties =
+metadata_use_expand = SUBOPTIONS
+metadata_use_expand_hidden = HIDDEN_SUBOPTIONS
description_build_depend =
description_short_description = Summary
@@ -178,7 +182,7 @@ description_long_description = Description
description_eapi = EAPI
description_homepage = Homepage
description_inherited = Inherited
-description_iuse = Relevant option flags
+description_myoptions = Relevant option flags
description_keywords = Supported platforms
description_license = Licences
description_pdepend =
@@ -195,6 +199,9 @@ description_upstream_changelog = Upstream changelog
description_upstream_release_notes = Upstream release notes
description_upstream_documentation = Upstream documentation
description_properties =
+description_choices = Options
+description_use_expand = Suboptions
+description_use_expand_hidden = Hidden suboptions
flat_list_minimum_size = -1
flat_list_build_depend = -1
@@ -205,6 +212,7 @@ flat_list_dependencies = -1
flat_list_homepage = -1
flat_list_inherited = -1
flat_list_iuse = -1
+flat_list_myoptions = -1
flat_list_keywords = -1
flat_list_license = -1
flat_list_pdepend = -1
@@ -220,6 +228,8 @@ flat_list_upstream_changelog = -1
flat_list_upstream_release_notes = -1
flat_list_upstream_documentation = -1
flat_list_properties = -1
+flat_list_use_expand = -1
+flat_list_use_expand_hidden = -1
env_use = OPTIONS
env_use_expand = SUBOPTIONS
diff --git a/paludis/repositories/e/eapis/kdebuild-1.conf b/paludis/repositories/e/eapis/kdebuild-1.conf
index fe4d0fe..62eff92 100644
--- a/paludis/repositories/e/eapis/kdebuild-1.conf
+++ b/paludis/repositories/e/eapis/kdebuild-1.conf
@@ -12,6 +12,8 @@ ebuild_module_suffixes = kdebuild-1 1 0
utility_path_suffixes = kdebuild-1 1 0
dependency_spec_tree_parse_options = uri_supports_arrow
breaks_portage = true
+has_optional_tests = false
+has_recommended_tests = true
bracket_merged_variables = DEPEND RDEPEND PDEPEND
source_merged_variables = IUSE KEYWORDS
@@ -28,7 +30,7 @@ ebuild_install = \
userpriv sandbox : init saveenv ; \
: loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack compile saveenv ; \
- sandbox userpriv checkphase checks=default checks=always : loadenv test saveenv ; \
+ sandbox userpriv recommended_tests : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
strip : ; \
prepost : loadenv preinst saveenv ; \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index ca698d0..0500901 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -24,6 +24,8 @@ f_function_prefix = ebuild_f
ignore_pivot_env_variables =
ignore_pivot_env_functions =
userpriv_cannot_use_root = false
+has_optional_tests = false
+has_recommended_tests = true
vdb_from_env_variables = \
CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \
@@ -105,7 +107,7 @@ ebuild_install = \
userpriv sandbox : init saveenv ; \
sandbox : loadenv setup saveenv ; \
sandbox userpriv : loadenv unpack compile saveenv ; \
- sandbox userpriv checkphase checks=default checks=always : loadenv test saveenv ; \
+ sandbox userpriv recommended_tests : loadenv test saveenv ; \
sandbox : loadenv install saveenv ; \
strip : ; \
sandbox : loadenv preinst saveenv ; \
@@ -163,6 +165,8 @@ metadata_eapi = EAPI
metadata_dependencies =
metadata_use =
metadata_properties =
+metadata_use_expand = USE_EXPAND
+metadata_use_expand_hidden = USE_EXPAND_HIDDEN
description_build_depend = Build dependencies
description_description = Description
@@ -181,6 +185,9 @@ description_src_uri = Source URI
description_use = Selected USE flags
description_dependencies =
description_properties =
+description_choices = Use flags
+description_use_expand = USE expand flags
+description_use_expand_hidden = USE expand hidden flags
flat_list_minimum_size = -1
flat_list_build_depend = -1
@@ -191,6 +198,7 @@ flat_list_dependencies = -1
flat_list_homepage = -1
flat_list_inherited = -1
flat_list_iuse = -1
+flat_list_myoptions = -1
flat_list_keywords = -1
flat_list_license = -1
flat_list_pdepend = -1
@@ -207,6 +215,8 @@ flat_list_upstream_changelog = -1
flat_list_upstream_release_notes = -1
flat_list_upstream_documentation = -1
flat_list_properties = -1
+flat_list_use_expand = -1
+flat_list_use_expand_hidden = -1
env_use = USE
env_use_expand = USE_EXPAND
diff --git a/paludis/repositories/e/eapis/pbin-1+0.conf b/paludis/repositories/e/eapis/pbin-1+0.conf
index a44727b..8fe380c 100644
--- a/paludis/repositories/e/eapis/pbin-1+0.conf
+++ b/paludis/repositories/e/eapis/pbin-1+0.conf
@@ -6,6 +6,8 @@ can_be_pbin = false
ebuild_module_suffixes = pbin-1 ${ebuild_module_suffixes}
support_eclasses = false
+has_optional_tests = false
+has_recommended_tests = false
non_empty_variables = \
P PV PR PN PVR PF CATEGORY build:FILESDIR build:PORTDIR \
diff --git a/paludis/repositories/e/eapis/pbin-1+1.conf b/paludis/repositories/e/eapis/pbin-1+1.conf
index d39e5ce..4315adf 100644
--- a/paludis/repositories/e/eapis/pbin-1+1.conf
+++ b/paludis/repositories/e/eapis/pbin-1+1.conf
@@ -6,6 +6,8 @@ can_be_pbin = false
ebuild_module_suffixes = pbin-1 ${ebuild_module_suffixes}
support_eclasses = false
+has_optional_tests = false
+has_recommended_tests = false
non_empty_variables = \
P PV PR PN PVR PF CATEGORY build:FILESDIR build:PORTDIR \
diff --git a/paludis/repositories/e/eapis/pbin-1+exheres-0.conf b/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
index 1610463..e7074c1 100644
--- a/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
+++ b/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
@@ -7,6 +7,8 @@ can_be_pbin = false
ebuild_module_suffixes = pbin-1 ${ebuild_module_suffixes}
support_exlibs = false
+has_optional_tests = false
+has_recommended_tests = false
non_empty_variables = \
PNV PV PR PN PVR PNVR CATEGORY build:FILES build:FETCHEDDIR build:REPODIR \
diff --git a/paludis/repositories/e/eapis/pbin-1+paludis-1.conf b/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
index e96dfad..ca8937a 100644
--- a/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
+++ b/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
@@ -7,6 +7,8 @@ can_be_pbin = false
ebuild_module_suffixes = pbin-1 ${ebuild_module_suffixes}
support_eclasses = false
+has_optional_tests = false
+has_recommended_tests = false
non_empty_variables = \
P PV PR PN PVR PF CATEGORY build:FILESDIR build:PORTDIR \
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index c704ec7..c1f155e 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -502,6 +502,9 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.iuse().name().empty())
id->load_iuse(m.iuse().name(), m.iuse().description(), get(keys, m.iuse().name()));
+ if (! m.myoptions().name().empty())
+ id->load_myoptions(m.myoptions().name(), m.myoptions().description(), get(keys, m.myoptions().name()));
+
if (! m.inherited().name().empty())
id->load_inherited(m.inherited().name(), m.inherited().description(), get(keys, m.inherited().name()));
@@ -628,6 +631,9 @@ EbuildNoFetchCommand::extend_command(const Command & cmd)
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());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden(),
+ fetch_params.use_expand_hidden());
for (Map<std::string, std::string>::ConstIterator
i(fetch_params.expand_vars()->begin()),
@@ -683,6 +689,9 @@ EbuildInstallCommand::extend_command(const Command & cmd)
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());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden(),
+ install_params.use_expand_hidden());
for (Map<std::string, std::string>::ConstIterator
i(install_params.expand_vars()->begin()),
@@ -884,6 +893,9 @@ EbuildPretendCommand::extend_command(const Command & cmd)
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());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden(),
+ pretend_params.use_expand_hidden());
for (Map<std::string, std::string>::ConstIterator
i(pretend_params.expand_vars()->begin()),
@@ -946,6 +958,9 @@ EbuildInfoCommand::extend_command(const Command & cmd)
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());
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden().empty())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden(),
+ info_params.use_expand_hidden());
for (Map<std::string, std::string>::ConstIterator
i(info_params.expand_vars()->begin()),
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 160495d..ec0543d 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -77,6 +77,7 @@ namespace paludis
struct use;
struct use_ebuild_file;
struct use_expand;
+ struct use_expand_hidden;
struct userpriv;
}
@@ -125,6 +126,7 @@ namespace paludis
NamedValue<n::root, std::string> root;
NamedValue<n::use, std::string> use;
NamedValue<n::use_expand, std::string> use_expand;
+ NamedValue<n::use_expand_hidden, std::string> use_expand_hidden;
};
/**
@@ -147,6 +149,7 @@ namespace paludis
NamedValue<n::slot, SlotName> slot;
NamedValue<n::use, std::string> use;
NamedValue<n::use_expand, std::string> use_expand;
+ NamedValue<n::use_expand_hidden, std::string> use_expand_hidden;
};
/**
@@ -163,6 +166,7 @@ namespace paludis
NamedValue<n::root, std::string> root;
NamedValue<n::use, std::string> use;
NamedValue<n::use_expand, std::string> use_expand;
+ NamedValue<n::use_expand_hidden, std::string> use_expand_hidden;
};
/**
@@ -210,6 +214,7 @@ namespace paludis
NamedValue<n::use, std::string> use;
NamedValue<n::use_ebuild_file, bool> use_ebuild_file;
NamedValue<n::use_expand, std::string> use_expand;
+ NamedValue<n::use_expand_hidden, std::string> use_expand_hidden;
};
/**
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 0f5b427..543f168 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -36,6 +36,8 @@
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/choice.hh>
+#include <paludis/elike_choices.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
#include <paludis/util/strip.hh>
@@ -224,7 +226,7 @@ namespace
namespace
{
- std::string make_use(const Environment * const env,
+ std::string make_use(const Environment * const,
const ERepositoryID & id,
std::tr1::shared_ptr<const ERepositoryProfile> profile)
{
@@ -237,11 +239,21 @@ namespace
std::string use;
- if (id.iuse_key())
- for (IUseFlagSet::ConstIterator i(id.iuse_key()->value()->begin()),
- i_end(id.iuse_key()->value()->end()) ; i != i_end ; ++i)
- if (env->query_use(i->flag, id))
- use += stringify(i->flag) + " ";
+ if (id.choices_key())
+ {
+ for (Choices::ConstIterator k(id.choices_key()->value()->begin()),
+ k_end(id.choices_key()->value()->end()) ;
+ k != k_end ; ++k)
+ {
+ if ((*k)->prefix() == canonical_build_options_prefix())
+ continue;
+
+ for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
+ i != i_end ; ++i)
+ if ((*i)->enabled())
+ use += stringify((*i)->name_with_prefix()) + " ";
+ }
+ }
if (! id.eapi()->supported()->ebuild_environment_variables()->env_arch().empty())
use += profile->environment_variable(id.eapi()->supported()->ebuild_environment_variables()->env_arch()) + " ";
@@ -250,11 +262,9 @@ namespace
}
std::tr1::shared_ptr<Map<std::string, std::string> >
- make_expand(const Environment * const env,
+ make_expand(const Environment * const,
const ERepositoryID & e,
- std::tr1::shared_ptr<const ERepositoryProfile> profile,
- std::string & use,
- const std::string & expand_sep)
+ std::tr1::shared_ptr<const ERepositoryProfile> profile)
{
std::tr1::shared_ptr<Map<std::string, std::string> > expand_vars(
new Map<std::string, std::string>);
@@ -266,52 +276,36 @@ namespace
return expand_vars;
}
- for (ERepositoryProfile::UseExpandConstIterator x(profile->begin_use_expand()),
- x_end(profile->end_use_expand()) ; x != x_end ; ++x)
- {
- std::string lower_x;
- std::transform(x->data().begin(), x->data().end(), std::back_inserter(lower_x), &::tolower);
+ if (! e.choices_key())
+ return expand_vars;
+ for (Set<std::string>::ConstIterator x(profile->use_expand()->begin()), x_end(profile->use_expand()->end()) ;
+ x != x_end ; ++x)
+ {
expand_vars->insert(stringify(*x), "");
- /* possible values from profile */
- std::set<UseFlagName> possible_values;
- tokenise_whitespace(profile->environment_variable(stringify(*x)),
- create_inserter<UseFlagName>(std::inserter(possible_values, possible_values.end())));
-
- /* possible values from environment */
- std::tr1::shared_ptr<const UseFlagNameSet> possible_values_from_env(
- env->known_use_expand_names(*x, e));
- for (UseFlagNameSet::ConstIterator i(possible_values_from_env->begin()),
- i_end(possible_values_from_env->end()) ; i != i_end ; ++i)
- possible_values.insert(UseFlagName(stringify(*i).substr(lower_x.length() + 1)));
-
- for (std::set<UseFlagName>::const_iterator u(possible_values.begin()), u_end(possible_values.end()) ;
- u != u_end ; ++u)
- {
- if (e.eapi()->supported()->ebuild_options()->require_use_expand_in_iuse())
- if (e.iuse_key() && e.iuse_key()->value()->end() == e.iuse_key()->value()->find(
- IUseFlag(*u, use_unspecified, std::string::npos)))
- continue;
+ Choices::ConstIterator k(std::find_if(e.choices_key()->value()->begin(), e.choices_key()->value()->end(),
+ std::tr1::bind(std::equal_to<std::string>(), *x,
+ std::tr1::bind(std::tr1::mem_fn(&Choice::raw_name), std::tr1::placeholders::_1))));
+ if (k == e.choices_key()->value()->end())
+ continue;
- if (! env->query_use(UseFlagName(lower_x + expand_sep + stringify(*u)), e))
- continue;
-
- if (! e.eapi()->supported()->ebuild_options()->require_use_expand_in_iuse())
- use.append(lower_x + expand_sep + stringify(*u) + " ");
-
- std::string value;
- Map<std::string, std::string>::ConstIterator i(expand_vars->find(stringify(*x)));
- if (expand_vars->end() != i)
+ for (Choice::ConstIterator i((*k)->begin()), i_end((*k)->end()) ;
+ i != i_end ; ++i)
+ if ((*i)->enabled())
{
- value = i->second;
- if (! value.empty())
- value.append(" ");
- expand_vars->erase(i);
+ std::string value;
+ Map<std::string, std::string>::ConstIterator v(expand_vars->find(stringify(*x)));
+ if (expand_vars->end() != v)
+ {
+ value = v->second;
+ if (! value.empty())
+ value.append(" ");
+ expand_vars->erase(v);
+ }
+ value.append(stringify((*i)->unprefixed_name()));
+ expand_vars->insert(stringify(*x), value);
}
- value.append(stringify(*u));
- expand_vars->insert(stringify(*x), value);
- }
}
return expand_vars;
@@ -455,9 +449,8 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
check_userpriv(FSEntry(_imp->params.builddir), _imp->environment,
id->eapi()->supported()->userpriv_cannot_use_root()));
std::string use(make_use(_imp->params.environment, *id, p));
- std::string expand_sep(stringify(id->eapi()->supported()->ebuild_options()->use_expand_separator()));
std::tr1::shared_ptr<Map<std::string, std::string> > expand_vars(make_expand(
- _imp->params.environment, *id, p, use, expand_sep));
+ _imp->params.environment, *id, p));
std::tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
@@ -491,7 +484,8 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
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(), " "))
+ value_for<n::use_expand>(join(p->use_expand()->begin(), p->use_expand()->end(), " ")),
+ value_for<n::use_expand_hidden>(join(p->use_expand_hidden()->begin(), p->use_expand_hidden()->end(), " "))
));
if (! nofetch_cmd())
@@ -607,9 +601,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
/* add expand to use (iuse isn't reliable for use_expand things), and make the expand
* environment variables */
- std::string expand_sep(stringify(id->eapi()->supported()->ebuild_options()->use_expand_separator()));
std::tr1::shared_ptr<Map<std::string, std::string> > expand_vars(make_expand(
- _imp->params.environment, *id, p, use, expand_sep));
+ _imp->params.environment, *id, p));
std::tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
@@ -655,13 +648,19 @@ 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";
+ std::tr1::shared_ptr<const ChoiceValue> strip_choice(id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeStripChoiceValue::canonical_name_with_prefix()));
+ std::tr1::shared_ptr<const ChoiceValue> split_choice(id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeSplitChoiceValue::canonical_name_with_prefix()));
+
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)
+ value_for<n::package_id>(id),
+ value_for<n::split>(split_choice && split_choice->enabled()),
+ value_for<n::strip>(strip_choice && strip_choice->enabled())
));
stripper.strip();
}
@@ -670,31 +669,19 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
((*o.destination()).destination_interface() &&
(*o.destination()).destination_interface()->want_pre_post_phases()))
{
- if (phase->option("checkphase"))
+ if (phase->option("optional_tests"))
{
- if (test_restrict)
+ std::tr1::shared_ptr<const ChoiceValue> choice(id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeOptionalTestsChoiceValue::canonical_name_with_prefix()));
+ if (choice && ! choice->enabled())
+ continue;
+ }
+ else if (phase->option("recommended_tests"))
+ {
+ std::tr1::shared_ptr<const ChoiceValue> choice(id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeRecommendedTestsChoiceValue::canonical_name_with_prefix()));
+ if (choice && ! choice->enabled())
continue;
-
- switch (o.checks())
- {
- case iaco_none:
- if (! phase->option("checks=none"))
- continue;
- break;
-
- case iaco_default:
- if (! phase->option("checks=default"))
- continue;
- break;
-
- case iaco_always:
- if (! phase->option("checks=always"))
- continue;
- break;
-
- case last_iaco:
- break;
- }
}
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
@@ -727,7 +714,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
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(), " "))
+ value_for<n::use_expand>(join(p->use_expand()->begin(), p->use_expand()->end(), " ")),
+ value_for<n::use_expand_hidden>(join(p->use_expand_hidden()->begin(), p->use_expand_hidden()->end(), " "))
));
EbuildInstallCommand cmd(command_params, install_params);
@@ -764,9 +752,8 @@ EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
/* add expand to use (iuse isn't reliable for use_expand things), and make the expand
* environment variables */
- std::string expand_sep(stringify(id->eapi()->supported()->ebuild_options()->use_expand_separator()));
std::tr1::shared_ptr<Map<std::string, std::string> > expand_vars(make_expand(
- _imp->params.environment, *id, p, use, expand_sep));
+ _imp->params.environment, *id, p));
std::tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
@@ -805,7 +792,8 @@ EbuildEntries::info(const std::tr1::shared_ptr<const ERepositoryID> & id,
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(), " "))
+ value_for<n::use_expand>(join(p->use_expand()->begin(), p->use_expand()->end(), " ")),
+ value_for<n::use_expand_hidden>(join(p->use_expand_hidden()->begin(), p->use_expand_hidden()->end(), " "))
));
EbuildInfoCommand cmd(command_params, info_params);
@@ -963,9 +951,8 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
check_userpriv(FSEntry(_imp->params.builddir), _imp->environment, id->eapi()->supported()->userpriv_cannot_use_root()));
std::string use(make_use(_imp->params.environment, *id, p));
- std::string expand_sep(stringify(id->eapi()->supported()->ebuild_options()->use_expand_separator()));
std::tr1::shared_ptr<Map<std::string, std::string> > expand_vars(make_expand(
- _imp->params.environment, *id, p, use, expand_sep));
+ _imp->params.environment, *id, p));
std::tr1::shared_ptr<const FSEntrySequence> exlibsdirs(_imp->e_repository->layout()->exlibsdirs(id->name()));
@@ -997,7 +984,8 @@ EbuildEntries::pretend(const std::tr1::shared_ptr<const ERepositoryID> & id,
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(), " "))
+ value_for<n::use_expand>(join(p->use_expand()->begin(), p->use_expand()->end(), " ")),
+ value_for<n::use_expand_hidden>(join(p->use_expand_hidden()->begin(), p->use_expand_hidden()->end(), " "))
));
if (! pretend_cmd())
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index d90872c..854df12 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -214,6 +214,9 @@ namespace
if (-1 != m.iuse().flat_list_index() && ! m.iuse().name().empty())
id->load_iuse(m.iuse().name(), m.iuse().description(), lines.at(m.iuse().flat_list_index()));
+ if (-1 != m.myoptions().flat_list_index() && ! m.myoptions().name().empty())
+ id->load_myoptions(m.iuse().name(), m.myoptions().description(), lines.at(m.myoptions().flat_list_index()));
+
if (-1 != m.pdepend().flat_list_index() && ! m.pdepend().name().empty())
id->load_post_depend(m.pdepend().name(), m.pdepend().description(), lines.at(m.pdepend().flat_list_index()));
@@ -535,6 +538,9 @@ EbuildFlatMetadataCache::load(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.iuse().name().empty())
id->load_iuse(m.iuse().name(), m.iuse().description(), keys[m.iuse().name()]);
+ if (! m.myoptions().name().empty())
+ id->load_myoptions(m.myoptions().name(), m.myoptions().description(), keys[m.myoptions().name()]);
+
if (! m.pdepend().name().empty())
id->load_post_depend(m.pdepend().name(), m.pdepend().description(), keys[m.pdepend().name()]);
@@ -713,8 +719,8 @@ EbuildFlatMetadataCache::save(const std::tr1::shared_ptr<const EbuildID> & id)
write_kv(cache, m.dependencies().name(), s);
}
- if (! m.use().name().empty() && id->use_key())
- write_kv(cache, m.use().name(), join(id->use_key()->value()->begin(), id->use_key()->value()->end(), " "));
+ if (! m.use().name().empty() && id->raw_use_key())
+ write_kv(cache, m.use().name(), join(id->raw_use_key()->value()->begin(), id->raw_use_key()->value()->end(), " "));
if (! m.build_depend().name().empty() && id->build_dependencies_key())
write_kv(cache, m.build_depend().name(), flatten(id->build_dependencies_key()->value()));
@@ -745,8 +751,11 @@ EbuildFlatMetadataCache::save(const std::tr1::shared_ptr<const EbuildID> & id)
if (! m.keywords().name().empty() && id->keywords_key())
write_kv(cache, m.keywords().name(), join(id->keywords_key()->value()->begin(), id->keywords_key()->value()->end(), " "));
- if (! m.iuse().name().empty() && id->iuse_key())
- write_kv(cache, m.iuse().name(), join(id->iuse_key()->value()->begin(), id->iuse_key()->value()->end(), " "));
+ if (! m.iuse().name().empty() && id->raw_iuse_key())
+ write_kv(cache, m.iuse().name(), join(id->raw_iuse_key()->value()->begin(), id->raw_iuse_key()->value()->end(), " "));
+
+ if (! m.myoptions().name().empty() && id->raw_myoptions_key())
+ write_kv(cache, m.myoptions().name(), flatten(id->raw_myoptions_key()->value()));
if (! m.pdepend().name().empty() && id->post_dependencies_key())
write_kv(cache, m.pdepend().name(), flatten(id->post_dependencies_key()->value()));
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 4448c2f..89d1c32 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -27,6 +27,7 @@
#include <paludis/repositories/e/e_mask.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/manifest2_reader.hh>
+#include <paludis/repositories/e/e_choice_value.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -35,6 +36,7 @@
#include <paludis/environment.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/elike_choices.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/stringify.hh>
@@ -45,6 +47,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/save.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/tribool.hh>
#include <iterator>
#include <fstream>
@@ -86,9 +89,12 @@ namespace paludis
mutable std::tr1::shared_ptr<const ESimpleURIKey> homepage;
mutable std::tr1::shared_ptr<const ELicenseKey> license;
mutable std::tr1::shared_ptr<const EKeywordsKey> keywords;
- mutable std::tr1::shared_ptr<const EIUseKey> iuse;
- mutable std::tr1::shared_ptr<const EInheritedKey> inherited;
- mutable std::tr1::shared_ptr<const EUseKey> use;
+ mutable std::tr1::shared_ptr<const EStringSetKey> raw_iuse;
+ mutable std::tr1::shared_ptr<const EMyOptionsKey> raw_myoptions;
+ mutable std::tr1::shared_ptr<const EStringSetKey> inherited;
+ mutable std::tr1::shared_ptr<const EStringSetKey> raw_use;
+ mutable std::tr1::shared_ptr<const LiteralMetadataStringSetKey> raw_use_expand;
+ mutable std::tr1::shared_ptr<const LiteralMetadataStringSetKey> raw_use_expand_hidden;
mutable std::tr1::shared_ptr<EMutableRepositoryMaskInfoKey> repository_mask;
mutable std::tr1::shared_ptr<EMutableRepositoryMaskInfoKey> profile_mask;
mutable std::tr1::shared_ptr<const EPlainTextSpecKey> remote_ids;
@@ -96,6 +102,7 @@ namespace paludis
mutable std::tr1::shared_ptr<const ESimpleURIKey> upstream_changelog;
mutable std::tr1::shared_ptr<const ESimpleURIKey> upstream_documentation;
mutable std::tr1::shared_ptr<const ESimpleURIKey> upstream_release_notes;
+ mutable std::tr1::shared_ptr<const EChoicesKey> choices;
std::tr1::shared_ptr<DependencyLabelSequence> build_dependencies_labels;
std::tr1::shared_ptr<DependencyLabelSequence> run_dependencies_labels;
@@ -272,6 +279,29 @@ EbuildID::need_keys_added() const
_imp->profile_mask = make_shared_ptr(new EMutableRepositoryMaskInfoKey(shared_from_this(), "profile_mask", "Profile masked",
std::tr1::static_pointer_cast<const ERepository>(repository())->profile()->profile_masked(*this), mkt_internal));
add_metadata_key(_imp->profile_mask);
+
+ if (_imp->eapi->supported())
+ {
+ _imp->raw_use_expand = make_shared_ptr(new LiteralMetadataStringSetKey(
+ _imp->eapi->supported()->ebuild_metadata_variables()->use_expand().name(),
+ _imp->eapi->supported()->ebuild_metadata_variables()->use_expand().description(),
+ mkt_internal,
+ std::tr1::static_pointer_cast<const ERepository>(repository())->profile()->use_expand()));
+ _imp->raw_use_expand_hidden = make_shared_ptr(new LiteralMetadataStringSetKey(
+ _imp->eapi->supported()->ebuild_metadata_variables()->use_expand_hidden().name(),
+ _imp->eapi->supported()->ebuild_metadata_variables()->use_expand_hidden().description(),
+ mkt_internal,
+ std::tr1::static_pointer_cast<const ERepository>(repository())->profile()->use_expand_hidden()));
+ }
+
+ if (_imp->eapi->supported())
+ _imp->choices.reset(new EChoicesKey(_imp->environment, shared_from_this(), "PALUDIS_CHOICES",
+ _imp->eapi->supported()->ebuild_environment_variables()->description_choices(),
+ mkt_normal, std::tr1::static_pointer_cast<const ERepository>(repository())));
+ else
+ _imp->choices.reset(new EChoicesKey(_imp->environment, shared_from_this(), "PALUDIS_CHOICES", "Choices", mkt_normal,
+ std::tr1::static_pointer_cast<const ERepository>(repository())));
+ add_metadata_key(_imp->choices);
}
namespace
@@ -492,18 +522,39 @@ EbuildID::keywords_key() const
return _imp->keywords;
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-EbuildID::iuse_key() const
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EbuildID::raw_iuse_key() const
+{
+ need_keys_added();
+ return _imp->raw_iuse;
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> >
+EbuildID::raw_myoptions_key() const
+{
+ need_keys_added();
+ return _imp->raw_myoptions;
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EbuildID::raw_use_key() const
+{
+ need_keys_added();
+ return _imp->raw_use;
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EbuildID::raw_use_expand_key() const
{
need_keys_added();
- return _imp->iuse;
+ return _imp->raw_use_expand;
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> >
-EbuildID::use_key() const
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+EbuildID::raw_use_expand_hidden_key() const
{
need_keys_added();
- return _imp->use;
+ return _imp->raw_use_expand_hidden;
}
const std::tr1::shared_ptr<const MetadataValueKey<bool> >
@@ -769,16 +820,24 @@ void
EbuildID::load_iuse(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->iuse.reset(new EIUseKey(_imp->environment, shared_from_this(), r, h, v, mkt_normal));
- add_metadata_key(_imp->iuse);
+ _imp->raw_iuse.reset(new EStringSetKey(shared_from_this(), r, h, v, mkt_internal));
+ add_metadata_key(_imp->raw_iuse);
+}
+
+void
+EbuildID::load_myoptions(const std::string & r, const std::string & h, const std::string & v) const
+{
+ Lock l(_imp->mutex);
+ _imp->raw_myoptions.reset(new EMyOptionsKey(_imp->environment, shared_from_this(), r, h, v, mkt_internal));
+ add_metadata_key(_imp->raw_myoptions);
}
void
EbuildID::load_use(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->use.reset(new EUseKey(_imp->environment, shared_from_this(), r, h, v, mkt_internal));
- add_metadata_key(_imp->use);
+ _imp->raw_use.reset(new EStringSetKey(shared_from_this(), r, h, v, mkt_internal));
+ add_metadata_key(_imp->raw_use);
}
void
@@ -793,7 +852,7 @@ void
EbuildID::load_inherited(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
- _imp->inherited.reset(new EInheritedKey(shared_from_this(), r, h, v, mkt_internal));
+ _imp->inherited.reset(new EStringSetKey(shared_from_this(), r, h, v, mkt_internal));
add_metadata_key(_imp->inherited);
}
@@ -1026,3 +1085,97 @@ EbuildID::upstream_release_notes_key() const
return _imp->upstream_release_notes;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+EbuildID::choices_key() const
+{
+ need_keys_added();
+ return _imp->choices;
+}
+
+std::tr1::shared_ptr<ChoiceValue>
+EbuildID::make_choice_value(
+ const std::tr1::shared_ptr<const Choice> & choice,
+ const UnprefixedChoiceName & value_name,
+ const Tribool iuse_default,
+ const bool explicitly_listed
+ ) const
+{
+ if (! eapi()->supported())
+ throw InternalError(PALUDIS_HERE, "Unsupported EAPI");
+
+ std::string name_with_prefix_s;
+ if (stringify(choice->prefix()).empty())
+ name_with_prefix_s = stringify(value_name);
+ else
+ {
+ char use_expand_separator(eapi()->supported()->ebuild_options()->use_expand_separator());
+ if (! use_expand_separator)
+ throw InternalError(PALUDIS_HERE, "No use_expand_separator defined");
+ name_with_prefix_s = stringify(choice->prefix()) + std::string(1, use_expand_separator) + stringify(value_name);
+ }
+ ChoiceNameWithPrefix name_with_prefix(name_with_prefix_s);
+
+ bool locked(false), enabled(false);
+ if (raw_use_key())
+ {
+ locked = true;
+ enabled = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix_s));
+ }
+ else
+ {
+ if (_imp->repository->profile()->use_masked(shared_from_this(), choice, value_name, name_with_prefix))
+ {
+ locked = true;
+ enabled = false;
+ }
+ else if (_imp->repository->profile()->use_forced(shared_from_this(), choice, value_name, name_with_prefix))
+ {
+ locked = true;
+ enabled = true;
+ }
+ else
+ {
+ Tribool env_want(_imp->environment->want_choice_enabled(shared_from_this(), choice, value_name));
+ if (env_want.is_true())
+ enabled = true;
+ else if (env_want.is_false())
+ enabled = false;
+ else
+ {
+ Tribool profile_want(_imp->repository->profile()->use_state_ignoring_masks(shared_from_this(), choice, value_name, name_with_prefix));
+ if (profile_want.is_true())
+ enabled = true;
+ else if (profile_want.is_false())
+ enabled = false;
+ else if (iuse_default.is_true())
+ enabled = true;
+ else if (iuse_default.is_false())
+ enabled = false;
+ else
+ enabled = false;
+ }
+ }
+ }
+
+ return make_shared_ptr(new EChoiceValue(choice->prefix(), value_name, ChoiceNameWithPrefix(name_with_prefix), name(),
+ _imp->repository->use_desc(),
+ enabled, locked, explicitly_listed));
+}
+
+void
+EbuildID::add_build_options(const std::tr1::shared_ptr<Choices> & choices) const
+{
+ if (eapi()->supported())
+ {
+ std::tr1::shared_ptr<Choice> build_options(new Choice(canonical_build_options_raw_name(), canonical_build_options_human_name(),
+ canonical_build_options_prefix(), false, false, false, false));
+ choices->add(build_options);
+ if (eapi()->supported()->has_optional_tests())
+ build_options->add(make_shared_ptr(new ELikeOptionalTestsChoiceValue(shared_from_this(), _imp->environment, build_options)));
+ if (eapi()->supported()->has_recommended_tests())
+ build_options->add(make_shared_ptr(new ELikeRecommendedTestsChoiceValue(shared_from_this(), _imp->environment, build_options)));
+ build_options->add(make_shared_ptr(new ELikeSplitChoiceValue(shared_from_this(), _imp->environment, build_options)));
+ build_options->add(make_shared_ptr(new ELikeStripChoiceValue(shared_from_this(), _imp->environment, build_options)));
+ }
+}
+
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index fd9964f..6f83570 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -65,7 +65,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
@@ -80,13 +79,19 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > contained_in_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > inherited_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > restrict_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > properties_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<UseFlagNameSet> > use_key() const;
+
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_iuse_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<PlainTextSpecTree> > raw_myoptions_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > raw_use_expand_hidden_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
@@ -117,6 +122,7 @@ namespace paludis
void load_license(const std::string &, const std::string &, const std::string &) const;
void load_provide(const std::string &, const std::string &, const std::string &) const;
void load_iuse(const std::string &, const std::string &, const std::string &) const;
+ void load_myoptions(const std::string &, const std::string &, const std::string &) const;
void load_use(const std::string &, const std::string &, const std::string &) const;
void load_inherited(const std::string &, const std::string &, const std::string &) const;
void load_keywords(const std::string &, const std::string &, const std::string &) const;
@@ -135,6 +141,12 @@ namespace paludis
virtual const std::tr1::shared_ptr<const EAPI> eapi() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void invalidate_masks() const;
+
+ virtual std::tr1::shared_ptr<ChoiceValue> make_choice_value(
+ const std::tr1::shared_ptr<const Choice> &, const UnprefixedChoiceName &, const Tribool,
+ const bool) const;
+
+ virtual void add_build_options(const std::tr1::shared_ptr<Choices> &) const;
};
}
}
diff --git a/paludis/repositories/e/exheres_layout.cc b/paludis/repositories/e/exheres_layout.cc
index 9cbe39b..d1cb720 100644
--- a/paludis/repositories/e/exheres_layout.cc
+++ b/paludis/repositories/e/exheres_layout.cc
@@ -40,6 +40,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
#include <functional>
@@ -126,9 +127,9 @@ ExheresLayout::ExheresLayout(const ERepository * const r, const FSEntry & tree_r
std::string p(strip_trailing_string(strip_trailing_string(d->basename(), ".conf"), ".local"));
if (p == "options")
- _imp->use_desc_files->push_back(std::make_pair(*d, ""));
+ _imp->use_desc_files->push_back(std::make_pair(*d, ChoicePrefixName("")));
else
- _imp->use_desc_files->push_back(std::make_pair(*d, p));
+ _imp->use_desc_files->push_back(std::make_pair(*d, ChoicePrefixName(p)));
}
}
}
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index d2f4054..4e71eb0 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -109,7 +109,6 @@ ExndbamRepository::ExndbamRepository(const RepositoryName & n, const ExndbamRepo
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)),
diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc
index 37d7af9..a33845f 100644
--- a/paludis/repositories/e/exndbam_repository_TEST.cc
+++ b/paludis/repositories/e/exndbam_repository_TEST.cc
@@ -116,8 +116,6 @@ namespace test_cases
env.package_database()->add_repository(0, exndbam_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>(exndbam_repo),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
diff --git a/paludis/repositories/e/glsa.cc b/paludis/repositories/e/glsa.cc
index 7327eea..66dec5c 100644
--- a/paludis/repositories/e/glsa.cc
+++ b/paludis/repositories/e/glsa.cc
@@ -33,7 +33,7 @@
using namespace paludis;
-template class WrappedForwardIterator<GLSAPackage::ArchsConstIteratorTag, const UseFlagName>;
+template class WrappedForwardIterator<GLSAPackage::ArchsConstIteratorTag, const std::string>;
template class WrappedForwardIterator<GLSAPackage::RangesConstIteratorTag, const GLSARange>;
template class WrappedForwardIterator<GLSA::PackagesConstIteratorTag, const GLSAPackage>;
@@ -49,7 +49,7 @@ namespace paludis
struct Implementation<GLSAPackage>
{
QualifiedPackageName name;
- std::list<UseFlagName> archs;
+ std::list<std::string> archs;
std::list<GLSARange> unaffected;
std::list<GLSARange> vulnerable;
@@ -90,7 +90,7 @@ GLSAPackage::end_archs() const
}
void
-GLSAPackage::add_arch(const UseFlagName & n)
+GLSAPackage::add_arch(const std::string & n)
{
_imp->archs.push_back(n);
}
diff --git a/paludis/repositories/e/glsa.hh b/paludis/repositories/e/glsa.hh
index 5a58f49..14b162c 100644
--- a/paludis/repositories/e/glsa.hh
+++ b/paludis/repositories/e/glsa.hh
@@ -75,7 +75,7 @@ namespace paludis
///\{
struct ArchsConstIteratorTag;
- typedef WrappedForwardIterator<ArchsConstIteratorTag, const UseFlagName> ArchsConstIterator;
+ typedef WrappedForwardIterator<ArchsConstIteratorTag, const std::string> ArchsConstIterator;
ArchsConstIterator begin_archs() const;
ArchsConstIterator end_archs() const;
@@ -84,7 +84,7 @@ namespace paludis
/**
* Add an arch.
*/
- void add_arch(const UseFlagName &);
+ void add_arch(const std::string &);
///\name Iterate over our ranges.
///\{
diff --git a/paludis/repositories/e/iuse.cc b/paludis/repositories/e/iuse.cc
new file mode 100644
index 0000000..7e6f5b1
--- /dev/null
+++ b/paludis/repositories/e/iuse.cc
@@ -0,0 +1,46 @@
+/* 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
+ */
+
+#include <paludis/repositories/e/iuse.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/tribool.hh>
+#include <paludis/util/validated.hh>
+#include <paludis/choice.hh>
+#include <istream>
+#include <ostream>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+#include <paludis/repositories/e/iuse-se.cc>
+
+std::pair<ChoiceNameWithPrefix, Tribool>
+paludis::erepository::parse_iuse(const std::tr1::shared_ptr<const EAPI> &, const std::string & s)
+{
+ if (s.empty())
+ return std::make_pair(ChoiceNameWithPrefix(s), indeterminate);
+
+ if ('-' == s.at(0))
+ return std::make_pair(ChoiceNameWithPrefix(s.substr(1)), false);
+ if ('+' == s.at(0))
+ return std::make_pair(ChoiceNameWithPrefix(s.substr(1)), true);
+ return std::make_pair(ChoiceNameWithPrefix(s), indeterminate);
+}
diff --git a/paludis/repositories/e/iuse.hh b/paludis/repositories/e/iuse.hh
new file mode 100644
index 0000000..5ad29e8
--- /dev/null
+++ b/paludis/repositories/e/iuse.hh
@@ -0,0 +1,45 @@
+/* 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_REPOSITORIES_E_IUSE_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_IUSE_HH 1
+
+#include <paludis/util/options-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/tribool-fwd.hh>
+#include <paludis/repositories/e/eapi-fwd.hh>
+#include <paludis/choice-fwd.hh>
+#include <tr1/memory>
+#include <string>
+#include <iosfwd>
+
+namespace paludis
+{
+ namespace erepository
+ {
+#include <paludis/repositories/e/iuse-se.hh>
+
+ typedef Options<IUseFlagParseOption> IUseFlagParseOptions;
+
+ std::pair<ChoiceNameWithPrefix, Tribool> parse_iuse(const std::tr1::shared_ptr<const EAPI> &, const std::string &)
+ PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+ }
+}
+
+#endif
diff --git a/paludis/name.se b/paludis/repositories/e/iuse.se
index 32f177e..fa0dc44 100644
--- a/paludis/name.se
+++ b/paludis/repositories/e/iuse.se
@@ -1,27 +1,11 @@
#!/usr/bin/env bash
# vim: set sw=4 sts=4 et ft=sh :
-make_enum_UseFlagState()
-{
- prefix use
-
- key use_unspecified "unspecified"
- key use_disabled "disabled"
- key use_enabled "enabled"
-
- doxygen_comment << "END"
- /**
- * A USE flag can be on, off or unspecified.
- *
- * \ingroup g_names
- */
-END
-}
-
make_enum_IUseFlagParseOption()
{
prefix iufpo
want_destringify
+ namespace paludis::erepository
key iufpo_allow_iuse_defaults "Allow +/- prefixes"
key iufpo_strict_parsing "Error rather than warn for violations"
diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc
index 061faf1..ad1e0d9 100644
--- a/paludis/repositories/e/qa/extractors.cc
+++ b/paludis/repositories/e/qa/extractors.cc
@@ -75,8 +75,8 @@ namespace
ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AllDepSpec>,
ConstVisitor<GenericSpecTree>::VisitConstSequence<FlagExtractor, AnyDepSpec>
{
- std::map<QualifiedPackageName, std::set<UseFlagName> > relevant;
- std::set<UseFlagName> current;
+ std::map<QualifiedPackageName, std::set<ChoiceNameWithPrefix> > relevant;
+ std::set<ChoiceNameWithPrefix> current;
std::set<QualifiedPackageName> needed_packages;
void visit_leaf(const FetchableURIDepSpec & u)
@@ -119,7 +119,7 @@ namespace
GenericSpecTree::ConstSequenceIterator cur,
GenericSpecTree::ConstSequenceIterator end)
{
- Save<std::set<UseFlagName> > save_current(&current);
+ Save<std::set<ChoiceNameWithPrefix> > save_current(&current);
current.insert(elike_conditional_dep_spec_flag(u));
std::for_each(cur, end, accept_visitor(*this));
}
@@ -132,6 +132,10 @@ namespace
{
}
+ void visit_leaf(const PlainTextLabelDepSpec &)
+ {
+ }
+
void visit_leaf(const NamedSetDepSpec &)
{
}
@@ -145,11 +149,11 @@ namespace
ConstVisitor<GenericSpecTree>::VisitConstSequence<Requirements, AllDepSpec>
{
const QualifiedPackageName & name;
- const std::set<UseFlagName> & relevant;
- std::map<UseFlagName, bool> current;
- std::set<std::map<UseFlagName, bool> > requirements;
+ const std::set<ChoiceNameWithPrefix> & relevant;
+ std::map<ChoiceNameWithPrefix, bool> current;
+ std::set<std::map<ChoiceNameWithPrefix, bool> > requirements;
- Requirements(const QualifiedPackageName & n, const std::set<UseFlagName> & r) :
+ Requirements(const QualifiedPackageName & n, const std::set<ChoiceNameWithPrefix> & r) :
name(n),
relevant(r)
{
@@ -157,19 +161,19 @@ namespace
void add_requirements()
{
- std::set<std::map<UseFlagName, bool> > new_requirements;
+ std::set<std::map<ChoiceNameWithPrefix, bool> > new_requirements;
new_requirements.insert(current);
- for (std::set<UseFlagName>::const_iterator r(relevant.begin()), r_end(relevant.end()) ;
+ for (std::set<ChoiceNameWithPrefix>::const_iterator r(relevant.begin()), r_end(relevant.end()) ;
r != r_end ; ++r)
{
if (! current.count(*r))
{
- std::set<std::map<UseFlagName, bool> > new_requirements_c;
- for (std::set<std::map<UseFlagName, bool> >::iterator i(new_requirements.begin()),
+ std::set<std::map<ChoiceNameWithPrefix, bool> > new_requirements_c;
+ for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator i(new_requirements.begin()),
i_end(new_requirements.end()) ;
i != i_end ; ++i)
{
- std::map<UseFlagName, bool> n(*i);
+ std::map<ChoiceNameWithPrefix, bool> n(*i);
n[*r] = true;
new_requirements_c.insert(n);
n[*r] = false;
@@ -206,6 +210,10 @@ namespace
add_requirements();
}
+ void visit_leaf(const PlainTextLabelDepSpec &)
+ {
+ }
+
void visit_leaf(const URILabelsDepSpec &)
{
}
@@ -236,8 +244,8 @@ namespace
GenericSpecTree::ConstSequenceIterator cur,
GenericSpecTree::ConstSequenceIterator end)
{
- Save<std::map<UseFlagName, bool> > save_current(&current);
- std::pair<std::map<UseFlagName, bool>::const_iterator, bool> p(current.insert(std::make_pair(
+ Save<std::map<ChoiceNameWithPrefix, bool> > save_current(&current);
+ std::pair<std::map<ChoiceNameWithPrefix, bool>::const_iterator, bool> p(current.insert(std::make_pair(
elike_conditional_dep_spec_flag(u), ! elike_conditional_dep_spec_is_inverse(u))));
if (p.second || (p.first->second == ! elike_conditional_dep_spec_is_inverse(u)))
std::for_each(cur, end, accept_visitor(*this));
@@ -274,7 +282,7 @@ paludis::erepository::extractors_check(
if (id->build_dependencies_key())
id->build_dependencies_key()->value()->accept(f);
- for (std::map<QualifiedPackageName, std::set<UseFlagName> >::const_iterator
+ for (std::map<QualifiedPackageName, std::set<ChoiceNameWithPrefix> >::const_iterator
r(f.relevant.begin()), r_end(f.relevant.end()) ;
r != r_end ; ++r)
{
@@ -297,7 +305,7 @@ paludis::erepository::extractors_check(
id->build_dependencies_key()->value()->accept(m);
/* Find the set of unmet requirements */
- std::set<std::map<UseFlagName, bool> > unmet;
+ std::set<std::map<ChoiceNameWithPrefix, bool> > unmet;
std::set_difference(q.requirements.begin(), q.requirements.end(),
m.requirements.begin(), m.requirements.end(), std::inserter(unmet, unmet.begin()));
@@ -307,15 +315,15 @@ paludis::erepository::extractors_check(
while (changed)
{
changed = false;
- std::set<std::map<UseFlagName, bool> > new_unmet;
- for (std::set<std::map<UseFlagName, bool> >::const_iterator i(unmet.begin()), i_end(unmet.end()) ;
+ std::set<std::map<ChoiceNameWithPrefix, bool> > new_unmet;
+ for (std::set<std::map<ChoiceNameWithPrefix, bool> >::const_iterator i(unmet.begin()), i_end(unmet.end()) ;
i != i_end ; ++i)
{
- std::map<UseFlagName, bool>::const_iterator j_rem(i->end());
- for (std::map<UseFlagName, bool>::const_iterator j(i->begin()), j_end(i->end()) ;
+ std::map<ChoiceNameWithPrefix, bool>::const_iterator j_rem(i->end());
+ for (std::map<ChoiceNameWithPrefix, bool>::const_iterator j(i->begin()), j_end(i->end()) ;
j != j_end ; ++j)
{
- std::map<UseFlagName, bool> n(*i);
+ std::map<ChoiceNameWithPrefix, bool> n(*i);
n[j->first] = !n[j->first];
if (unmet.count(n))
{
@@ -327,7 +335,7 @@ paludis::erepository::extractors_check(
if (j_rem != i->end())
{
- std::map<UseFlagName, bool> n(*i);
+ std::map<ChoiceNameWithPrefix, bool> n(*i);
n.erase(j_rem->first);
new_unmet.insert(n);
}
@@ -343,16 +351,16 @@ paludis::erepository::extractors_check(
while (changed)
{
changed = false;
- for (std::set<std::map<UseFlagName, bool> >::iterator i(unmet.begin()), i_end(unmet.end()) ;
+ for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator i(unmet.begin()), i_end(unmet.end()) ;
i != i_end && ! changed ; ++i)
{
- for (std::set<std::map<UseFlagName, bool> >::iterator j(unmet.begin()), j_end(unmet.end()) ;
+ for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator j(unmet.begin()), j_end(unmet.end()) ;
j != j_end && ! changed ; ++j)
{
if (i == j)
continue;
- std::map<UseFlagName, bool> delta;
+ std::map<ChoiceNameWithPrefix, bool> delta;
std::set_difference(i->begin(), i->end(), j->begin(), j->end(), std::inserter(delta, delta.begin()));
if (delta.empty())
{
@@ -371,7 +379,7 @@ paludis::erepository::extractors_check(
{
cond.append(" for USE \"");
bool need_and(false);
- for (std::set<std::map<UseFlagName, bool> >::iterator j(unmet.begin()), j_end(unmet.end()) ;
+ for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator j(unmet.begin()), j_end(unmet.end()) ;
j != j_end ; ++j)
{
if (need_and)
@@ -379,7 +387,7 @@ paludis::erepository::extractors_check(
need_and = true;
bool need_space(false);
- for (std::map<UseFlagName, bool>::const_iterator i(j->begin()), i_end(j->end()) ;
+ for (std::map<ChoiceNameWithPrefix, bool>::const_iterator i(j->begin()), i_end(j->end()) ;
i != i_end ; ++i)
{
if (need_space)
diff --git a/paludis/repositories/e/qa/iuse_key.cc b/paludis/repositories/e/qa/iuse_key.cc
index eaf78fe..809cf1b 100644
--- a/paludis/repositories/e/qa/iuse_key.cc
+++ b/paludis/repositories/e/qa/iuse_key.cc
@@ -29,9 +29,12 @@
#include <paludis/util/set.hh>
#include <paludis/util/system.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/iuse.hh>
#include <paludis/name.hh>
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
+#include <paludis/choice.hh>
#include <set>
using namespace paludis;
@@ -42,7 +45,7 @@ namespace
struct IUseBlacklist :
InstantiationPolicy<IUseBlacklist, instantiation_method::SingletonTag>
{
- std::set<UseFlagName> iuse_blacklist;
+ std::set<ChoiceNameWithPrefix> iuse_blacklist;
IUseBlacklist(const FSEntry & f = FSEntry(getenv_with_default("PALUDIS_QA_DATA_DIR",
stringify(FSEntry(DATADIR) / "paludis" / "qa"))) / "iuse_blacklist.conf")
@@ -51,7 +54,7 @@ namespace
{
LineConfigFile iuse_blacklist_file(f, LineConfigFileOptions());
std::copy(iuse_blacklist_file.begin(), iuse_blacklist_file.end(),
- create_inserter<UseFlagName>(std::inserter(iuse_blacklist, iuse_blacklist.end())));
+ create_inserter<ChoiceNameWithPrefix>(std::inserter(iuse_blacklist, iuse_blacklist.end())));
}
catch (const InternalError &)
{
@@ -71,34 +74,31 @@ bool
paludis::erepository::iuse_key_check(
const FSEntry & entry,
QAReporter & reporter,
- const std::tr1::shared_ptr<const Repository> & repo,
- const std::tr1::shared_ptr<const PackageID> & id,
+ const std::tr1::shared_ptr<const Repository> &,
+ const std::tr1::shared_ptr<const PackageID> & id_raw,
const std::string & name)
{
- Context context("When performing check '" + name + "' using iuse_key_check on ID '" + stringify(*id) + "':");
+ Context context("When performing check '" + name + "' using iuse_key_check on ID '" + stringify(*id_raw) + "':");
Log::get_instance()->message("e.qa.iuse_key_check", ll_debug, lc_context) << "iuse_key_check '"
- << entry << "', " << *id << "', " << name << "'";
+ << entry << "', " << *id_raw << "', " << name << "'";
- if (id->iuse_key())
+ std::tr1::shared_ptr<const ERepositoryID> id(std::tr1::static_pointer_cast<const ERepositoryID>(id_raw));
+ if (id->raw_iuse_key())
{
try
{
- const std::set<UseFlagName> & iuse_blacklist(IUseBlacklist::get_instance()->iuse_blacklist);
+ const std::set<ChoiceNameWithPrefix> & iuse_blacklist(IUseBlacklist::get_instance()->iuse_blacklist);
- for (IUseFlagSet::ConstIterator it(id->iuse_key()->value()->begin()),
- it_end(id->iuse_key()->value()->end()); it_end != it; ++it)
+ for (Set<std::string>::ConstIterator
+ it(id->raw_iuse_key()->value()->begin()),
+ it_end(id->raw_iuse_key()->value()->end()); it_end != it; ++it)
{
- if (iuse_blacklist.end() != iuse_blacklist.find(it->flag))
+ ChoiceNameWithPrefix flag(parse_iuse(id->eapi(), *it).first);
+ if (iuse_blacklist.end() != iuse_blacklist.find(flag))
reporter.message(QAMessage(entry, qaml_minor, name,
- "Deprecated flag '" + stringify(it->flag) + "' in '" + id->iuse_key()->raw_name() + "'")
+ "Deprecated flag '" + stringify(flag) + "' in '" + id->raw_iuse_key()->raw_name() + "'")
.with_associated_id(id)
- .with_associated_key(id, id->iuse_key()));
-
- 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)
- .with_associated_key(id, id->iuse_key()));
+ .with_associated_key(id, id->raw_iuse_key()));
}
}
catch (const InternalError &)
@@ -109,9 +109,9 @@ paludis::erepository::iuse_key_check(
{
reporter.message(QAMessage(entry, qaml_severe, name,
"Caught exception '" + stringify(e.message()) + "' ("
- + stringify(e.what()) + ") when handling key '" + id->iuse_key()->raw_name() + "'")
+ + stringify(e.what()) + ") when handling key '" + id->raw_iuse_key()->raw_name() + "'")
.with_associated_id(id)
- .with_associated_key(id, id->iuse_key()));
+ .with_associated_key(id, id->raw_iuse_key()));
}
}
diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc
index 937333e..a07c7ca 100644
--- a/paludis/repositories/e/qa/metadata_keys.cc
+++ b/paludis/repositories/e/qa/metadata_keys.cc
@@ -131,14 +131,9 @@ namespace
const std::tr1::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
- void visit(const MetadataCollectionKey<IUseFlagSet> & k)
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
{
- const std::tr1::shared_ptr<const IUseFlagSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
- }
-
- void visit(const MetadataCollectionKey<UseFlagNameSet> & k)
- {
- const std::tr1::shared_ptr<const UseFlagNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ const std::tr1::shared_ptr<const Choices> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
void visit(const MetadataSectionKey & k)
diff --git a/paludis/repositories/e/qa/restrict_key.cc b/paludis/repositories/e/qa/restrict_key.cc
index 9c647e2..b2ee115 100644
--- a/paludis/repositories/e/qa/restrict_key.cc
+++ b/paludis/repositories/e/qa/restrict_key.cc
@@ -84,6 +84,14 @@ namespace
{
}
+ void visit_leaf(const PlainTextLabelDepSpec & t)
+ {
+ reporter.message(QAMessage(entry, qaml_normal, name,
+ "Unexpected label '" + stringify(t) + "' in '" + key->raw_name() + "@")
+ .with_associated_id(id)
+ .with_associated_key(id, key));
+ }
+
void visit_leaf(const PlainTextDepSpec & t)
{
if (allowed_restricts.end() == allowed_restricts.find(t.text()))
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 696e0f7..8d60026 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -23,6 +23,7 @@
#include <paludis/qa.hh>
#include <paludis/dep_spec.hh>
#include <paludis/repository.hh>
+#include <paludis/choice.hh>
#include <paludis/util/config_file.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/e_repository_id.hh>
@@ -90,7 +91,6 @@ namespace
const FSEntry entry;
QAReporter & reporter;
const std::tr1::shared_ptr<const PackageID> & id;
- const std::set<UseFlagName> & iuse_flags;
const std::tr1::shared_ptr<const MetadataKey> & key;
const std::string name;
const std::tr1::shared_ptr<const QualifiedPackageNameSet> pds_blacklist;
@@ -98,13 +98,12 @@ namespace
unsigned level;
bool child_of_any;
- std::set<UseFlagName> uses;
+ std::set<ChoiceNameWithPrefix> uses;
Checker(
const FSEntry & f,
QAReporter & r,
const std::tr1::shared_ptr<const PackageID> & i,
- const std::set<UseFlagName> & iuse,
const std::tr1::shared_ptr<const MetadataKey> & k,
const std::string & n,
const std::tr1::shared_ptr<const QualifiedPackageNameSet> p,
@@ -112,7 +111,6 @@ namespace
entry(f),
reporter(r),
id(i),
- iuse_flags(iuse),
key(k),
name(n),
pds_blacklist(p),
@@ -156,6 +154,10 @@ namespace
{
}
+ void visit_leaf(const PlainTextLabelDepSpec &)
+ {
+ }
+
void visit_leaf(const URILabelsDepSpec &)
{
}
@@ -190,7 +192,33 @@ namespace
.with_associated_id(id)
.with_associated_key(id, key));
- if ((*id->repository()).use_interface()->arch_flags()->count(elike_conditional_dep_spec_flag(u)))
+ std::tr1::shared_ptr<const ChoiceValue> value;
+ std::tr1::shared_ptr<const Choice> choice;
+ {
+ ChoiceNameWithPrefix f(elike_conditional_dep_spec_flag(u));
+ for (Choices::ConstIterator c(id->choices_key()->value()->begin()), c_end(id->choices_key()->value()->end()) ;
+ c != c_end && ! value ; ++c)
+ for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ;
+ i != i_end && ! value ; ++i)
+ {
+ if ((*i)->name_with_prefix() == f)
+ {
+ value = *i;
+ choice = *c;
+ }
+ }
+ }
+
+ if (! choice)
+ {
+ reporter.message(QAMessage(entry, qaml_normal, name,
+ "Conditional flag '" + stringify(elike_conditional_dep_spec_flag(u)) +
+ "' in '" + stringify(key->raw_name()) + "' does not exist")
+ .with_associated_id(id)
+ .with_associated_key(id, key)
+ );
+ }
+ else if (choice->raw_name() == "ARCH")
{
if (forbid_arch_flags)
reporter.message(QAMessage(entry, qaml_normal, name,
@@ -204,40 +232,9 @@ namespace
.with_associated_key(id, key));
}
- else
- {
- if (iuse_flags.end() == iuse_flags.find(elike_conditional_dep_spec_flag(u)))
- {
- std::tr1::shared_ptr<const UseFlagNameSet> c(
- (*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()).use_interface()->use_expand_separator(*id));
- if (0 == flag.compare(0, prefix.length(), prefix))
- {
- is_hidden = true;
- break;
- }
- }
-
- if (! is_hidden)
- reporter.message(QAMessage(entry, qaml_normal, name,
- "Conditional flag '" + stringify(elike_conditional_dep_spec_flag(u)) +
- "' in '" + stringify(key->raw_name()) + "' not in '" +
- stringify(id->iuse_key()->raw_name()) + "'")
- .with_associated_id(id)
- .with_associated_key(id, key)
- .with_associated_key(id, id->iuse_key()));
- }
- }
-
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, false);
- Save<std::set<UseFlagName> > save_uses(&uses, uses);
+ Save<std::set<ChoiceNameWithPrefix> > save_uses(&uses, uses);
uses.insert(elike_conditional_dep_spec_flag(u));
if (cur == end)
reporter.message(QAMessage(entry, qaml_normal, name,
@@ -297,19 +294,16 @@ namespace
QAReporter & reporter;
std::tr1::shared_ptr<const MetadataKey> key;
const std::tr1::shared_ptr<const PackageID> & id;
- const std::set<UseFlagName> & iuse_flags;
const std::string name;
CheckForwarder(
const FSEntry & f,
QAReporter & r,
const std::tr1::shared_ptr<const PackageID> & i,
- const std::set<UseFlagName> & iuse,
const std::string & n) :
entry(f),
reporter(r),
id(i),
- iuse_flags(iuse),
name(n)
{
}
@@ -348,10 +342,6 @@ namespace
{
}
- void visit(const MetadataCollectionKey<IUseFlagSet> &)
- {
- }
-
void visit(const MetadataCollectionKey<KeywordNameSet> &)
{
}
@@ -368,15 +358,15 @@ namespace
{
}
- void visit(const MetadataCollectionKey<UseFlagNameSet> &)
+ void visit(const MetadataCollectionKey<PackageIDSequence> &)
{
}
- void visit(const MetadataCollectionKey<PackageIDSequence> &)
+ void visit(const MetadataValueKey<FSEntry> &)
{
}
- void visit(const MetadataValueKey<FSEntry> &)
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > &)
{
}
@@ -391,7 +381,7 @@ namespace
try
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
- Checker c(entry, reporter, id, iuse_flags, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), false, false);
+ Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), false, false);
k.value()->accept(c);
}
catch (const InternalError &)
@@ -412,7 +402,7 @@ namespace
try
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
- Checker c(entry, reporter, id, iuse_flags, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
+ Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
k.value()->accept(c);
}
catch (const InternalError &)
@@ -433,7 +423,7 @@ namespace
try
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
- Checker c(entry, reporter, id, iuse_flags, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
+ Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
k.value()->accept(c);
}
catch (const InternalError &)
@@ -454,7 +444,7 @@ namespace
try
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
- Checker c(entry, reporter, id, iuse_flags, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), false, true);
+ Checker c(entry, reporter, id, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), false, true);
k.value()->accept(c);
}
catch (const InternalError &)
@@ -475,7 +465,7 @@ namespace
try
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
- Checker c(entry, reporter, id, iuse_flags, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), true, true);
+ Checker c(entry, reporter, id, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), true, true);
k.value()->accept(c);
}
catch (const InternalError &)
@@ -496,7 +486,7 @@ namespace
try
{
Context context("When visiting metadata key '" + k.raw_name() + "':");
- Checker c(entry, reporter, id, iuse_flags, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
+ Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true);
k.value()->accept(c);
}
catch (const InternalError &)
@@ -527,13 +517,7 @@ paludis::erepository::spec_keys_check(
using namespace std::tr1::placeholders;
- std::set<UseFlagName> iuse;
- std::transform(id->iuse_key()->value()->begin(),
- id->iuse_key()->value()->end(),
- std::inserter(iuse, iuse.begin()),
- std::tr1::mem_fn(&IUseFlag::flag));
-
- CheckForwarder f(entry, reporter, id, iuse, name);
+ CheckForwarder f(entry, reporter, id, name);
std::for_each(id->begin_metadata(), id->end_metadata(), std::tr1::bind(&CheckForwarder::visit_sptr, &f, _1));
return true;
diff --git a/paludis/repositories/e/qa/spec_keys_TEST.cc b/paludis/repositories/e/qa/spec_keys_TEST.cc
index 4da1b64..4b908e8 100644
--- a/paludis/repositories/e/qa/spec_keys_TEST.cc
+++ b/paludis/repositories/e/qa/spec_keys_TEST.cc
@@ -98,14 +98,15 @@ namespace test_cases
std::tr1::shared_ptr<FakePackageID> id3(repo->add_version("cat", "pkg", "3"));
id3->build_dependencies_key()->set_from_string("x? ( )");
- id3->iuse_key()->set_from_string("x", IUseFlagParseOptions());
+ id3->choices_key()->add("", "x");
TestReporter r3;
TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r3, id3, "spec keys"));
TEST_CHECK_EQUAL(r3.count, 1u);
std::tr1::shared_ptr<FakePackageID> id4(repo->add_version("cat", "pkg", "4"));
id4->build_dependencies_key()->set_from_string("x? ( ) ( y? ( || ( ) ) )");
- id4->iuse_key()->set_from_string("x y", IUseFlagParseOptions());
+ id4->choices_key()->add("", "x");
+ id4->choices_key()->add("", "y");
TestReporter r4;
TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r4, id4, "spec keys"));
TEST_CHECK_EQUAL(r4.count, 2u);
@@ -123,7 +124,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1"));
id->build_dependencies_key()->set_from_string("|| ( v/w x? ( x/y ) )");
- id->iuse_key()->set_from_string("x", IUseFlagParseOptions());
+ id->choices_key()->add("", "x");
TestReporter r;
TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys"));
@@ -199,7 +200,7 @@ namespace test_cases
std::tr1::shared_ptr<FakePackageID> id1(repo->add_version("cat", "pkg", "1"));
id1->build_dependencies_key()->set_from_string("x? ( x? ( cat/pkg ) )");
- id1->iuse_key()->set_from_string("x", IUseFlagParseOptions());
+ id1->choices_key()->add("", "x");
TestReporter r1;
TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r1, id1, "spec keys"));
@@ -207,7 +208,7 @@ namespace test_cases
std::tr1::shared_ptr<FakePackageID> id2(repo->add_version("cat", "pkg", "2"));
id2->build_dependencies_key()->set_from_string("x? ( !x? ( cat/pkg ) )");
- id2->iuse_key()->set_from_string("x", IUseFlagParseOptions());
+ id2->choices_key()->add("", "x");
TestReporter r2;
TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r2, id2, "spec keys"));
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index 7c5a4cd..3c778e0 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -40,6 +40,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/choice.hh>
#include <set>
#include <algorithm>
@@ -222,9 +223,48 @@ namespace
DependencySpecTree::ConstSequenceIterator cur,
DependencySpecTree::ConstSequenceIterator end)
{
- viable =
- ((! 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)));
+ ChoiceNameWithPrefix prefixed(elike_conditional_dep_spec_flag(u));
+ UnprefixedChoiceName value("x");
+ std::tr1::shared_ptr<const Choice> choice;
+ if (id->choices_key())
+ for (Choices::ConstIterator c(id->choices_key()->value()->begin()),
+ c_end(id->choices_key()->value()->end()) ;
+ c != c_end ; ++c)
+ {
+ if (0 != prefixed.data().compare(0, (*c)->prefix().data().length(), (*c)->prefix().data(),
+ 0, (*c)->prefix().data().length()))
+ continue;
+
+ for (Choice::ConstIterator d((*c)->begin()), d_end((*c)->end()) ;
+ d != d_end ; ++d)
+ if ((*d)->name_with_prefix() == prefixed)
+ {
+ choice = *c;
+ value = (*d)->unprefixed_name();
+ break;
+ }
+
+ if (choice)
+ break;
+ }
+
+ if (! choice)
+ {
+ viable = false;
+ if (reporter)
+ reporter->message(QAMessage(entry, qaml_normal, name, "No flag matching '"
+ + stringify(prefixed) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '"
+ + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status())
+ + (unstable ? ".unstable" : ".stable") + ")")
+ .with_associated_id(id)
+ .with_associated_key(id, key));
+ }
+ else
+ viable =
+ ((! elike_conditional_dep_spec_is_inverse(u)) && (! (*profile).profile()->use_masked(
+ id, choice, value, prefixed))) ||
+ ((elike_conditional_dep_spec_is_inverse(u)) && (! (*profile).profile()->use_forced(
+ id, choice, value, prefixed)));
if (viable)
std::for_each(cur, end, accept_visitor(*this));
diff --git a/paludis/repositories/e/qa/visibility_TEST_setup.sh b/paludis/repositories/e/qa/visibility_TEST_setup.sh
index 7170be3..bcc9e55 100755
--- a/paludis/repositories/e/qa/visibility_TEST_setup.sh
+++ b/paludis/repositories/e/qa/visibility_TEST_setup.sh
@@ -71,7 +71,7 @@ DESCRIPTION="use masking"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
-IUSE=""
+IUSE="foo"
LICENSE="GPL-2"
KEYWORDS="test test64"
DEPEND="foo? ( cat-one/visible )"
@@ -82,7 +82,7 @@ DESCRIPTION="use masking"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
-IUSE=""
+IUSE="foo"
LICENSE="GPL-2"
KEYWORDS="test test64"
DEPEND="!foo? ( cat-one/visible )"
@@ -93,7 +93,7 @@ DESCRIPTION="use masking"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
-IUSE=""
+IUSE="masked"
LICENSE="GPL-2"
KEYWORDS="test test64"
DEPEND="masked? ( cat-one/visible )"
@@ -104,7 +104,7 @@ DESCRIPTION="use masking"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
-IUSE=""
+IUSE="forced"
LICENSE="GPL-2"
KEYWORDS="test test64"
DEPEND="!forced? ( cat-one/visible )"
@@ -115,7 +115,7 @@ DESCRIPTION="use masking"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
-IUSE=""
+IUSE="test"
LICENSE="GPL-2"
KEYWORDS="test test64"
DEPEND="test? ( cat-one/visible )"
@@ -126,7 +126,7 @@ DESCRIPTION="use masking"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
-IUSE=""
+IUSE="test64"
LICENSE="GPL-2"
KEYWORDS="test test64"
DEPEND="!test64? ( cat-one/visible )"
diff --git a/paludis/repositories/e/traditional_layout.cc b/paludis/repositories/e/traditional_layout.cc
index 947492f..315d268 100644
--- a/paludis/repositories/e/traditional_layout.cc
+++ b/paludis/repositories/e/traditional_layout.cc
@@ -39,6 +39,7 @@
#include <paludis/util/set.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/hashes.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
#include <functional>
@@ -113,8 +114,8 @@ TraditionalLayout::TraditionalLayout(const ERepository * const repo, const FSEnt
_imp->mirror_files->push_back(*l / "profiles" / "thirdpartymirrors");
_imp->info_variables_files->push_back(*l / "profiles" / "info_vars");
- _imp->use_desc_files->push_back(std::make_pair(*l / "profiles" / "use.desc", ""));
- _imp->use_desc_files->push_back(std::make_pair(*l / "profiles" / "use.local.desc", ""));
+ _imp->use_desc_files->push_back(std::make_pair(*l / "profiles" / "use.desc", ChoicePrefixName("")));
+ _imp->use_desc_files->push_back(std::make_pair(*l / "profiles" / "use.local.desc", ChoicePrefixName("")));
FSEntry descs(*l / "profiles" / "desc");
if (descs.is_directory_or_symlink_to_directory())
{
@@ -122,7 +123,7 @@ TraditionalLayout::TraditionalLayout(const ERepository * const repo, const FSEnt
{
if (! is_file_with_extension(*d, ".desc", IsFileWithOptions()))
continue;
- _imp->use_desc_files->push_back(std::make_pair(*d, strip_trailing_string(d->basename(), ".desc")));
+ _imp->use_desc_files->push_back(std::make_pair(*d, ChoicePrefixName(strip_trailing_string(d->basename(), ".desc"))));
}
}
}
diff --git a/paludis/repositories/e/use_desc.cc b/paludis/repositories/e/use_desc.cc
index 0ce503a..2a3b31d 100644
--- a/paludis/repositories/e/use_desc.cc
+++ b/paludis/repositories/e/use_desc.cc
@@ -30,20 +30,24 @@
#include <paludis/util/config_file.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/sequence-impl.hh>
+#include <paludis/choice.hh>
#include <tr1/unordered_map>
using namespace paludis;
template class Sequence<UseDescFileInfo>;
+typedef std::tr1::unordered_map<std::pair<ChoicePrefixName, UnprefixedChoiceName>, std::string,
+ Hash<std::pair<ChoicePrefixName, UnprefixedChoiceName> > > UseDescs;
namespace paludis
{
template<>
struct Implementation<UseDesc>
{
- std::tr1::unordered_map<std::string, std::string, Hash<std::string> > desc;
+ std::tr1::unordered_map<QualifiedPackageName, UseDescs, Hash<QualifiedPackageName> > local_descs;
+ UseDescs global_descs;
- void add(const FSEntry & f, const std::string & prefix)
+ void add(const FSEntry & f, const ChoicePrefixName & prefix)
{
if (f.is_regular_file_or_symlink_to_regular_file())
{
@@ -54,23 +58,28 @@ namespace paludis
std::string::size_type p(line->find(" - "));
if (std::string::npos == p)
continue;
+ std::string lhs(line->substr(0, p)), rhs(line->substr(p + 3));
- desc.insert(std::make_pair(prefix + line->substr(0, p), line->substr(p + 3)));
+ std::string::size_type q(lhs.find(':'));
+ if (std::string::npos == q)
+ global_descs.insert(make_pair(make_pair(prefix, lhs), rhs));
+ else
+ local_descs[QualifiedPackageName(lhs.substr(0, q))].insert(make_pair(make_pair(prefix, lhs.substr(q + 1)), rhs));
}
}
}
- Implementation(const std::tr1::shared_ptr<const UseDescFileInfoSequence> & f, const std::string & expand_sep)
+ Implementation(const std::tr1::shared_ptr<const UseDescFileInfoSequence> & f)
{
for (UseDescFileInfoSequence::ConstIterator ff(f->begin()), ff_end(f->end()) ;
ff != ff_end ; ++ff)
- add(ff->first, ff->second.empty() ? ff->second : ff->second + expand_sep);
+ add(ff->first, ff->second);
}
};
}
-UseDesc::UseDesc(const std::tr1::shared_ptr<const UseDescFileInfoSequence> & f, const std::string & expand_sep) :
- PrivateImplementationPattern<UseDesc>(new Implementation<UseDesc>(f, expand_sep))
+UseDesc::UseDesc(const std::tr1::shared_ptr<const UseDescFileInfoSequence> & f) :
+ PrivateImplementationPattern<UseDesc>(new Implementation<UseDesc>(f))
{
}
@@ -78,16 +87,23 @@ UseDesc::~UseDesc()
{
}
-std::string
-UseDesc::describe(const UseFlagName & f, const PackageID & e) const
+const std::string
+UseDesc::describe(
+ const QualifiedPackageName & id,
+ const ChoicePrefixName & prefix,
+ const UnprefixedChoiceName & flag
+ ) const
{
- std::tr1::unordered_map<std::string, std::string, Hash<std::string> >::const_iterator i(
- _imp->desc.find(stringify(e.name()) + ":" + stringify(f)));
- if (_imp->desc.end() != i)
- return i->second;
+ std::tr1::unordered_map<QualifiedPackageName, UseDescs, Hash<QualifiedPackageName> >::const_iterator i(_imp->local_descs.find(id));
+ if (i != _imp->local_descs.end())
+ {
+ UseDescs::const_iterator j(i->second.find(make_pair(prefix, flag)));
+ if (j != i->second.end())
+ return j->second;
+ }
- std::tr1::unordered_map<std::string, std::string, Hash<std::string> >::const_iterator j(_imp->desc.find(stringify(f)));
- if (_imp->desc.end() != j)
+ UseDescs::const_iterator j(_imp->global_descs.find(make_pair(prefix, flag)));
+ if (j != _imp->global_descs.end())
return j->second;
return "";
diff --git a/paludis/repositories/e/use_desc.hh b/paludis/repositories/e/use_desc.hh
index 4190e24..bb244b2 100644
--- a/paludis/repositories/e/use_desc.hh
+++ b/paludis/repositories/e/use_desc.hh
@@ -25,11 +25,12 @@
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/choice-fwd.hh>
#include <utility>
namespace paludis
{
- typedef std::pair<FSEntry, std::string> UseDescFileInfo;
+ typedef std::pair<FSEntry, ChoicePrefixName> UseDescFileInfo;
typedef Sequence<UseDescFileInfo> UseDescFileInfoSequence;
/**
@@ -45,17 +46,20 @@ namespace paludis
///\name Basic operations
///\{
- UseDesc(const std::tr1::shared_ptr<const UseDescFileInfoSequence> &, const std::string & expand_sep);
+ UseDesc(const std::tr1::shared_ptr<const UseDescFileInfoSequence> &);
~UseDesc();
///\}
/**
- * Describe the given use flag, possibly for the specified package.
+ * Describe the given use flag.
*
* May return an empty string.
*/
- std::string describe(const UseFlagName &, const PackageID &) const;
+ const std::string describe(
+ const QualifiedPackageName &,
+ const ChoicePrefixName & prefix,
+ const UnprefixedChoiceName & suffix) const;
};
}
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 7891da0..075db52 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -167,7 +167,6 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
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)),
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index be39ae4..ae2d84d 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -36,6 +36,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/stringify_formatter.hh>
#include <paludis/action.hh>
+#include <paludis/choice.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <tr1/functional>
@@ -134,9 +135,12 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
&env, UserPackageDepSpecOptions()))))]->begin());
- 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_CHECK(e1->choices_key());
+ TEST_CHECK(e1->choices_key()->value());
+ TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1")));
+ TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1"))->enabled());
+ TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->enabled());
+ TEST_CHECK(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->enabled());
}
} test_vdb_repository_query_use;
@@ -339,8 +343,6 @@ namespace test_cases
env.package_database()->add_repository(0, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -456,8 +458,6 @@ namespace test_cases
env.package_database()->add_repository(0, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -573,8 +573,6 @@ namespace test_cases
env.package_database()->add_repository(0, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -965,8 +963,6 @@ namespace test_cases
env.package_database()->add_repository(0, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -1203,8 +1199,6 @@ namespace test_cases
env.package_database()->add_repository(0, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -1295,8 +1289,6 @@ namespace test_cases
env.package_database()->add_repository(0, 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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
diff --git a/paludis/repositories/e/vdb_repository_TEST_setup.sh b/paludis/repositories/e/vdb_repository_TEST_setup.sh
index 0acba75..f24f79d 100755
--- a/paludis/repositories/e/vdb_repository_TEST_setup.sh
+++ b/paludis/repositories/e/vdb_repository_TEST_setup.sh
@@ -19,6 +19,7 @@ for i in DEPEND RDEPEND LICENSE INHERITED IUSE PDEPEND PROVIDE; do
done
echo "flag1 flag2" >>repo1/cat-one/pkg-one-1/USE
+echo "flag1 flag2 flag3" >>repo1/cat-one/pkg-one-1/IUSE
cat <<END >repo1/cat-one/pkg-one-1/CONTENTS
dir /directory
@@ -399,6 +400,9 @@ done
for f in providestest/cat1/{pkg1,pkg2,pkg3}-{1,2}/USE; do
echo enabled >${f}
done
+for f in providestest/cat1/{pkg1,pkg2,pkg3}-{1,2}/IUSE; do
+ echo disabled enabled >${f}
+done
echo ' virtual/foo' >providestest/cat1/pkg1-1/PROVIDE
echo 'enabled? ( virtual/foo )' >providestest/cat1/pkg1-2/PROVIDE
@@ -427,6 +431,7 @@ cat <<END >providesincrtest_src1/cat1/pkg1/pkg1-1.ebuild
KEYWORDS="test"
SLOT="\${PV:0:1}"
PROVIDE="enabled? ( virtual/foo ) disabled? ( virtual/bar )"
+IUSE="enabled disabled"
END
cp providesincrtest_src1/cat1/pkg1/pkg1-{1,1.1}.ebuild
cp providesincrtest_src1/cat1/pkg1/pkg1-{1,2}.ebuild
@@ -437,6 +442,7 @@ cat <<END >providesincrtest_src2/cat1/pkg1/pkg1-1.ebuild
KEYWORDS="test"
SLOT="\${PV:0:1}"
PROVIDE="enabled? ( virtual/bar ) disabled? ( virtual/foo )"
+IUSE="enabled disabled"
END
cat <<END >providesincrtest_src1/cat2/pkg1/pkg1-1.ebuild
diff --git a/paludis/repositories/e/xml_things.cc b/paludis/repositories/e/xml_things.cc
index a6ed6db..e34576f 100644
--- a/paludis/repositories/e/xml_things.cc
+++ b/paludis/repositories/e/xml_things.cc
@@ -101,7 +101,7 @@ namespace
archs.erase("*");
for (std::set<std::string>::const_iterator r(archs.begin()), r_end(archs.end()) ;
r != r_end ; ++r)
- pkg->add_arch(UseFlagName(*r));
+ pkg->add_arch(*r);
}
}
}
diff --git a/paludis/repositories/fake/dep_parser.cc b/paludis/repositories/fake/dep_parser.cc
index 16897a3..e4dfbe4 100644
--- a/paludis/repositories/fake/dep_parser.cc
+++ b/paludis/repositories/fake/dep_parser.cc
@@ -161,7 +161,7 @@ namespace
using namespace std::tr1::placeholders;
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)))));
+ parse_elike_conditional_dep_spec(u, env, id, false)))));
(*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)),
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index cd891a6..133f1d3 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -66,7 +66,6 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co
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>),
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index f16a138..a25c74d 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -27,6 +27,7 @@
#include <paludis/formatter.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/choice.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -37,7 +38,8 @@
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/hashes.hh>
-
+#include <paludis/util/tribool.hh>
+#include <map>
#include <list>
#include <sstream>
@@ -101,25 +103,6 @@ FakeMetadataKeywordSetKey::set_from_string(const std::string & s)
tokenise_whitespace(s, create_inserter<KeywordName>(_imp->collection->inserter()));
}
-FakeMetadataIUseSetKey::FakeMetadataIUseSetKey(const std::string & r,
- const std::string & h, const std::string & v, const IUseFlagParseOptions & o, const MetadataKeyType t,
- const PackageID * const i, const Environment * const e) :
- FakeMetadataCollectionKey<IUseFlagSet>(r, h, t, i, e)
-{
- set_from_string(v, o);
-}
-
-void
-FakeMetadataIUseSetKey::set_from_string(const std::string & s, const IUseFlagParseOptions & o)
-{
- _imp->collection.reset(new IUseFlagSet);
- std::list<std::string> tokens;
- tokenise_whitespace(s, std::back_inserter(tokens));
- for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
- t != t_end ; ++t)
- _imp->collection->insert(IUseFlag(*t, o, std::string::npos));
-}
-
namespace paludis
{
#ifndef PALUDIS_NO_DOUBLE_TEMPLATE
@@ -308,6 +291,112 @@ FakeMetadataSpecTreeKey<DependencySpecTree>::initial_labels() const
namespace paludis
{
template <>
+ struct Implementation<FakeMetadataChoicesKey>
+ {
+ const Environment * const env;
+ const std::tr1::shared_ptr<const PackageID> id;
+ std::tr1::shared_ptr<Choices> value;
+ std::map<std::string, std::tr1::shared_ptr<Choice> > choices;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const PackageID> & i) :
+ env(e),
+ id(i),
+ value(new Choices)
+ {
+ }
+ };
+}
+
+namespace
+{
+ struct FakeChoiceValue :
+ ChoiceValue
+ {
+ const Environment * const env;
+ const std::tr1::shared_ptr<const PackageID> id;
+ const std::tr1::shared_ptr<const Choice> choice;
+ const UnprefixedChoiceName value_name;
+
+ FakeChoiceValue(
+ const Environment * const e,
+ const std::tr1::shared_ptr<const PackageID> & i,
+ const std::tr1::shared_ptr<const Choice> & c,
+ const UnprefixedChoiceName & n) :
+ env(e),
+ id(i),
+ choice(c),
+ value_name(n)
+ {
+ }
+
+ const UnprefixedChoiceName unprefixed_name() const
+ {
+ return value_name;
+ }
+
+ virtual const ChoiceNameWithPrefix name_with_prefix() const
+ {
+ return ChoiceNameWithPrefix((choice->prefix().data().empty() ? "" : stringify(choice->prefix()) + "*") + stringify(value_name));
+ }
+
+ virtual bool enabled() const
+ {
+ return env->want_choice_enabled(id, choice, value_name).is_true();
+ }
+
+ virtual bool locked() const
+ {
+ return false;
+ }
+
+ virtual const std::string description() const
+ {
+ return "monkey";
+ }
+
+ virtual bool explicitly_listed() const
+ {
+ return true;
+ }
+ };
+}
+
+FakeMetadataChoicesKey::FakeMetadataChoicesKey(const Environment * const e,
+ const std::tr1::shared_ptr<const PackageID> & i) :
+ MetadataValueKey<std::tr1::shared_ptr<const Choices> >("Choices", "Choices", mkt_normal),
+ PrivateImplementationPattern<FakeMetadataChoicesKey>(new Implementation<FakeMetadataChoicesKey>(e, i)),
+ _imp(PrivateImplementationPattern<FakeMetadataChoicesKey>::_imp)
+{
+}
+
+FakeMetadataChoicesKey::~FakeMetadataChoicesKey()
+{
+}
+
+void
+FakeMetadataChoicesKey::add(const std::string & n, const std::string & v)
+{
+ if (_imp->choices.end() == _imp->choices.find(n))
+ {
+ std::tr1::shared_ptr<Choice> c(new Choice(n.empty() ? "default" : n, n.empty() ? "default" : n, ChoicePrefixName(n),
+ false, false, false, false));
+ _imp->value->add(c);
+ _imp->choices.insert(std::make_pair(n, c));
+ }
+
+ _imp->choices.find(n)->second->add(make_shared_ptr(new FakeChoiceValue(_imp->env, _imp->id,
+ _imp->choices.find(n)->second, UnprefixedChoiceName(v))));
+}
+
+const std::tr1::shared_ptr<const Choices>
+FakeMetadataChoicesKey::value() const
+{
+ return _imp->value;
+}
+
+namespace paludis
+{
+ template <>
struct Implementation<FakeUnacceptedMask>
{
const char key;
@@ -399,7 +488,6 @@ namespace paludis
std::tr1::shared_ptr<LiteralMetadataValueKey<std::tr1::shared_ptr<const PackageID> > > package_id;
std::tr1::shared_ptr<LiteralMetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for;
std::tr1::shared_ptr<FakeMetadataKeywordSetKey> keywords;
- std::tr1::shared_ptr<FakeMetadataIUseSetKey> iuse;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<LicenseSpecTree> > license;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<ProvideSpecTree> > provide;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > build_dependencies;
@@ -409,6 +497,7 @@ namespace paludis
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<PlainTextSpecTree> > restrictions;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > src_uri;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage;
+ std::tr1::shared_ptr<FakeMetadataChoicesKey> choices;
std::tr1::shared_ptr<Mask> unsupported_mask;
mutable bool has_masks;
@@ -425,8 +514,6 @@ namespace paludis
post_dependencies_labels(new DependencyLabelSequence),
suggested_dependencies_labels(new DependencyLabelSequence),
keywords(new FakeMetadataKeywordSetKey("KEYWORDS", "Keywords", "test", mkt_normal, id, env)),
- iuse(new FakeMetadataIUseSetKey("IUSE", "Used USE flags", "",
- IUseFlagParseOptions() + iufpo_allow_iuse_defaults + iufpo_strict_parsing, mkt_normal, id, env)),
has_masks(false)
{
build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("DEPEND")));
@@ -444,7 +531,6 @@ FakePackageID::FakePackageID(const Environment * const e, const std::tr1::shared
_imp(PrivateImplementationPattern<FakePackageID>::_imp)
{
add_metadata_key(_imp->keywords);
- add_metadata_key(_imp->iuse);
}
FakePackageID::~FakePackageID()
@@ -510,13 +596,6 @@ FakePackageID::keywords_key() const
return _imp->keywords;
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-FakePackageID::iuse_key() const
-{
- need_keys_added();
- return _imp->iuse;
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> >
FakePackageID::license_key() const
{
@@ -566,13 +645,6 @@ FakePackageID::keywords_key()
return _imp->keywords;
}
-const std::tr1::shared_ptr<FakeMetadataIUseSetKey>
-FakePackageID::iuse_key()
-{
- need_keys_added();
- return _imp->iuse;
-}
-
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<ProvideSpecTree> >
FakePackageID::provide_key()
{
@@ -728,6 +800,8 @@ FakePackageID::need_keys_added() const
"", std::tr1::bind(&parse_provide, _1, _imp->env,
shared_from_this()), mkt_normal));
+ _imp->choices.reset(new FakeMetadataChoicesKey(_imp->env, shared_from_this()));
+
add_metadata_key(_imp->build_dependencies);
add_metadata_key(_imp->run_dependencies);
add_metadata_key(_imp->post_dependencies);
@@ -736,6 +810,7 @@ FakePackageID::need_keys_added() const
add_metadata_key(_imp->homepage);
add_metadata_key(_imp->provide);
add_metadata_key(_imp->license);
+ add_metadata_key(_imp->choices);
}
}
@@ -995,87 +1070,6 @@ FakePackageID::use_expand_separator() const
}
std::string
-FakeMetadataIUseSetKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
-{
- std::string result;
- for (IUseFlagSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (! result.empty())
- result.append(" ");
-
- 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()).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()));
- else
- result.append(f.format(*i, format::Disabled()));
- }
-
- return result;
-}
-
-std::string
-FakeMetadataIUseSetKey::pretty_print_flat_with_comparison(
- const Environment * const env,
- const std::tr1::shared_ptr<const PackageID> & id,
- const Formatter<IUseFlag> & f) const
-{
- std::string result;
- for (IUseFlagSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (! result.empty())
- result.append(" ");
-
- std::string l;
- bool n;
-
- 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()).use_interface() && (*_imp->id->repository()).use_interface()->query_use_force(i->flag, *_imp->id))
- {
- l = f.format(*i, format::Forced());
- n = true;
- }
- else if (_imp->env->query_use(i->flag, *_imp->id))
- {
- l = f.format(*i, format::Enabled());
- n = true;
- }
- else
- {
- l = f.format(*i, format::Disabled());
- n = true;
- }
-
- if (! id->iuse_key())
- l = f.decorate(*i, l, format::Added());
- else
- {
- using namespace std::tr1::placeholders;
- IUseFlagSet::ConstIterator p(std::find_if(id->iuse_key()->value()->begin(), id->iuse_key()->value()->end(),
- std::tr1::bind(std::equal_to<UseFlagName>(), i->flag, std::tr1::bind<const UseFlagName>(&IUseFlag::flag, _1))));
-
- if (p == id->iuse_key()->value()->end())
- l = f.decorate(*i, l, format::Added());
- else if (n != env->query_use(i->flag, *id))
- l = f.decorate(*i, l, format::Changed());
- }
-
- result.append(l);
- }
-
- return result;
-}
-
-
-std::string
FakeMetadataKeywordSetKey::pretty_print_flat(const Formatter<KeywordName> & f) const
{
std::string result;
@@ -1096,6 +1090,20 @@ FakeMetadataKeywordSetKey::pretty_print_flat(const Formatter<KeywordName> & f) c
return result;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+FakePackageID::choices_key() const
+{
+ need_keys_added();
+ return _imp->choices;
+}
+
+const std::tr1::shared_ptr<FakeMetadataChoicesKey>
+FakePackageID::choices_key()
+{
+ need_keys_added();
+ return _imp->choices;
+}
+
template class FakeMetadataSpecTreeKey<LicenseSpecTree>;
template class FakeMetadataSpecTreeKey<ProvideSpecTree>;
template class FakeMetadataSpecTreeKey<PlainTextSpecTree>;
@@ -1107,5 +1115,4 @@ template class FakeMetadataSpecTreeKey<DependencySpecTree>;
template class FakeMetadataSpecTreeKey<SimpleURISpecTree>;
template class FakeMetadataCollectionKey<KeywordNameSet>;
-template class FakeMetadataCollectionKey<IUseFlagSet>;
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index b463986..368324d 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -60,26 +60,6 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
- class PALUDIS_VISIBLE FakeMetadataIUseSetKey :
- public FakeMetadataCollectionKey<IUseFlagSet>
- {
- public:
- FakeMetadataIUseSetKey(const std::string &, const std::string &, const std::string &, const IUseFlagParseOptions &,
- const MetadataKeyType, const PackageID * const, const Environment * const);
-
- void set_from_string(const std::string &, const IUseFlagParseOptions &);
-
- virtual std::string pretty_print_flat(const Formatter<IUseFlag> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat_with_comparison(
- const Environment * const,
- const std::tr1::shared_ptr<const PackageID> &,
- const Formatter<IUseFlag> &
- ) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
template <typename C_>
class PALUDIS_VISIBLE FakeMetadataSpecTreeKey :
public MetadataSpecTreeKey<C_>,
@@ -164,6 +144,23 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ class PALUDIS_VISIBLE FakeMetadataChoicesKey :
+ public MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
+ private PrivateImplementationPattern<FakeMetadataChoicesKey>
+ {
+ private:
+ PrivateImplementationPattern<FakeMetadataChoicesKey>::ImpPtr & _imp;
+
+ public:
+ FakeMetadataChoicesKey(
+ const Environment * const,
+ const std::tr1::shared_ptr<const PackageID> &);
+ ~FakeMetadataChoicesKey();
+
+ void add(const std::string &, const std::string &);
+ const std::tr1::shared_ptr<const Choices> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class PALUDIS_VISIBLE FakeUnacceptedMask :
public UnacceptedMask,
private PrivateImplementationPattern<FakeUnacceptedMask>
@@ -229,7 +226,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
@@ -248,6 +244,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<long> > size_of_all_distfiles_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > license_key() const;
@@ -255,7 +252,6 @@ namespace paludis
///\{
const std::tr1::shared_ptr<FakeMetadataKeywordSetKey> keywords_key();
- const std::tr1::shared_ptr<FakeMetadataIUseSetKey> iuse_key();
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<ProvideSpecTree> > provide_key();
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key();
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key();
@@ -263,6 +259,7 @@ namespace paludis
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<DependencySpecTree> > suggested_dependencies_key();
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > fetches_key();
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage_key();
+ const std::tr1::shared_ptr<FakeMetadataChoicesKey> choices_key();
void set_slot(const SlotName &);
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index ef23de1..b344dde 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -72,7 +72,6 @@ FakeRepository::FakeRepository(const Environment * const env, const RepositoryNa
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)
)),
@@ -95,7 +94,6 @@ FakeRepository::FakeRepository(const FakeRepositoryParams & params) :
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)
)),
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index a87cc3b..126ed7f 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -64,7 +64,6 @@ namespace paludis
FakeRepositoryBase::FakeRepositoryBase(const Environment * const e,
const RepositoryName & our_name, const RepositoryCapabilities & caps) :
Repository(e, our_name, caps),
- RepositoryUseInterface(),
PrivateImplementationPattern<FakeRepositoryBase>(new Implementation<FakeRepositoryBase>(e)),
_imp(PrivateImplementationPattern<FakeRepositoryBase>::_imp)
{
@@ -142,30 +141,6 @@ FakeRepositoryBase::add_version(const QualifiedPackageName & q, const VersionSpe
return id;
}
-UseFlagState
-FakeRepositoryBase::query_use(const UseFlagName &, const PackageID &) const
-{
- return use_unspecified;
-}
-
-bool
-FakeRepositoryBase::query_use_mask(const UseFlagName &, const PackageID &) const
-{
- return false;
-}
-
-bool
-FakeRepositoryBase::query_use_force(const UseFlagName &, const PackageID &) const
-{
- return false;
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-FakeRepositoryBase::arch_flags() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
void
FakeRepositoryBase::invalidate()
{
@@ -181,32 +156,6 @@ FakeRepositoryBase::invalidate_masks()
(*it2)->invalidate_masks();
}
-std::tr1::shared_ptr<const UseFlagNameSet>
-FakeRepositoryBase::use_expand_flags() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-FakeRepositoryBase::use_expand_hidden_prefixes() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
-std::tr1::shared_ptr<const UseFlagNameSet>
-FakeRepositoryBase::use_expand_prefixes() const
-{
- return std::tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
-}
-
-char
-FakeRepositoryBase::use_expand_separator(const PackageID & id) const
-{
- if (this != id.repository().get())
- return '\0';
- return static_cast<const FakePackageID &>(id).use_expand_separator();
-}
-
void
FakeRepositoryBase::add_package_set(const SetName & n, const std::tr1::shared_ptr<SetSpecTree::ConstItem> & s)
{
@@ -232,13 +181,6 @@ FakeRepositoryBase::sets_list() const
return result;
}
-std::string
-FakeRepositoryBase::describe_use_flag(const UseFlagName &,
- const PackageID &) const
-{
- return "";
-}
-
const Environment *
FakeRepositoryBase::environment() const
{
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index 8522665..6b02bb3 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -44,7 +44,6 @@ namespace paludis
*/
class PALUDIS_VISIBLE FakeRepositoryBase :
public Repository,
- public RepositoryUseInterface,
public RepositorySetsInterface,
private PrivateImplementationPattern<FakeRepositoryBase>,
public std::tr1::enable_shared_from_this<FakeRepositoryBase>
@@ -107,36 +106,6 @@ namespace paludis
*/
const Environment * environment() const;
- /* RepositoryUseInterface */
-
- virtual UseFlagState query_use(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool query_use_mask(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual bool query_use_force(const UseFlagName &, const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> arch_flags() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_flags() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_hidden_prefixes() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_prefixes() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual char use_expand_separator(const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string describe_use_flag(const UseFlagName &,
- const PackageID &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
/* RepositorySetsInterface */
virtual std::tr1::shared_ptr<SetSpecTree::ConstItem> package_set(const SetName & id) const
diff --git a/paludis/repositories/gems/gem_specification.cc b/paludis/repositories/gems/gem_specification.cc
index a4ece8f..b32ac80 100644
--- a/paludis/repositories/gems/gem_specification.cc
+++ b/paludis/repositories/gems/gem_specification.cc
@@ -342,12 +342,6 @@ GemSpecification::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-GemSpecification::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
GemSpecification::provide_key() const
{
@@ -626,3 +620,9 @@ GemSpecification::breaks_portage() const
return why;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+GemSpecification::choices_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >();
+}
+
diff --git a/paludis/repositories/gems/gem_specification.hh b/paludis/repositories/gems/gem_specification.hh
index b243059..ccd8198 100644
--- a/paludis/repositories/gems/gem_specification.hh
+++ b/paludis/repositories/gems/gem_specification.hh
@@ -92,7 +92,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
@@ -109,6 +108,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > > contents_key() const;
virtual const std::tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 72330f6..cfa8dca 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -103,7 +103,6 @@ GemsRepository::GemsRepository(const gems::RepositoryParams & params) :
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)),
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 621db56..fdd577b 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -103,7 +103,6 @@ InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepository
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)),
diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc
index cf43057..e30b39f 100644
--- a/paludis/repositories/unavailable/unavailable_id.cc
+++ b/paludis/repositories/unavailable/unavailable_id.cc
@@ -220,12 +220,6 @@ UnavailableID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-UnavailableID::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
UnavailableID::provide_key() const
{
@@ -298,5 +292,11 @@ UnavailableID::from_repositories_key() const
return _imp->from_repositories_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+UnavailableID::choices_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >();
+}
+
template class PrivateImplementationPattern<UnavailableID>;
diff --git a/paludis/repositories/unavailable/unavailable_id.hh b/paludis/repositories/unavailable/unavailable_id.hh
index 970e6b1..a89512c 100644
--- a/paludis/repositories/unavailable/unavailable_id.hh
+++ b/paludis/repositories/unavailable/unavailable_id.hh
@@ -79,7 +79,6 @@ namespace paludis
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
virtual_for_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
@@ -102,6 +101,7 @@ namespace paludis
const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
bool supports_action(const SupportsActionTestBase &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index 1410f46..df910b8 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -97,7 +97,6 @@ UnavailableRepository::UnavailableRepository(const UnavailableRepositoryParams &
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)
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 536fe7c..93f6747 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -454,12 +454,6 @@ InstalledUnpackagedID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-InstalledUnpackagedID::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
InstalledUnpackagedID::provide_key() const
{
@@ -774,3 +768,8 @@ InstalledUnpackagedID::uninstall(const bool replace) const
}
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+InstalledUnpackagedID::choices_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >();
+}
diff --git a/paludis/repositories/unpackaged/installed_id.hh b/paludis/repositories/unpackaged/installed_id.hh
index d81a985..e1a5f8d 100644
--- a/paludis/repositories/unpackaged/installed_id.hh
+++ b/paludis/repositories/unpackaged/installed_id.hh
@@ -59,7 +59,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > contained_in_key() const;
@@ -76,6 +75,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index b7f601b..c0b32da 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -97,7 +97,6 @@ InstalledUnpackagedRepository::InstalledUnpackagedRepository(
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)
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 7ef9a18..b33c7da 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -394,8 +394,6 @@ namespace test_cases
TEST_CHECK(! FSEntry("installed_repository_TEST_dir/root4/dir").exists());
InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::checks>(iaco_default),
- value_for<n::debug_build>(iado_none),
value_for<n::destination>(repo),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -450,8 +448,6 @@ namespace test_cases
}
InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::checks>(iaco_default),
- value_for<n::debug_build>(iado_none),
value_for<n::destination>(repo),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -509,8 +505,6 @@ namespace test_cases
}
InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::checks>(iaco_default),
- value_for<n::debug_build>(iado_none),
value_for<n::destination>(repo),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 62bdf13..361aa60 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -38,6 +38,8 @@
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/choice.hh>
+#include <paludis/elike_choices.hh>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
@@ -60,6 +62,7 @@ namespace paludis
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key;
const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key;
+ const std::tr1::shared_ptr<const UnpackagedChoicesKey> choices_key;
Implementation(const Environment * const e,
const QualifiedPackageName & q,
@@ -69,7 +72,8 @@ namespace paludis
const FSEntry & l,
const std::string & b,
const std::string & r,
- const std::string & d) :
+ const std::string & d,
+ const UnpackagedID * const id) :
env(e),
name(q),
version(v),
@@ -82,7 +86,8 @@ namespace paludis
build_dependencies_labels, b)),
run_dependencies_key(new UnpackagedDependencyKey(env, "run_dependencies", "Run dependencies", mkt_dependencies,
run_dependencies_labels, r)),
- description_key(new LiteralMetadataValueKey<std::string> ("description", "Description", mkt_significant, d))
+ description_key(new LiteralMetadataValueKey<std::string> ("description", "Description", mkt_significant, d)),
+ choices_key(new UnpackagedChoicesKey(env, "choices", "Choices", mkt_normal, id))
{
build_dependencies_labels->push_back(make_shared_ptr(new DependencyBuildLabel("build_dependencies")));
run_dependencies_labels->push_back(make_shared_ptr(new DependencyRunLabel("run_dependencies")));
@@ -93,13 +98,14 @@ namespace paludis
UnpackagedID::UnpackagedID(const Environment * const e, const QualifiedPackageName & q,
const VersionSpec & v, const SlotName & s, const RepositoryName & n, const FSEntry & l,
const std::string & b, const std::string & r, const std::string & d) :
- PrivateImplementationPattern<UnpackagedID>(new Implementation<UnpackagedID>(e, q, v, s, n, l, b, r, d)),
+ PrivateImplementationPattern<UnpackagedID>(new Implementation<UnpackagedID>(e, q, v, s, n, l, b, r, d, this)),
_imp(PrivateImplementationPattern<UnpackagedID>::_imp)
{
add_metadata_key(_imp->fs_location_key);
add_metadata_key(_imp->build_dependencies_key);
add_metadata_key(_imp->run_dependencies_key);
add_metadata_key(_imp->description_key);
+ add_metadata_key(_imp->choices_key);
}
UnpackagedID::~UnpackagedID()
@@ -175,12 +181,6 @@ UnpackagedID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-UnpackagedID::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
UnpackagedID::provide_key() const
{
@@ -307,11 +307,17 @@ UnpackagedID::perform_action(Action & action) const
Log::get_instance()->message("unpackaged.libdir", ll_debug, lc_context) << "Using '" << libdir << "' for libdir";
+ std::tr1::shared_ptr<const ChoiceValue> strip_choice(choices_key()->value()->find_by_name_with_prefix(
+ ELikeStripChoiceValue::canonical_name_with_prefix()));
+ std::tr1::shared_ptr<const ChoiceValue> split_choice(choices_key()->value()->find_by_name_with_prefix(
+ ELikeSplitChoiceValue::canonical_name_with_prefix()));
+
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())
+ value_for<n::package_id>(shared_from_this()),
+ value_for<n::split>(split_choice && split_choice->enabled()),
+ value_for<n::strip>(strip_choice && strip_choice->enabled())
));
stripper.strip();
@@ -351,3 +357,9 @@ UnpackagedID::extra_hash_value() const
return Hash<SlotName>()(slot());
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+UnpackagedID::choices_key() const
+{
+ return _imp->choices_key;
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_id.hh b/paludis/repositories/unpackaged/unpackaged_id.hh
index a66a397..7e987d2 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.hh
+++ b/paludis/repositories/unpackaged/unpackaged_id.hh
@@ -57,7 +57,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > contained_in_key() const;
@@ -74,6 +73,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 8a8117e..6b0f761 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -20,9 +20,16 @@
#include <paludis/repositories/unpackaged/unpackaged_key.hh>
#include <paludis/repositories/unpackaged/dep_printer.hh>
#include <paludis/repositories/unpackaged/dep_parser.hh>
+#include <paludis/repositories/unpackaged/unpackaged_id.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/mutex.hh>
+#include <paludis/util/validated.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/choice.hh>
+#include <paludis/elike_choices.hh>
+#include <tr1/memory>
using namespace paludis;
using namespace paludis::unpackaged_repositories;
@@ -88,3 +95,51 @@ UnpackagedDependencyKey::initial_labels() const
return _imp->labels;
}
+namespace paludis
+{
+ template <>
+ struct Implementation<UnpackagedChoicesKey>
+ {
+ const Environment * const env;
+ const UnpackagedID * const id;
+
+ mutable Mutex mutex;
+ mutable std::tr1::shared_ptr<Choices> value;
+
+ Implementation(const Environment * const e, const UnpackagedID * const i) :
+ env(e),
+ id(i)
+ {
+ }
+ };
+}
+
+UnpackagedChoicesKey::UnpackagedChoicesKey(const Environment * const env, const std::string & r, const std::string & h,
+ const MetadataKeyType t, const UnpackagedID * const id) :
+ MetadataValueKey<std::tr1::shared_ptr<const Choices> >(r, h, t),
+ PrivateImplementationPattern<UnpackagedChoicesKey>(new Implementation<UnpackagedChoicesKey>(env, id)),
+ _imp(PrivateImplementationPattern<UnpackagedChoicesKey>::_imp)
+{
+}
+
+UnpackagedChoicesKey::~UnpackagedChoicesKey()
+{
+}
+
+const std::tr1::shared_ptr<const Choices>
+UnpackagedChoicesKey::value() const
+{
+ Lock lock(_imp->mutex);
+ if (! _imp->value)
+ {
+ _imp->value.reset(new Choices);
+ std::tr1::shared_ptr<Choice> build_options(new Choice(canonical_build_options_raw_name(), canonical_build_options_human_name(),
+ canonical_build_options_prefix(), false, false, false, false));
+ build_options->add(make_shared_ptr(new ELikeSplitChoiceValue(_imp->id->shared_from_this(), _imp->env, build_options)));
+ build_options->add(make_shared_ptr(new ELikeStripChoiceValue(_imp->id->shared_from_this(), _imp->env, build_options)));
+ _imp->value->add(build_options);
+ }
+
+ return _imp->value;
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_key.hh b/paludis/repositories/unpackaged/unpackaged_key.hh
index dc8a164..f06b585 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.hh
+++ b/paludis/repositories/unpackaged/unpackaged_key.hh
@@ -27,6 +27,8 @@ namespace paludis
{
namespace unpackaged_repositories
{
+ struct UnpackagedID;
+
class UnpackagedDependencyKey :
public MetadataSpecTreeKey<DependencySpecTree>,
private PrivateImplementationPattern<UnpackagedDependencyKey>
@@ -50,6 +52,22 @@ namespace paludis
virtual const std::tr1::shared_ptr<const DependencyLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class UnpackagedChoicesKey :
+ public MetadataValueKey<std::tr1::shared_ptr<const Choices> >,
+ private PrivateImplementationPattern<UnpackagedChoicesKey>
+ {
+ private:
+ PrivateImplementationPattern<UnpackagedChoicesKey>::ImpPtr & _imp;
+
+ public:
+ UnpackagedChoicesKey(const Environment * const env,
+ const std::string & r, const std::string & h, const MetadataKeyType t,
+ const UnpackagedID * const id);
+ ~UnpackagedChoicesKey();
+
+ virtual const std::tr1::shared_ptr<const Choices> value() const;
+ };
}
}
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index e4ea89c..92c4086 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -105,7 +105,6 @@ UnpackagedRepository::UnpackagedRepository(const RepositoryName & n,
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)
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index f9f88ae..069ea9d 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -225,8 +225,6 @@ namespace test_cases
*env[selection::RequireExactlyOne(generator::All())]->begin());
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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -280,8 +278,6 @@ namespace test_cases
*env[selection::RequireExactlyOne(generator::All())]->begin());
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),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.cc b/paludis/repositories/unpackaged/unpackaged_stripper.cc
index ec1313d..29b89e3 100644
--- a/paludis/repositories/unpackaged/unpackaged_stripper.cc
+++ b/paludis/repositories/unpackaged/unpackaged_stripper.cc
@@ -42,9 +42,10 @@ namespace paludis
UnpackagedStripper::UnpackagedStripper(const UnpackagedStripperOptions & options) :
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())
+ value_for<n::image_dir>(options.image_dir()),
+ value_for<n::split>(options.split()),
+ value_for<n::strip>(options.strip())
)),
PrivateImplementationPattern<UnpackagedStripper>(new Implementation<UnpackagedStripper>(options)),
_imp(PrivateImplementationPattern<UnpackagedStripper>::_imp)
diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.hh b/paludis/repositories/unpackaged/unpackaged_stripper.hh
index d0c42de..9d32c51 100644
--- a/paludis/repositories/unpackaged/unpackaged_stripper.hh
+++ b/paludis/repositories/unpackaged/unpackaged_stripper.hh
@@ -28,20 +28,22 @@ namespace paludis
{
namespace n
{
- struct debug_build;
struct debug_dir;
struct image_dir;
struct package_id;
+ struct split;
+ struct strip;
}
namespace unpackaged_repositories
{
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;
+ NamedValue<n::split, bool> split;
+ NamedValue<n::strip, bool> strip;
};
class UnpackagedStripper :
diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc
index bac29c6..109e300 100644
--- a/paludis/repositories/unwritten/unwritten_id.cc
+++ b/paludis/repositories/unwritten/unwritten_id.cc
@@ -219,12 +219,6 @@ UnwrittenID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-UnwrittenID::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
UnwrittenID::provide_key() const
{
@@ -297,6 +291,11 @@ UnwrittenID::from_repositories_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+UnwrittenID::choices_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >();
+}
template class PrivateImplementationPattern<UnwrittenID>;
diff --git a/paludis/repositories/unwritten/unwritten_id.hh b/paludis/repositories/unwritten/unwritten_id.hh
index ff1bb31..742b68d 100644
--- a/paludis/repositories/unwritten/unwritten_id.hh
+++ b/paludis/repositories/unwritten/unwritten_id.hh
@@ -85,7 +85,6 @@ namespace paludis
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
virtual_for_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
@@ -108,6 +107,7 @@ namespace paludis
const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
bool supports_action(const SupportsActionTestBase &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index 468a136..1e4f3eb 100644
--- a/paludis/repositories/unwritten/unwritten_repository.cc
+++ b/paludis/repositories/unwritten/unwritten_repository.cc
@@ -97,7 +97,6 @@ UnwrittenRepository::UnwrittenRepository(const UnwrittenRepositoryParams & p) :
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<UnwrittenRepository>::_imp)
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 08d49ec..4c5697a 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -120,7 +120,6 @@ InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * con
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>(
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index d5d5339..d41a235 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -246,12 +246,6 @@ VirtualsPackageID::keywords_key() const
return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
}
-const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >
-VirtualsPackageID::iuse_key() const
-{
- return std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> >();
-}
-
const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
VirtualsPackageID::provide_key() const
{
@@ -513,3 +507,9 @@ VirtualsPackageID::transient_key() const
return std::tr1::shared_ptr<const MetadataValueKey<bool> >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+VirtualsPackageID::choices_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >();
+}
+
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index d5b9104..094e9d4 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -85,7 +85,6 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > > virtual_for_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
- virtual const std::tr1::shared_ptr<const MetadataCollectionKey<IUseFlagSet> > iuse_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > build_dependencies_key() const;
virtual const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > run_dependencies_key() const;
@@ -102,6 +101,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 92db22c..89278ea 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -130,7 +130,6 @@ VirtualsRepository::VirtualsRepository(const Environment * const env) :
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>(
diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh
index afe692a..07ad9da 100644
--- a/paludis/repository-fwd.hh
+++ b/paludis/repository-fwd.hh
@@ -44,7 +44,6 @@ namespace paludis
class Repository;
class RepositorySetsInterface;
class RepositorySyncableInterface;
- class RepositoryUseInterface;
class RepositoryEnvironmentVariableInterface;
class RepositoryMirrorsInterface;
class RepositoryProvidesInterface;
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 1ebdabc..bd63915 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -180,10 +180,6 @@ RepositorySyncableInterface::~RepositorySyncableInterface()
{
}
-RepositoryUseInterface::~RepositoryUseInterface()
-{
-}
-
RepositoryEnvironmentVariableInterface::~RepositoryEnvironmentVariableInterface()
{
}
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 638a248..9ed986c 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -76,7 +76,6 @@ namespace paludis
struct sets_interface;
struct status;
struct syncable_interface;
- struct use_interface;
struct used_this_for_config_protect;
struct virtual_name;
struct virtuals_interface;
@@ -102,7 +101,6 @@ namespace paludis
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;
};
@@ -384,70 +382,6 @@ namespace paludis
};
/**
- * Interface for handling USE flags for the Repository class.
- *
- * \see Repository
- * \ingroup g_repository
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE RepositoryUseInterface
- {
- public:
- ///\name USE queries
- ///\{
-
- /**
- * Query the state of the specified use flag.
- */
- virtual UseFlagState query_use(const UseFlagName & u, const PackageID &) const = 0;
-
- /**
- * Query whether the specified use flag is masked.
- */
- virtual bool query_use_mask(const UseFlagName & u, const PackageID & pde) const = 0;
-
- /**
- * Query whether the specified use flag is forced.
- */
- virtual bool query_use_force(const UseFlagName & u, const PackageID & pde) const = 0;
-
- /**
- * Fetch all arch flags.
- */
- virtual std::tr1::shared_ptr<const UseFlagNameSet> arch_flags() const = 0;
-
- /**
- * Fetch all expand flags.
- */
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_flags() const = 0;
-
- /**
- * Fetch all expand hidden flags.
- */
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_hidden_prefixes() const = 0;
-
- /**
- * Fetch all use expand prefixes.
- */
- virtual std::tr1::shared_ptr<const UseFlagNameSet> use_expand_prefixes() const = 0;
-
- /**
- * Fetch the use expand separator (eg _ or :) for the
- * specified package, or null if unknown.
- */
- virtual char use_expand_separator(const PackageID & pkg) const = 0;
-
- /**
- * Describe a use flag.
- */
- virtual std::string describe_use_flag(const UseFlagName & n, const PackageID & pkg) const = 0;
-
- ///\}
-
- virtual ~RepositoryUseInterface();
- };
-
- /**
* Interface for package sets for repositories.
*
* \see Repository
@@ -711,7 +645,7 @@ namespace paludis
virtual ProfilesConstIterator find_profile(const FSEntry & location) const = 0;
virtual void set_profile(const ProfilesConstIterator & iter) = 0;
- virtual void set_profile_by_arch(const UseFlagName &) = 0;
+ virtual void set_profile_by_arch(const std::string &) = 0;
///\}
diff --git a/paludis/stringify_formatter-impl.hh b/paludis/stringify_formatter-impl.hh
index 3831f9f..12aa5d3 100644
--- a/paludis/stringify_formatter-impl.hh
+++ b/paludis/stringify_formatter-impl.hh
@@ -43,8 +43,7 @@ namespace paludis
struct Implementation<StringifyFormatter>
{
const CanFormat<std::string> * const f_str;
- const CanFormat<IUseFlag> * const f_iuse;
- const CanFormat<UseFlagName> * const f_use;
+ const CanFormat<ChoiceValue> * const f_conf;
const CanFormat<KeywordName> * const f_keyword;
const CanFormat<PackageDepSpec> * const f_package;
const CanFormat<BlockDepSpec> * const f_block;
@@ -58,12 +57,12 @@ namespace paludis
const CanFormat<NamedSetDepSpec> * const f_named;
const CanFormat<FSEntry> * const f_fsentry;
const CanFormat<PackageID> * const f_package_id;
+ const CanFormat<PlainTextLabelDepSpec> * const f_plain_label;
const CanSpace * const f_space;
Implementation(
const CanFormat<std::string> * const f_str_v,
- const CanFormat<IUseFlag> * const f_iuse_v,
- const CanFormat<UseFlagName> * const f_use_v,
+ const CanFormat<ChoiceValue> * const f_conf_v,
const CanFormat<KeywordName> * const f_keyword_v,
const CanFormat<PackageDepSpec> * const f_package_v,
const CanFormat<BlockDepSpec> * const f_block_v,
@@ -77,11 +76,11 @@ namespace paludis
const CanFormat<NamedSetDepSpec> * const f_named_v,
const CanFormat<FSEntry> * const f_fsentry_v,
const CanFormat<PackageID> * const f_package_id_v,
+ const CanFormat<PlainTextLabelDepSpec> * const f_plain_label_v,
const CanSpace * const f_space_v
) :
f_str(f_str_v),
- f_iuse(f_iuse_v),
- f_use(f_use_v),
+ f_conf(f_conf_v),
f_keyword(f_keyword_v),
f_package(f_package_v),
f_block(f_block_v),
@@ -95,6 +94,7 @@ namespace paludis
f_named(f_named_v),
f_fsentry(f_fsentry_v),
f_package_id(f_package_id_v),
+ f_plain_label(f_plain_label_v),
f_space(f_space_v)
{
}
@@ -184,8 +184,7 @@ namespace paludis
StringifyFormatter::StringifyFormatter(const T_ & t) :
PrivateImplementationPattern<StringifyFormatter>(new Implementation<StringifyFormatter>(
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<std::string> *>::value, std::string>::get(&t),
- StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<IUseFlag> *>::value, IUseFlag>::get(&t),
- StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<UseFlagName> *>::value, UseFlagName>::get(&t),
+ StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<ChoiceValue> *>::value, ChoiceValue>::get(&t),
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<KeywordName> *>::value, KeywordName>::get(&t),
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<PackageDepSpec> *>::value, PackageDepSpec>::get(&t),
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<BlockDepSpec> *>::value, BlockDepSpec>::get(&t),
@@ -211,6 +210,7 @@ namespace paludis
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<NamedSetDepSpec> *>::value, NamedSetDepSpec>::get(&t),
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<FSEntry> *>::value, FSEntry>::get(&t),
StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<PackageID> *>::value, PackageID>::get(&t),
+ StringifyFormatterGetForwarder<std::tr1::is_convertible<T_ *, CanFormat<PlainTextLabelDepSpec> *>::value, PlainTextLabelDepSpec>::get(&t),
StringifyFormatterGetSpaceForwarder<std::tr1::is_convertible<T_ *, CanSpace *>::value>::get(&t)
)),
CanSpace()
diff --git a/paludis/stringify_formatter.cc b/paludis/stringify_formatter.cc
index 6d36a6f..36e39ab 100644
--- a/paludis/stringify_formatter.cc
+++ b/paludis/stringify_formatter.cc
@@ -23,6 +23,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/dep_spec.hh>
#include <paludis/dep_label.hh>
+#include <paludis/choice.hh>
using namespace paludis;
@@ -45,102 +46,6 @@ StringifyFormatter::format(const std::string & s, const format::Plain & k) const
}
std::string
-StringifyFormatter::format(const UseFlagName & s, const format::Enabled & k) const
-{
- if (_imp->f_use)
- return _imp->f_use->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const UseFlagName & s, const format::Disabled & k) const
-{
- if (_imp->f_use)
- return _imp->f_use->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const UseFlagName & s, const format::Forced & k) const
-{
- if (_imp->f_use)
- return _imp->f_use->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const UseFlagName & s, const format::Masked & k) const
-{
- if (_imp->f_use)
- return _imp->f_use->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const UseFlagName & s, const format::Plain & k) const
-{
- if (_imp->f_use)
- return _imp->f_use->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const IUseFlag & s, const format::Enabled & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const IUseFlag & s, const format::Disabled & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const IUseFlag & s, const format::Forced & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const IUseFlag & s, const format::Masked & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::decorate(const IUseFlag & f, const std::string & s, const format::Changed & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->decorate(f, s, k);
- return s;
-}
-
-std::string
-StringifyFormatter::decorate(const IUseFlag & f, const std::string & s, const format::Added & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->decorate(f, s, k);
- return s;
-}
-
-std::string
-StringifyFormatter::format(const IUseFlag & s, const format::Plain & k) const
-{
- if (_imp->f_iuse)
- return _imp->f_iuse->format(s, k);
- return stringify(s);
-}
-
-std::string
StringifyFormatter::format(const KeywordName & s, const format::Accepted & k) const
{
if (_imp->f_keyword)
@@ -277,6 +182,14 @@ StringifyFormatter::format(const URILabelsDepSpec & s, const format::Plain & k)
}
std::string
+StringifyFormatter::format(const PlainTextLabelDepSpec & s, const format::Plain & k) const
+{
+ if (_imp->f_plain_label)
+ return _imp->f_plain_label->format(s, k);
+ return stringify(s);
+}
+
+std::string
StringifyFormatter::format(const PlainTextDepSpec & s, const format::Plain & k) const
{
if (_imp->f_plain)
@@ -285,6 +198,62 @@ StringifyFormatter::format(const PlainTextDepSpec & s, const format::Plain & k)
}
std::string
+StringifyFormatter::format(const ChoiceValue & s, const format::Enabled & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->format(s, k);
+ return stringify(s.name_with_prefix());
+}
+
+std::string
+StringifyFormatter::format(const ChoiceValue & s, const format::Disabled & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->format(s, k);
+ return stringify(s.name_with_prefix());
+}
+
+std::string
+StringifyFormatter::format(const ChoiceValue & s, const format::Forced & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->format(s, k);
+ return stringify(s.name_with_prefix());
+}
+
+std::string
+StringifyFormatter::format(const ChoiceValue & s, const format::Masked & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->format(s, k);
+ return stringify(s.name_with_prefix());
+}
+
+std::string
+StringifyFormatter::format(const ChoiceValue & s, const format::Plain & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->format(s, k);
+ return stringify(s.name_with_prefix());
+}
+
+std::string
+StringifyFormatter::decorate(const ChoiceValue & s, const std::string & t, const format::Changed & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->decorate(s, t, k);
+ return t;
+}
+
+std::string
+StringifyFormatter::decorate(const ChoiceValue & s, const std::string & t, const format::Added & k) const
+{
+ if (_imp->f_conf)
+ return _imp->f_conf->decorate(s, t, k);
+ return t;
+}
+
+std::string
StringifyFormatter::format(const ConditionalDepSpec & s, const format::Enabled & k) const
{
if (_imp->f_use_dep)
@@ -317,18 +286,34 @@ StringifyFormatter::format(const ConditionalDepSpec & s, const format::Masked &
}
std::string
-StringifyFormatter::format(const FSEntry & s, const format::Plain & k) const
+StringifyFormatter::format(const ConditionalDepSpec & s, const format::Plain & k) const
{
- if (_imp->f_fsentry)
- return _imp->f_fsentry->format(s, k);
+ if (_imp->f_use_dep)
+ return _imp->f_use_dep->format(s, k);
return stringify(s);
}
std::string
-StringifyFormatter::format(const ConditionalDepSpec & s, const format::Plain & k) const
+StringifyFormatter::decorate(const ConditionalDepSpec & s, const std::string & t, const format::Changed & k) const
{
if (_imp->f_use_dep)
- return _imp->f_use_dep->format(s, k);
+ return _imp->f_use_dep->decorate(s, t, k);
+ return t;
+}
+
+std::string
+StringifyFormatter::decorate(const ConditionalDepSpec & s, const std::string & t, const format::Added & k) const
+{
+ if (_imp->f_use_dep)
+ return _imp->f_use_dep->decorate(s, t, k);
+ return t;
+}
+
+std::string
+StringifyFormatter::format(const FSEntry & s, const format::Plain & k) const
+{
+ if (_imp->f_fsentry)
+ return _imp->f_fsentry->format(s, k);
return stringify(s);
}
diff --git a/paludis/stringify_formatter.hh b/paludis/stringify_formatter.hh
index 3447547..63ad5ed 100644
--- a/paludis/stringify_formatter.hh
+++ b/paludis/stringify_formatter.hh
@@ -60,8 +60,7 @@ namespace paludis
class PALUDIS_VISIBLE StringifyFormatter :
private PrivateImplementationPattern<StringifyFormatter>,
public CanFormat<std::string>,
- public CanFormat<UseFlagName>,
- public CanFormat<IUseFlag>,
+ public CanFormat<ChoiceValue>,
public CanFormat<KeywordName>,
public CanFormat<PackageDepSpec>,
public CanFormat<BlockDepSpec>,
@@ -75,6 +74,7 @@ namespace paludis
public CanFormat<NamedSetDepSpec>,
public CanFormat<FSEntry>,
public CanFormat<PackageID>,
+ public CanFormat<PlainTextLabelDepSpec>,
public CanSpace
{
private:
@@ -98,19 +98,13 @@ namespace paludis
virtual std::string format(const std::string &, const format::Plain &) const;
- virtual std::string format(const UseFlagName &, const format::Enabled &) const;
- virtual std::string format(const UseFlagName &, const format::Disabled &) const;
- virtual std::string format(const UseFlagName &, const format::Forced &) const;
- virtual std::string format(const UseFlagName &, const format::Masked &) const;
- virtual std::string format(const UseFlagName &, const format::Plain &) const;
-
- virtual std::string format(const IUseFlag &, const format::Enabled &) const;
- virtual std::string format(const IUseFlag &, const format::Disabled &) const;
- virtual std::string format(const IUseFlag &, const format::Forced &) const;
- virtual std::string format(const IUseFlag &, const format::Masked &) const;
- virtual std::string format(const IUseFlag &, const format::Plain &) const;
- virtual std::string decorate(const IUseFlag &, const std::string &, const format::Changed &) const;
- virtual std::string decorate(const IUseFlag &, const std::string &, const format::Added &) const;
+ virtual std::string format(const ChoiceValue &, const format::Enabled &) const;
+ virtual std::string format(const ChoiceValue &, const format::Disabled &) const;
+ virtual std::string format(const ChoiceValue &, const format::Forced &) const;
+ virtual std::string format(const ChoiceValue &, const format::Masked &) const;
+ virtual std::string format(const ChoiceValue &, const format::Plain &) const;
+ virtual std::string decorate(const ChoiceValue &, const std::string &, const format::Changed &) const;
+ virtual std::string decorate(const ChoiceValue &, const std::string &, const format::Added &) const;
virtual std::string format(const KeywordName &, const format::Accepted &) const;
virtual std::string format(const KeywordName &, const format::Unaccepted &) const;
@@ -143,6 +137,8 @@ namespace paludis
virtual std::string format(const ConditionalDepSpec &, const format::Forced &) const;
virtual std::string format(const ConditionalDepSpec &, const format::Masked &) const;
virtual std::string format(const ConditionalDepSpec &, const format::Plain &) const;
+ virtual std::string decorate(const ConditionalDepSpec &, const std::string &, const format::Changed &) const;
+ virtual std::string decorate(const ConditionalDepSpec &, const std::string &, const format::Added &) const;
virtual std::string format(const FSEntry &, const format::Plain &) const;
@@ -150,6 +146,8 @@ namespace paludis
virtual std::string format(const PackageID &, const format::Installed &) const;
virtual std::string format(const PackageID &, const format::Installable &) const;
+ virtual std::string format(const PlainTextLabelDepSpec &, const format::Plain &) const;
+
virtual std::string newline() const;
virtual std::string indent(const int) const;
};
diff --git a/paludis/stringify_formatter_TEST.cc b/paludis/stringify_formatter_TEST.cc
index 5450f16..c43969e 100644
--- a/paludis/stringify_formatter_TEST.cc
+++ b/paludis/stringify_formatter_TEST.cc
@@ -25,6 +25,7 @@
#include <paludis/dep_tree.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/environments/test/test_environment.hh>
+#include <paludis/choice.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <paludis/util/clone-impl.hh>
@@ -34,10 +35,10 @@ using namespace paludis;
namespace
{
- std::string format_two(const KeywordName & k, const UseFlagName & n,
- const Formatter<KeywordName, UseFlagName> & f)
+ std::string format_two(const KeywordName & k, const LicenseDepSpec & n,
+ const Formatter<KeywordName, LicenseDepSpec> & f)
{
- return f.format(k, format::Accepted()) + " " + f.format(n, format::Enabled());
+ return f.format(k, format::Accepted()) + " " + f.format(n, format::Accepted());
}
std::string format_three(const PackageDepSpec & k, const BlockDepSpec & d, const NamedSetDepSpec & u,
@@ -99,7 +100,7 @@ namespace test_cases
void run()
{
StringifyFormatter ff;
- std::string s(format_two(KeywordName("one"), UseFlagName("two"), ff));
+ std::string s(format_two(KeywordName("one"), LicenseDepSpec("two"), ff));
TEST_CHECK_EQUAL(s, "one two");
}
} test_stringify_formatter;
@@ -126,3 +127,4 @@ namespace test_cases
} test_stringify_formatter_partial;
}
+
diff --git a/paludis/stripper.cc b/paludis/stripper.cc
index 64b317f..397e036 100644
--- a/paludis/stripper.cc
+++ b/paludis/stripper.cc
@@ -65,7 +65,7 @@ Stripper::strip()
{
Context context("When stripping image '" + stringify(_imp->options.image_dir()) + "':");
- if (_imp->options.debug_build() == iado_internal)
+ if (! _imp->options.strip())
return;
do_dir_recursive(_imp->options.image_dir());
@@ -148,19 +148,11 @@ Stripper::do_split(const FSEntry & f, const FSEntry & g)
{
Context context("When splitting '" + stringify(f) + "' to '" + stringify(g) + "':");
- switch (_imp->options.debug_build())
- {
- case iado_internal:
- case last_iado:
- return;
-
- case iado_none:
- do_strip(f, "");
- return;
+ if (_imp->options.strip())
+ do_strip(f, "");
- case iado_split:
- break;
- }
+ if (! _imp->options.split())
+ return;
on_split(f, g);
diff --git a/paludis/stripper.hh b/paludis/stripper.hh
index 4063175..f5d16d8 100644
--- a/paludis/stripper.hh
+++ b/paludis/stripper.hh
@@ -31,16 +31,18 @@ namespace paludis
{
namespace n
{
- struct debug_build;
struct debug_dir;
struct image_dir;
+ struct split;
+ struct strip;
}
struct StripperOptions
{
- NamedValue<n::debug_build, InstallActionDebugOption> debug_build;
NamedValue<n::debug_dir, FSEntry> debug_dir;
NamedValue<n::image_dir, FSEntry> image_dir;
+ NamedValue<n::split, bool> split;
+ NamedValue<n::strip, bool> strip;
};
class PALUDIS_VISIBLE Stripper :
diff --git a/paludis/stripper_TEST.cc b/paludis/stripper_TEST.cc
index 1b8b959..4842b9f 100644
--- a/paludis/stripper_TEST.cc
+++ b/paludis/stripper_TEST.cc
@@ -69,9 +69,10 @@ namespace test_cases
void run()
{
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())
+ value_for<n::image_dir>(FSEntry("stripper_TEST_dir/image").realpath()),
+ value_for<n::split>(true),
+ value_for<n::strip>(true)
));
s.strip();
diff --git a/python/action.cc b/python/action.cc
index 1666ba1..dc59cd1 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -55,12 +55,9 @@ namespace
}
InstallActionOptions * make_install_action_options(
- const InstallActionChecksOption & c, const InstallActionDebugOption & d,
const std::tr1::shared_ptr<paludis::Repository> & r)
{
return new InstallActionOptions(make_named_values<InstallActionOptions>(
- value_for<n::checks>(c),
- value_for<n::debug_build>(d),
value_for<n::destination>(r),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect)
));
@@ -112,18 +109,6 @@ void expose_action()
"Thrown if a configure fails.");
/**
- * Enums
- */
- enum_auto("InstallActionDebugOption", last_iado,
- "Debug build mode for an InstallAction.\n\n"
- "May be ignored by some repositories, and by packages where there\n"
- "isn't a sensible concept of debugging.");
-
- enum_auto("InstallActionChecksOption", last_iaco,
- "Whether to run post-build checks (for example, 'make check' or 'src_test'),\n"
- "if they are available.");
-
- /**
* InstallActionOptions
*/
bp::class_<InstallActionOptions>
@@ -135,21 +120,9 @@ void expose_action()
.def("__init__",
bp::make_constructor(&make_install_action_options),
- "__init__(InstallActionChecksOption, InstallActionDebugOption, Repository)"
+ "__init__(Repository)"
)
- .add_property("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",
- &named_values_getter<InstallActionOptions, n::checks, InstallActionChecksOption, &InstallActionOptions::checks>,
- &named_values_setter<InstallActionOptions, n::checks, InstallActionChecksOption, &InstallActionOptions::checks>,
- "[rw] InstallActionChecksOption"
- )
-
.add_property("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>,
diff --git a/python/action_TEST.py b/python/action_TEST.py
index 42f8953..51d14d7 100755
--- a/python/action_TEST.py
+++ b/python/action_TEST.py
@@ -31,24 +31,17 @@ class TestCase_01_InstallActionOptions(unittest.TestCase):
repo2 = FakeRepository(env, "2")
def test_01_create(self):
- InstallActionOptions(InstallActionChecksOption.values[0], InstallActionDebugOption.values[0], repo1)
+ InstallActionOptions(repo1)
def test_02_data_members(self):
- iao = InstallActionOptions(InstallActionChecksOption.values[0],
- InstallActionDebugOption.values[0], repo1)
+ iao = InstallActionOptions(repo1)
- self.assertEquals(iao.debug_build, InstallActionDebugOption.values[0])
- self.assertEquals(iao.checks, InstallActionChecksOption.values[0])
self.assertEquals(str(iao.destination.name), "1")
iao.no_config_protect = False
- iao.debug_build = InstallActionDebugOption.values[1]
- iao.checks = InstallActionChecksOption.values[1]
iao.destination = repo2
self.assertEquals(iao.no_config_protect, False)
- self.assertEquals(iao.debug_build, InstallActionDebugOption.values[1])
- self.assertEquals(iao.checks, InstallActionChecksOption.values[1])
self.assertEquals(str(iao.destination.name), "2")
class TestCase_02_FetchActionOptions(unittest.TestCase):
@@ -71,8 +64,7 @@ class TestCase_04_InstallAction(unittest.TestCase):
def test_01_create(self):
env = TestEnvironment()
repo1 = FakeRepository(env, "1")
- iao = InstallActionOptions(InstallActionChecksOption.values[0],
- InstallActionDebugOption.values[0], repo1)
+ iao = InstallActionOptions(repo1)
InstallAction(iao)
class TestCase_05_FetchAction(unittest.TestCase):
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index 9cf737e..c5f60ee 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -50,11 +50,6 @@ namespace environment
std::tr1::shared_ptr<PackageID> pid(repo->add_version("cat", "pkg", "1.0"));
e.package_database()->add_repository(0, repo);
- UseFlagName u("use");
- bool PALUDIS_ATTRIBUTE((unused)) b1(e.query_use(u, *pid));
-
- e.known_use_expand_names(u, *pid);
-
bool PALUDIS_ATTRIBUTE((unused)) b2(e.accept_license("l", *pid));
std::tr1::shared_ptr<KeywordNameSet> kns(new KeywordNameSet);
@@ -196,21 +191,6 @@ namespace metadata_key
m.pretty_print_flat(ff);
}
- template <>
- void test_metadata_set_key(const MetadataCollectionKey<IUseFlagSet> & m)
- {
- test_metadata_key(m);
- m.value();
- StringifyFormatter ff;
- m.pretty_print_flat(ff);
-
- TestEnvironment e;
- std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&e, RepositoryName("fakerepo")));
- std::tr1::shared_ptr<PackageID> pid(repo->add_version("cat", "pkg", "1.0"));
-
- m.pretty_print_flat_with_comparison(&e, pid, ff);
- }
-
template <typename C_>
void test_metadata_spec_tree_key(const MetadataSpecTreeKey<C_> & m)
{
@@ -253,30 +233,6 @@ namespace formatter
f.format(k, Unaccepted());
}
- // CanFormat for UseRoles
- void test_use_roles(CanFormat<UseFlagName> & f)
- {
- UseFlagName u("use");
- f.format(u, Plain());
- f.format(u, Enabled());
- f.format(u, Disabled());
- f.format(u, Forced());
- f.format(u, Masked());
- }
-
- // CanFormat for IUseRoles
- void test_iuse_roles(CanFormat<IUseFlag> & f)
- {
- IUseFlag u("iuse_flag", IUseFlagParseOptions(), 1);
- f.format(u, Plain());
- f.format(u, Enabled());
- f.format(u, Disabled());
- f.format(u, Forced());
- f.format(u, Masked());
- f.decorate(u, "%", Added());
- f.decorate(u, "*", Changed());
- }
-
// CanFormat for PackageRoles
void test_package_roles(CanFormat<PackageDepSpec> & f)
{
@@ -302,14 +258,6 @@ namespace formatter
{
}
- void test_formatter_use_flag_name(const Formatter<UseFlagName> &)
- {
- }
-
- void test_formatter_iuse_flag(const Formatter<IUseFlag> &)
- {
- }
-
void test_formatter_license_spec_tree(const LicenseSpecTree::ItemFormatter &)
{
}
@@ -360,8 +308,6 @@ void expose_additional_tests()
bp::def("test_metadata_contents_key", &metadata_key::test_metadata_contents_key);
bp::def("test_metadata_repository_mask_info_key", &metadata_key::test_metadata_repository_mask_info_key);
bp::def("test_metadata_keyword_name_set_key", &metadata_key::test_metadata_set_key<KeywordNameSet>);
- bp::def("test_metadata_use_flag_name_set_key", &metadata_key::test_metadata_set_key<UseFlagNameSet>);
- bp::def("test_metadata_iuse_flag_set_key", &metadata_key::test_metadata_set_key<IUseFlagSet>);
bp::def("test_metadata_string_set_key", &metadata_key::test_metadata_set_key<Set<std::string> >);
bp::def("test_metadata_license_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<LicenseSpecTree>);
bp::def("test_metadata_provide_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<ProvideSpecTree>);
@@ -376,15 +322,11 @@ void expose_additional_tests()
*/
bp::def("test_plain_roles", &formatter::test_plain_roles);
bp::def("test_acceptable_roles", &formatter::test_acceptable_roles);
- bp::def("test_use_roles", &formatter::test_use_roles);
- bp::def("test_iuse_roles", &formatter::test_iuse_roles);
bp::def("test_package_roles", &formatter::test_package_roles);
bp::def("test_can_space", &formatter::test_can_space);
bp::def("test_formatter_string", &formatter::test_formatter_string);
bp::def("test_formmater_keyword_name", &formatter::test_formmater_keyword_name);
- bp::def("test_formatter_use_flag_name", &formatter::test_formatter_use_flag_name);
- bp::def("test_formatter_iuse_flag", &formatter::test_formatter_iuse_flag);
bp::def("test_formatter_license_spec_tree", &formatter::test_formatter_license_spec_tree);
bp::def("test_formatter_provide_spec_tree", &formatter::test_formatter_provide_spec_tree);
bp::def("test_formatter_dependency_spec_tree", &formatter::test_formatter_dependency_spec_tree);
diff --git a/python/dep_spec.cc b/python/dep_spec.cc
index 9cdf3a6..358dd18 100644
--- a/python/dep_spec.cc
+++ b/python/dep_spec.cc
@@ -547,6 +547,16 @@ PythonURILabelsDepSpec::PythonURILabelsDepSpec(const URILabelsDepSpec &)
{
}
+PythonPlainTextLabelDepSpec::PythonPlainTextLabelDepSpec(const std::string & s) :
+ PythonStringDepSpec(s)
+{
+}
+
+PythonPlainTextLabelDepSpec::PythonPlainTextLabelDepSpec(const PlainTextLabelDepSpec & s) :
+ PythonStringDepSpec(s.text())
+{
+}
+
PythonDependencyLabelsDepSpec::PythonDependencyLabelsDepSpec(const std::string &)
{
}
@@ -646,6 +656,12 @@ SpecTreeToPython::visit_leaf(const URILabelsDepSpec & d)
}
void
+SpecTreeToPython::visit_leaf(const PlainTextLabelDepSpec & d)
+{
+ _current_parent->add_child(make_shared_ptr(new PythonPlainTextLabelDepSpec(d)));
+}
+
+void
SpecTreeToPython::visit_leaf(const DependencyLabelsDepSpec & d)
{
_current_parent->add_child(make_shared_ptr(new PythonDependencyLabelsDepSpec(d)));
@@ -700,6 +716,7 @@ struct AllowedTypes<PlainTextSpecTree>
AllowedTypes(const AllDepSpec &) {};
AllowedTypes(const ConditionalDepSpec &) {};
AllowedTypes(const PlainTextDepSpec &) {};
+ AllowedTypes(const PlainTextLabelDepSpec &) {};
};
template<>
@@ -848,6 +865,13 @@ SpecTreeFromPython<H_>::visit(const PythonURILabelsDepSpec & d)
template <typename H_>
void
+SpecTreeFromPython<H_>::visit(const PythonPlainTextLabelDepSpec & d)
+{
+ dispatch<H_, PlainTextLabelDepSpec>(this, d);
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::visit(const PythonDependencyLabelsDepSpec & d)
{
dispatch<H_, DependencyLabelsDepSpec>(this, d);
@@ -961,6 +985,13 @@ SpecTreeFromPython<H_>::real_visit(const PythonURILabelsDepSpec &)
template <typename H_>
void
+SpecTreeFromPython<H_>::real_visit(const PythonPlainTextLabelDepSpec & s)
+{
+ _add(make_shared_ptr(new TreeLeaf<H_, PlainTextLabelDepSpec>(make_shared_ptr(new PlainTextLabelDepSpec(s.text())))));
+}
+
+template <typename H_>
+void
SpecTreeFromPython<H_>::real_visit(const PythonDependencyLabelsDepSpec &)
{
_add(make_shared_ptr(new TreeLeaf<H_, DependencyLabelsDepSpec>(make_shared_ptr(
diff --git a/python/dep_spec.hh b/python/dep_spec.hh
index cdad863..a649480 100644
--- a/python/dep_spec.hh
+++ b/python/dep_spec.hh
@@ -41,6 +41,7 @@ namespace paludis
class PythonSimpleURIDepSpec;
class PythonBlockDepSpec;
class PythonURILabelsDepSpec;
+ class PythonPlainTextLabelDepSpec;
class PythonDependencyLabelsDepSpec;
class PythonNamedSetDepSpec;
@@ -58,6 +59,7 @@ namespace paludis
PythonFetchableURIDepSpec,
PythonSimpleURIDepSpec,
PythonURILabelsDepSpec,
+ PythonPlainTextLabelDepSpec,
PythonDependencyLabelsDepSpec,
PythonNamedSetDepSpec
>
@@ -264,6 +266,15 @@ namespace paludis
PythonURILabelsDepSpec(const URILabelsDepSpec &);
};
+ class PALUDIS_VISIBLE PythonPlainTextLabelDepSpec :
+ public PythonStringDepSpec,
+ public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonPlainTextLabelDepSpec>
+ {
+ public:
+ PythonPlainTextLabelDepSpec(const std::string &);
+ PythonPlainTextLabelDepSpec(const PlainTextLabelDepSpec &);
+ };
+
class PALUDIS_VISIBLE PythonDependencyLabelsDepSpec :
public PythonDepSpec,
public ConstAcceptInterfaceVisitsThis<PythonDepSpecVisitorTypes, PythonDependencyLabelsDepSpec>
@@ -314,6 +325,8 @@ namespace paludis
void visit_leaf(const LicenseDepSpec &);
+ void visit_leaf(const PlainTextLabelDepSpec &);
+
void visit_leaf(const URILabelsDepSpec &);
void visit_leaf(const DependencyLabelsDepSpec &);
@@ -350,6 +363,7 @@ namespace paludis
void visit(const PythonFetchableURIDepSpec &);
void visit(const PythonLicenseDepSpec &);
void visit(const PythonURILabelsDepSpec &);
+ void visit(const PythonPlainTextLabelDepSpec &);
void visit(const PythonDependencyLabelsDepSpec &);
void visit(const PythonNamedSetDepSpec &);
@@ -362,6 +376,7 @@ namespace paludis
void real_visit(const PythonFetchableURIDepSpec &);
void real_visit(const PythonSimpleURIDepSpec &);
void real_visit(const PythonURILabelsDepSpec &);
+ void real_visit(const PythonPlainTextLabelDepSpec &);
void real_visit(const PythonDependencyLabelsDepSpec &);
void real_visit(const PythonLicenseDepSpec &);
void real_visit(const PythonNamedSetDepSpec &);
diff --git a/python/environment.cc b/python/environment.cc
index ea1d40f..85450c0 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -31,6 +31,7 @@
#include <paludis/package_id.hh>
#include <paludis/selection.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/tribool.hh>
#include <paludis/util/make_shared_ptr.hh>
using namespace paludis;
@@ -57,34 +58,6 @@ class EnvironmentImplementationWrapper :
{
}
- virtual bool query_use(const UseFlagName & u, const PackageID & p) const
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- Lock l(get_mutex());
-
- if (bp::override f = get_override("query_use"))
- return f(boost::cref(u), boost::cref(p));
- return EnvironmentImplementation::query_use(u, p);
- }
-
- bool default_query_use(const UseFlagName & u, const PackageID & p) const
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- return EnvironmentImplementation::query_use(u, p);
- }
-
- virtual std::tr1::shared_ptr<const UseFlagNameSet> known_use_expand_names(
- const UseFlagName & u, const PackageID & p) const
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- Lock l(get_mutex());
-
- if (bp::override f = get_override("known_use_expand_names"))
- return f(boost::cref(u), boost::cref(p));
- else
- throw PythonMethodNotImplemented("EnvironmentImplementation", "known_use_expand_names");
- }
-
virtual bool accept_license(const std::string & s, const PackageID & p) const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
@@ -435,6 +408,23 @@ class EnvironmentImplementationWrapper :
else
throw PythonMethodNotImplemented("EnvironmentImplementation", "config_location_key");
}
+
+ virtual const Tribool want_choice_enabled(
+ const std::tr1::shared_ptr<const PackageID> &,
+ const std::tr1::shared_ptr<const Choice> &,
+ const UnprefixedChoiceName &
+ ) const
+ {
+ throw PythonMethodNotImplemented("EnvironmentImplementation", "want_choice_enabled");
+ }
+
+ virtual std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > known_choice_value_names(
+ const std::tr1::shared_ptr<const PackageID> &,
+