aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
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 /paludis/repositories
parent95de300935276509248c6ad2f6a08bf458ef290c (diff)
downloadpaludis-7cd0c2d122a5b38c5a925dac52b429c99e7f5085.tar.gz
paludis-7cd0c2d122a5b38c5a925dac52b429c99e7f5085.tar.xz
Paludis is about choices.
Diffstat (limited to 'paludis/repositories')
-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.se22
-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
99 files changed, 2028 insertions, 1492 deletions
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index e29806a16..955b8688f 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 0212b7319..ce88c49ea 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 daaecc32e..cff80a071 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 9d6875840..9af059508 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 f8e30b901..08d30b63c 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 b1c803067..8668f99d2 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 506dd0973..d00f95536 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 7cd184f0f..72f962494 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 e563f826d..949dd9abe 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 000000000..dbc5766ac
--- /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 000000000..a1870bab5
--- /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 4e7b2d10b..9425199f1 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 d23b7beb3..5b0049dd8 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 4c4dd0f2e..e7abc8e5b 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 faec33401..8b22ea62e 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 8e9ed36a6..40caed6cf 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 5c3738ac4..a5958ad26 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 ea43aa95e..55bcc9251 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 6ed3cd3ea..f08302018 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 c9dc9ea90..5a1d1f8ca 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 25201c0c0..1060cd210 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 e564ddb10..3b6b8b00c 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 4c0480aa0..0ca03bb4d 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 b68912875..3dcded6bd 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 23c24e515..ada048422 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 7bbd33c37..c1dfb51b6 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 37c89b025..f9e0fd7d9 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 69052b217..8af57371a 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 885cc3838..6802b83ef 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 9aedde9a8..58927f6eb 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 96fc3db72..57aae5cee 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 fe4d0fe56..62eff92b5 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 ca698d059..050090149 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 a44727bee..8fe380c77 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 d39e5ce3e..4315adfd3 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 1610463eb..e7074c109 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 e96dfad1d..ca8937a1a 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 c704ec7a2..c1f155e88 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 160495dd6..ec0543db6 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 0f5b42761..543f16880 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 d90872cc6..854df12c8 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 4448c2f63..89d1c325c 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 fd9964ff1..6f83570dc 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 9cbe39b9e..d1cb72056 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 d2f405454..4e71eb0d1 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 37d7af9df..a33845f46 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 7327eea47..66dec5c13 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 5a58f4939..14b162c27 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 000000000..7e6f5b1c9
--- /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 000000000..5ad29e8e2
--- /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/repositories/e/iuse.se b/paludis/repositories/e/iuse.se
new file mode 100644
index 000000000..fa0dc44e0
--- /dev/null
+++ b/paludis/repositories/e/iuse.se
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+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"
+
+ doxygen_comment << "END"
+ /**
+ * How to parse an IUSE flag string.
+ *
+ * \see IUseFlag
+ * \ingroup g_names
+ */
+END
+}
+
diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc
index 061faf132..ad1e0d979 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 eaf78fe97..809cf1be4 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 937333e08..a07c7ca25 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 9c647e2e7..b2ee1152f 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 696e0f73a..8d6002692 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 4da1b64fe..4b908e855 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 7c5a4cdbe..3c778e0d1 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 7170be366..bcc9e5544 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 947492ffd..315d268f7 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 0ce503a73..2a3b31d14 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 4190e2489..bb244b26b 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 7891da04f..075db524f 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 be39ae4ca..ae2d84dad 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 0acba75f8..f24f79d04 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 a6ed6dbb6..e34576fd2 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 16897a31a..e4dfbe4d7 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 cd891a6d4..133f1d3a6 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 f16a138b3..a25c74d1f 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 b46398668..368324d77 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 ef23de1f7..b344dde7c 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 a87cc3bd7..126ed7ffe 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 852266542..6b02bb3cb 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 a4ece8f37..b32ac8015 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 b243059c0..ccd8198e7 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 72330f6c4..cfa8dca71 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 621db5645..fdd577b17 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 cf430574c..e30b39f27 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 970e6b15e..a89512c16 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 1410f46cb..df910b86d 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 536fe7c1c..93f67478a 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 d81a98532..e1a5f8d7a 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 b7f601bd4..c0b32daa8 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 7ef9a18f6..b33c7da1d 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 62bdf131b..361aa609f 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 a66a397f8..7e987d2d4 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 8a8117e01..6b0f76133 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 dc8a1640e..f06b58532 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 e4ea89c88..92c4086a4 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 f9f88aec2..069ea9dc7 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 ec1313d76..29b89e388 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 d0c42de6e..9d32c5168 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 bac29c63c..109e300ef 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 ff1bb311e..742b68d58 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 468a136c5..1e4f3eb9c 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 08d49ec01..4c5697a80 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 d5d533912..d41a23510 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 d5b910493..094e9d42b 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 92db22cc3..89278ea4b 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>(