aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-09 18:22:29 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-09 18:22:29 +0000
commitde7bfcf80fe937d8e067b981c1c0dac0fbad0b7c (patch)
treeef6f7e77905581d434dd1f73398a4619ab5e5e0f
parent4973e40c2fe669b259bc5d57b32eb6844d9176b5 (diff)
downloadpaludis-de7bfcf80fe937d8e067b981c1c0dac0fbad0b7c.tar.gz
paludis-de7bfcf80fe937d8e067b981c1c0dac0fbad0b7c.tar.xz
Add RepositoryUseInterface::use_expand_separator.
-rw-r--r--paludis/repositories/e/e_repository.cc9
-rw-r--r--paludis/repositories/e/e_repository.hh3
-rw-r--r--paludis/repositories/e/vdb_repository.cc9
-rw-r--r--paludis/repositories/e/vdb_repository.hh3
-rw-r--r--paludis/repositories/fake/fake_package_id.cc6
-rw-r--r--paludis/repositories/fake/fake_package_id.hh2
-rw-r--r--paludis/repositories/fake/fake_repository_base.cc8
-rw-r--r--paludis/repositories/fake/fake_repository_base.hh3
-rw-r--r--paludis/repository.hh6
-rw-r--r--ruby/repository.cc32
10 files changed, 81 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index cbb8b2a..2ec28f2 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -923,6 +923,15 @@ ERepository::use_expand_hidden_prefixes() const
return result;
}
+char
+ERepository::use_expand_separator(const PackageID & id) const
+{
+ if (this != id.repository().get())
+ return '\0';
+ const tr1::shared_ptr<const erepository::EAPI> & eapi(static_cast<const erepository::ERepositoryID &>(id).eapi());
+ return eapi->supported ? eapi->supported->ebuild_options->use_expand_separator : '\0';
+}
+
void
ERepository::regenerate_cache() const
{
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index d2beabc..fbf5482 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -159,6 +159,9 @@ namespace paludis
virtual 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));
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 23cac2d..ee682cb 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -830,6 +830,15 @@ VDBRepository::use_expand_hidden_prefixes() const
return tr1::shared_ptr<const UseFlagNameSet>(new UseFlagNameSet);
}
+char
+VDBRepository::use_expand_separator(const PackageID & id) const
+{
+ if (this != id.repository().get())
+ return '\0';
+ const tr1::shared_ptr<const EAPI> & eapi(static_cast<const VDBID &>(id).eapi());
+ return eapi->supported ? eapi->supported->ebuild_options->use_expand_separator : '\0';
+}
+
bool
VDBRepository::load_provided_using_cache() const
{
diff --git a/paludis/repositories/e/vdb_repository.hh b/paludis/repositories/e/vdb_repository.hh
index 0469d1c..26fe95f 100644
--- a/paludis/repositories/e/vdb_repository.hh
+++ b/paludis/repositories/e/vdb_repository.hh
@@ -145,6 +145,9 @@ namespace paludis
virtual 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));
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 91eb2db..15cb48f 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -924,6 +924,12 @@ FakePackageID::size_of_all_distfiles_key() const
return tr1::shared_ptr<const MetadataSizeKey>();
}
+char
+FakePackageID::use_expand_separator() const
+{
+ return erepository::EAPIData::get_instance()->eapi_from_string(_imp->eapi)->supported->ebuild_options->use_expand_separator;
+}
+
std::string
FakeMetadataIUseSetKey::pretty_print_flat(const Formatter<IUseFlag> & f) const
{
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 8e5b7ab..473f7e4 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -236,6 +236,8 @@ namespace paludis
const tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > fetches_key();
const tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage_key();
+ char use_expand_separator() const;
+
void set_slot(const SlotName &);
virtual bool arbitrary_less_than_comparison(const PackageID &) const;
diff --git a/paludis/repositories/fake/fake_repository_base.cc b/paludis/repositories/fake/fake_repository_base.cc
index 082781c..b997f63 100644
--- a/paludis/repositories/fake/fake_repository_base.cc
+++ b/paludis/repositories/fake/fake_repository_base.cc
@@ -201,6 +201,14 @@ FakeRepositoryBase::use_expand_prefixes() const
return 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, tr1::shared_ptr<SetSpecTree::ConstItem> s)
{
diff --git a/paludis/repositories/fake/fake_repository_base.hh b/paludis/repositories/fake/fake_repository_base.hh
index ff64703..d05a0ee 100644
--- a/paludis/repositories/fake/fake_repository_base.hh
+++ b/paludis/repositories/fake/fake_repository_base.hh
@@ -130,6 +130,9 @@ namespace paludis
virtual 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));
diff --git a/paludis/repository.hh b/paludis/repository.hh
index d553630..ae794f9 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -337,6 +337,12 @@ namespace paludis
virtual tr1::shared_ptr<const UseFlagNameSet> use_expand_prefixes() const = 0;
/**
+ * Fetch the use expand separator (eg _ or :) for the
+ * specified package, or \0 if unknown.
+ */
+ virtual char use_expand_separator(const PackageID & pkg) const = 0;
+
+ /**
* Describe a use flag.
*/
virtual std::string describe_use_flag(const UseFlagName & n, const PackageID & pkg) const = 0;
diff --git a/ruby/repository.cc b/ruby/repository.cc
index e37204b..f4f7e41 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -471,6 +471,36 @@ namespace
/*
* call-seq:
+ * use_expand_separator(package_id) -> String or Nil
+ *
+ * Fetch the use expand separator (eg _ or :) for the specified
+ * package, or Nil if unknown.
+ */
+ VALUE
+ repository_use_expand_separator(VALUE self, VALUE package_id)
+ {
+ try
+ {
+ tr1::shared_ptr<Repository> * self_ptr;
+ Data_Get_Struct(self, tr1::shared_ptr<Repository>, self_ptr);
+ if ((*self_ptr)->use_interface) {
+ tr1::shared_ptr<const PackageID> pid(value_to_package_id(package_id));
+ char sep((*self_ptr)->use_interface->use_expand_separator(*pid));
+ return sep ? rb_str_new(&sep, 1) : Qnil;
+ }
+ else
+ {
+ return Qnil;
+ }
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
* describe_use_flag(flag_name, package_id) -> String or Nil
*
* Returns the description for a use flag name, or nil if the
@@ -901,6 +931,8 @@ namespace
rb_define_method(c_repository, "query_use_mask", RUBY_FUNC_CAST((&QueryUse<bool, true, false, &RepositoryUseInterface::query_use_mask>::query)), 2);
rb_define_method(c_repository, "query_use_force", RUBY_FUNC_CAST((&QueryUse<bool, true, false, &RepositoryUseInterface::query_use_force>::query)), 2);
+ rb_define_method(c_repository, "use_expand_separator", RUBY_FUNC_CAST(&repository_use_expand_separator), 1);
+
rb_define_method(c_repository, "describe_use_flag", RUBY_FUNC_CAST(&repository_describe_use_flag), 2);
rb_define_method(c_repository, "profiles", RUBY_FUNC_CAST(&repository_profiles),0);