aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-19 14:20:48 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-19 20:52:24 +0100
commite52571861104efe6139b78b22557211f08025f11 (patch)
tree634bec98491886d12f8f5a25b24f4cacf8d69de5 /ruby
parent80bf4ad14bfd8ab74a9c0d5f203ad5a370351def (diff)
downloadpaludis-e52571861104efe6139b78b22557211f08025f11.tar.gz
paludis-e52571861104efe6139b78b22557211f08025f11.tar.xz
Revert the package dep spec changes
Diffstat (limited to 'ruby')
-rw-r--r--ruby/Makefile.am1
-rwxr-xr-xruby/demos/find_unmanaged_files.rb8
-rw-r--r--ruby/dep_spec.cc291
-rw-r--r--ruby/dep_spec_TEST.rb114
-rw-r--r--ruby/generator_TEST.rb4
-rw-r--r--ruby/package_dep_spec_constraint.cc527
-rw-r--r--ruby/paludis_ruby.cc8
-rw-r--r--ruby/paludis_ruby.hh1
8 files changed, 290 insertions, 664 deletions
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 3f46ae03c..ade8df5ca 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -50,7 +50,6 @@ IF_RUBY_SOURCES = \
metadata_key.cc \
name.cc \
nice_names-nn.hh nice_names-nn.cc \
- package_dep_spec_constraint.cc \
package_id.cc \
paludis_ruby.cc paludis_ruby.hh \
qualified_package_name.cc \
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
index 8e0544858..d41f7c135 100755
--- a/ruby/demos/find_unmanaged_files.rb
+++ b/ruby/demos/find_unmanaged_files.rb
@@ -12,12 +12,12 @@ def get_contents(pids, directories, root)
in_contents= []
pids.each do |pid|
next if pid.contents_key.nil?
- contents = pid.contents_key.parse_value
+ contents = pid.contents_key.value
contents.each do |entry|
next if entry.kind_of? ContentsOtherEntry
directories.each do |directory|
- if (root + entry.location_key.parse_value)[0,directory.length] == directory
- in_contents << root + entry.location_key.parse_value
+ if (root + entry.location_key.value)[0,directory.length] == directory
+ in_contents << root + entry.location_key.value
break;
end
end
@@ -72,7 +72,7 @@ opts.each do | opt, arg |
end
env = Paludis::EnvironmentFactory.instance.create env_spec
-root = env.preferred_root_key.parse_value[-1] == ?/ ? env.preferred_root_key.parse_value.chop : env.preferred_root_key.parse_value
+root = env.preferred_root_key.value[-1] == ?/ ? env.preferred_root_key.value.chop : env.preferred_root_key.value
directories = []
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 09518ddf9..9f6790bc0 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -19,12 +19,10 @@
*/
#include <paludis_ruby.hh>
-
#include <paludis/dep_spec.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/version_requirements.hh>
#include <paludis/version_operator.hh>
-#include <paludis/package_dep_spec_requirement.hh>
-
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/options.hh>
@@ -33,7 +31,6 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/accept_visitor.hh>
-
#include <algorithm>
#include <list>
#include <ruby.h>
@@ -64,6 +61,58 @@ namespace
static VALUE c_exactly_one_dep_spec;
static VALUE c_conditional_dep_spec;
+ static VALUE c_version_requirements_mode;
+
+ static VALUE c_slot_requirement;
+ static VALUE c_slot_exact_requirement;
+ static VALUE c_slot_any_locked_requirement;
+ static VALUE c_slot_any_unlocked_requirement;
+
+ struct V
+ {
+ VALUE value;
+ std::shared_ptr<const SlotRequirement> mm;
+
+ V(std::shared_ptr<const SlotRequirement> _m) :
+ mm(_m)
+ {
+ }
+
+ void visit(const SlotExactRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_exact_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ void visit(const SlotAnyLockedRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_any_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ void visit(const SlotAnyUnlockedRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_any_unlocked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ };
+
+ VALUE
+ slot_requirement_to_value(std::shared_ptr<const SlotRequirement> m)
+ {
+ try
+ {
+ V v(m);
+ m->accept(v);
+ return v.value;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
struct WrappedSpecBase;
template <typename> struct WrappedSpec;
@@ -527,193 +576,217 @@ namespace
/*
* call-seq:
- * package_name_requirement -> NameRequirement or Nil
+ * package -> QualifiedPackageName or Nil
*
- * Fetch the package name requirement (may be Nil).
+ * Fetch the package name.
*/
VALUE
- package_dep_spec_package_name_requirement(VALUE self)
+ package_dep_spec_package(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_name_requirement()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_ptr()))
return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_name_requirement());
+ return qualified_package_name_to_value(*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_ptr());
}
/*
* call-seq:
- * package_name_part_requirement -> PackageNamePartRequirement or Nil
+ * package_name_part -> String or Nil
*
- * Fetch the package name part requirement (may be Nil).
+ * Fetch the package name part.
*/
VALUE
- package_dep_spec_package_name_part_requirement(VALUE self)
+ package_dep_spec_package_name_part(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_name_part_requirement()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_name_part_ptr()))
return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->package_name_part_requirement());
+ return rb_str_new2(stringify(*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->
+ package_name_part_ptr()).c_str());
}
/*
* call-seq:
- * category_name_part_requirement -> CategoryNamePartRequirement or Nil
+ * category_name_part -> String or Nil
*
- * Fetch the category name part requirement (may be Nil).
+ * Fetch the category name part.
*/
VALUE
- package_dep_spec_category_name_part_requirement(VALUE self)
+ package_dep_spec_category_name_part(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->category_name_part_requirement()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->category_name_part_ptr()))
return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->category_name_part_requirement());
+ return rb_str_new2(stringify(*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->
+ category_name_part_ptr()).c_str());
}
/*
* call-seq:
- * any_slot_requirement -> AnySlotRequirement or Nil
+ * text -> String
*
- * Fetch the any-slot requirement (may be Nil).
+ * Fetch our text.
*/
VALUE
- package_dep_spec_any_slot_requirement(VALUE self)
+ string_dep_spec_text(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->any_slot_requirement()))
- return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->any_slot_requirement());
+ return rb_str_new2(stringify(std::static_pointer_cast<const StringDepSpec>((*ptr)->base_spec())->text()).c_str());
}
/*
* call-seq:
- * exact_slot_requirement -> ExactSlotRequirement or Nil
+ * to_s -> String
*
- * Fetch the exact-slot requirement (may be Nil).
+ * Fetch a string representation of ourself.
*/
- VALUE
- package_dep_spec_exact_slot_requirement(VALUE self)
+ template <typename T_>
+ VALUE dep_spec_to_s(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->exact_slot_requirement()))
- return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->exact_slot_requirement());
+ return rb_str_new2(stringify(*std::static_pointer_cast<const WrappedSpec<T_> >(*ptr)->spec()).c_str());
}
/*
* call-seq:
- * text -> String
+ * slot_requirement -> SlotRequirement or Nil
*
- * Fetch our text.
+ * Fetch the slot requirement.
*/
VALUE
- string_dep_spec_text(VALUE self)
+ package_dep_spec_slot_requirement_ptr(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- return rb_str_new2(stringify(std::static_pointer_cast<const StringDepSpec>((*ptr)->base_spec())->text()).c_str());
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->slot_requirement_ptr()))
+ return Qnil;
+ return slot_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->slot_requirement_ptr());
}
/*
* call-seq:
- * to_s -> String
+ * in_repository -> String or Nil
*
- * Fetch a string representation of ourself.
+ * Fetch the in-repository name.
*/
- template <typename T_>
- VALUE dep_spec_to_s(VALUE self)
+ VALUE
+ package_dep_spec_in_repository_ptr(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- return rb_str_new2(stringify(*std::static_pointer_cast<const WrappedSpec<T_> >(*ptr)->spec()).c_str());
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_ptr()))
+ return Qnil;
+ return rb_str_new2(stringify((*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_ptr())).c_str());
}
/*
* call-seq:
- * in_repository_requirement -> InRepositoryRequirement or Nil
+ * from_repository -> String or Nil
*
- * Fetch the in-repository name.
+ * Fetch the from-repository name.
*/
VALUE
- package_dep_spec_in_repository_requirement(VALUE self)
+ package_dep_spec_from_repository_ptr(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_requirement()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_ptr()))
return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->in_repository_requirement());
+ return rb_str_new2(stringify((*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_ptr())).c_str());
}
/*
* call-seq:
- * from_repository_requirement -> FromRepositoryRequirement or Nil
+ * installable_to_repository -> Hash or Nil
*
- * Fetch the from-repository requirement.
+ * Fetch the installable-to-repository requirement.
*/
VALUE
- package_dep_spec_from_repository_requirement(VALUE self)
+ package_dep_spec_installable_to_repository(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_requirement()))
+ std::shared_ptr<const InstallableToRepository> i2r(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_ptr());
+ if (! i2r)
return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->from_repository_requirement());
+ VALUE result(rb_hash_new());
+ rb_hash_aset(result, ID2SYM(rb_intern("repository")),
+ rb_str_new2(stringify(i2r->repository()).c_str()));
+ rb_hash_aset(result, ID2SYM(rb_intern("include_masked?")),
+ i2r->include_masked() ? Qtrue : Qfalse);
+ return result;
}
/*
* call-seq:
- * installed_at_path_requirement ->
- * InstalledAtPathRequirement or Nil
+ * installed_at_path -> String or Nil
*
* Fetch the installed-at-path requirement.
*/
VALUE
- package_dep_spec_installed_at_path_requirement(VALUE self)
+ package_dep_spec_installed_at_path(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_requirement()))
+ if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_ptr()))
return Qnil;
- return package_dep_spec_requirement_to_value(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_requirement());
+ return rb_str_new2(stringify((*std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installed_at_path_ptr())).c_str());
}
/*
* call-seq:
- * installable_to_path_requirement -> InstallableToPathRequirement or Nil
+ * installable_to_path -> Hash or Nil
*
* Fetch the installable-to-path requirement.
*/
VALUE
- package_dep_spec_installable_to_path_requirement(VALUE self)
+ package_dep_spec_installable_to_path(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_requirement()))
+ std::shared_ptr<const InstallableToPath> i2p(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_ptr());
+ if (! i2p)
return Qnil;
- return package_dep_spec_requirement_to_value(
- std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_path_requirement());
+ VALUE result(rb_hash_new());
+ rb_hash_aset(result, ID2SYM(rb_intern("path")),
+ rb_str_new2(stringify(i2p->path()).c_str()));
+ rb_hash_aset(result, ID2SYM(rb_intern("include_masked?")),
+ i2p->include_masked() ? Qtrue : Qfalse);
+ return result;
}
/*
* call-seq:
- * installable_to_path_requirement -> InstallableToRepositoryRequirement or Nil
+ * version_requirements -> Array
*
- * Fetch the installable-to-path requirement.
+ * Fetch the version requirements. E.g. [ {:operator => '=', :spec => VersionSpec.new('0.1') } ]
*/
VALUE
- package_dep_spec_installable_to_repository_requirement(VALUE self)
+ package_dep_spec_version_requirements_ptr(VALUE self)
{
std::shared_ptr<WrappedSpecBase> * ptr;
Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
- if (! bool(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_requirement()))
- return Qnil;
- return package_dep_spec_requirement_to_value(
- std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->installable_to_repository_requirement());
+ VALUE result(rb_ary_new());
+ VALUE result_hash;
+ if (std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->version_requirements_ptr())
+ for (VersionRequirements::ConstIterator i(std::static_pointer_cast<const PackageDepSpec>((*ptr)->base_spec())->
+ version_requirements_ptr()->begin()),
+ i_end(std::static_pointer_cast<const PackageDepSpec>((*ptr)->base_spec())->version_requirements_ptr()->end()) ;
+ i != i_end; ++i)
+ {
+ result_hash = rb_hash_new();
+ rb_hash_aset(result_hash, ID2SYM(rb_intern("operator")),
+ rb_str_new2(stringify(i->version_operator()).c_str()));
+ rb_hash_aset(result_hash, ID2SYM(rb_intern("spec")),
+ version_spec_to_value(i->version_spec()));
+ rb_ary_push(result, result_hash);
+ }
+ return result;
}
#ifdef CIARANM_REMOVED_THIS
@@ -748,6 +821,14 @@ namespace
}
#endif
+ VALUE
+ package_dep_spec_version_requirements_mode(VALUE self)
+ {
+ std::shared_ptr<WrappedSpecBase> * ptr;
+ Data_Get_Struct(self, std::shared_ptr<WrappedSpecBase>, ptr);
+ return INT2FIX(std::static_pointer_cast<const WrappedSpec<PackageDepSpec> >(*ptr)->spec()->version_requirements_mode());
+ }
+
/*
* Document-method: original_url
* call-seq: original_url -> String
@@ -884,6 +965,14 @@ namespace
}
+ VALUE
+ slot_exact_requirement_slot(VALUE self)
+ {
+ std::shared_ptr<const SlotExactRequirement> * ptr;
+ Data_Get_Struct(self, std::shared_ptr<const SlotExactRequirement>, ptr);
+ return rb_str_new2(stringify((*ptr)->slot()).c_str());
+ }
+
void do_register_dep_spec()
{
/*
@@ -1018,16 +1107,17 @@ namespace
* use Paludis::parse_user_package_dep_spec.
*/
c_package_dep_spec = rb_define_class_under(paludis_module(), "PackageDepSpec", c_string_dep_spec);
- rb_define_method(c_package_dep_spec, "package_name_requirement", RUBY_FUNC_CAST(&package_dep_spec_package_name_requirement), 0);
- rb_define_method(c_package_dep_spec, "package_name_part_requirement", RUBY_FUNC_CAST(&package_dep_spec_package_name_part_requirement), 0);
- rb_define_method(c_package_dep_spec, "category_name_part_requirement", RUBY_FUNC_CAST(&package_dep_spec_category_name_part_requirement), 0);
- rb_define_method(c_package_dep_spec, "in_repository_requirement", RUBY_FUNC_CAST(&package_dep_spec_in_repository_requirement), 0);
- rb_define_method(c_package_dep_spec, "from_repository_requirement", RUBY_FUNC_CAST(&package_dep_spec_from_repository_requirement), 0);
- rb_define_method(c_package_dep_spec, "installable_to_repository_requirement", RUBY_FUNC_CAST(&package_dep_spec_installable_to_repository_requirement), 0);
- rb_define_method(c_package_dep_spec, "installed_at_path_requirement", RUBY_FUNC_CAST(&package_dep_spec_installed_at_path_requirement), 0);
- rb_define_method(c_package_dep_spec, "installable_to_path_requirement", RUBY_FUNC_CAST(&package_dep_spec_installable_to_path_requirement), 0);
- rb_define_method(c_package_dep_spec, "any_slot_requirement", RUBY_FUNC_CAST(&package_dep_spec_any_slot_requirement), 0);
- rb_define_method(c_package_dep_spec, "exact_slot_requirement", RUBY_FUNC_CAST(&package_dep_spec_exact_slot_requirement), 0);
+ rb_define_method(c_package_dep_spec, "package", RUBY_FUNC_CAST(&package_dep_spec_package), 0);
+ rb_define_method(c_package_dep_spec, "package_name_part", RUBY_FUNC_CAST(&package_dep_spec_package_name_part), 0);
+ rb_define_method(c_package_dep_spec, "category_name_part", RUBY_FUNC_CAST(&package_dep_spec_category_name_part), 0);
+ rb_define_method(c_package_dep_spec, "slot_requirement", RUBY_FUNC_CAST(&package_dep_spec_slot_requirement_ptr), 0);
+ rb_define_method(c_package_dep_spec, "in_repository", RUBY_FUNC_CAST(&package_dep_spec_in_repository_ptr), 0);
+ rb_define_method(c_package_dep_spec, "from_repository", RUBY_FUNC_CAST(&package_dep_spec_from_repository_ptr), 0);
+ rb_define_method(c_package_dep_spec, "installable_to_repository", RUBY_FUNC_CAST(&package_dep_spec_installable_to_repository), 0);
+ rb_define_method(c_package_dep_spec, "installed_at_path", RUBY_FUNC_CAST(&package_dep_spec_installed_at_path), 0);
+ rb_define_method(c_package_dep_spec, "installable_to_path", RUBY_FUNC_CAST(&package_dep_spec_installable_to_path), 0);
+ rb_define_method(c_package_dep_spec, "version_requirements", RUBY_FUNC_CAST(&package_dep_spec_version_requirements_ptr), 0);
+ rb_define_method(c_package_dep_spec, "version_requirements_mode", RUBY_FUNC_CAST(&package_dep_spec_version_requirements_mode), 0);
#ifdef CIARANM_REMOVED_THIS
rb_define_method(c_package_dep_spec, "use_requirements", RUBY_FUNC_CAST(&package_dep_spec_use_requirements), 0);
#endif
@@ -1093,7 +1183,52 @@ namespace
VALUE (* block_dep_spec_to_s) (VALUE) = &dep_spec_to_s<BlockDepSpec>;
rb_define_method(c_block_dep_spec, "to_s", RUBY_FUNC_CAST(block_dep_spec_to_s), 0);
+ /*
+ * Document-module: Paludis::VersionRequirementsMode
+ *
+ * What sort of VersionRequirements to we have.
+ *
+ */
+ c_version_requirements_mode = rb_define_module_under(paludis_module(), "VersionRequirementsMode");
+ for (VersionRequirementsMode l(static_cast<VersionRequirementsMode>(0)), l_end(last_vr) ; l != l_end ;
+ l = static_cast<VersionRequirementsMode>(static_cast<int>(l) + 1))
+ rb_define_const(c_version_requirements_mode, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/version_requirements.hh, VersionRequirementsMode, c_version_requirements_mode>
+
rb_define_module_function(paludis_module(), "parse_user_package_dep_spec", RUBY_FUNC_CAST(&paludis_parse_user_dep_spec), -1);
+
+ /*
+ * Document-class: Paludis::SlotRequirement
+ *
+ * A SlotRequirement
+ */
+ c_slot_requirement = rb_define_class_under(paludis_module(), "SlotRequirement", rb_cObject);
+ rb_funcall(c_slot_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_slot_requirement, "as_string", RUBY_FUNC_CAST(&Common<std::shared_ptr<const SlotRequirement> >::to_s_via_ptr), 0);
+ rb_define_method(c_slot_requirement, "to_s", RUBY_FUNC_CAST(&Common<std::shared_ptr<const SlotRequirement> >::to_s_via_ptr), 0);
+
+ /*
+ * Document-class: Paludis::ExactSlotRequirement
+ *
+ * An exact slot requiremet (:)
+ */
+ c_slot_exact_requirement = rb_define_class_under(paludis_module(), "SlotExactRequirement", c_slot_requirement);
+ rb_define_method(c_slot_exact_requirement, "slot", RUBY_FUNC_CAST(&slot_exact_requirement_slot), 0);
+
+ /*
+ * Document-class: Paludis::SlotAnyLockedRequirement
+ *
+ * An any locked slot requiremet (:=)
+ */
+ c_slot_any_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyLockedRequirement", c_slot_requirement);
+
+ /*
+ * Document-class: Paludis::ExactSlotRequirement
+ *
+ * An any unlocked slot requiremet (:*)
+ */
+ c_slot_any_unlocked_requirement = rb_define_class_under(paludis_module(), "SlotAnyUnlockedRequirement", c_slot_requirement);
}
}
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index d8c7f052e..526186a59 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -130,77 +130,97 @@ module Paludis
end
def test_slot
- assert_equal "100", pda.exact_slot_requirement.name
- assert_nil pdb.exact_slot_requirement
- assert_nil pdc.exact_slot_requirement
- assert_nil pdd.exact_slot_requirement
- assert_nil pde.exact_slot_requirement
+ assert_kind_of SlotExactRequirement, pda.slot_requirement
+ assert_equal ":100", pda.slot_requirement.to_s
+ assert_equal "100", pda.slot_requirement.slot
+ assert_nil pdb.slot_requirement
+ assert_nil pdc.slot_requirement
+ assert_nil pdd.slot_requirement
+ assert_nil pde.slot_requirement
end
def test_package
- assert_equal QualifiedPackageName.new("foo/bar"), pda.package_name_requirement.name
- assert_nil pdb.package_name_requirement
- assert_equal QualifiedPackageName.new("foo/bar"), pdc.package_name_requirement.name
- assert_nil pdd.package_name_requirement
- assert_equal QualifiedPackageName.new("foo/bar"), pde.package_name_requirement.name
+ assert_equal QualifiedPackageName.new("foo/bar"), pda.package
+ assert_nil pdb.package
+ assert_equal QualifiedPackageName.new("foo/bar"), pdc.package
+ assert_nil pdd.package
+ assert_equal QualifiedPackageName.new("foo/bar"), pde.package
end
def test_from_repository
- assert_nil pda.from_repository_requirement
- assert_nil pdb.from_repository_requirement
- assert_nil pdc.from_repository_requirement
- assert_nil pdd.from_repository_requirement
- assert_equal "testrepo", pde.from_repository_requirement.name
+ assert_nil pda.from_repository
+ assert_nil pdb.from_repository
+ assert_nil pdc.from_repository
+ assert_nil pdd.from_repository
+ assert_equal "testrepo", pde.from_repository
end
def test_in_repository
- assert_equal "testrepo", pda.in_repository_requirement.name
- assert_nil pdb.in_repository_requirement
- assert_nil pdc.in_repository_requirement
- assert_nil pdd.in_repository_requirement
- assert_nil pde.in_repository_requirement
+ assert_equal "testrepo", pda.in_repository
+ assert_nil pdb.in_repository
+ assert_nil pdc.in_repository
+ assert_nil pdd.in_repository
+ assert_nil pde.in_repository
end
def test_installable_to_repository
- assert_nil pda.installable_to_repository_requirement
- assert_nil pdb.installable_to_repository_requirement
- assert_equal "installed", pdc.installable_to_repository_requirement.name
- assert ! pdc.installable_to_repository_requirement.include_masked?
- assert_nil pdd.installable_to_repository_requirement
- assert_nil pde.installable_to_repository_requirement
+ assert_nil pda.installable_to_repository
+ assert_nil pdb.installable_to_repository
+ assert_kind_of Hash, pdc.installable_to_repository
+ assert_equal "installed", pdc.installable_to_repository[:repository]
+ assert ! pdc.installable_to_repository[:include_masked?]
+ assert_nil pdd.installable_to_repository
+ assert_nil pde.installable_to_repository
end
def test_installed_at_path
- assert_nil pda.installed_at_path_requirement
- assert_nil pdb.installed_at_path_requirement
- assert_nil pdc.installed_at_path_requirement
- assert_nil pdd.installed_at_path_requirement
- assert_equal "/mychroot", pde.installed_at_path_requirement.path
+ assert_nil pda.installed_at_path
+ assert_nil pdb.installed_at_path
+ assert_nil pdc.installed_at_path
+ assert_nil pdd.installed_at_path
+ assert_equal "/mychroot", pde.installed_at_path
end
def test_installable_to_path
- assert_nil pda.installable_to_path_requirement
- assert_nil pdb.installable_to_path_requirement
- assert_nil pdc.installable_to_path_requirement
- assert_equal "/", pdd.installable_to_path_requirement.path
- assert pdd.installable_to_path_requirement.include_masked?
- assert_nil pde.installable_to_path_requirement
+ assert_nil pda.installable_to_path
+ assert_nil pdb.installable_to_path
+ assert_nil pdc.installable_to_path
+ assert_kind_of Hash, pdd.installable_to_path
+ assert_equal "/", pdd.installable_to_path[:path]
+ assert pdd.installable_to_path[:include_masked?]
+ assert_nil pde.installable_to_path
end
def test_package_name_part
- assert_nil pda.package_name_part_requirement
- assert_equal "bar", pdb.package_name_part_requirement.name_part
- assert_nil pdc.package_name_part_requirement
- assert_nil pdd.package_name_part_requirement
- assert_nil pde.package_name_part_requirement
+ assert_nil pda.package_name_part
+ assert_equal "bar", pdb.package_name_part
+ assert_nil pdc.package_name_part
+ assert_nil pdd.package_name_part
+ assert_nil pde.package_name_part
end
def test_category_name_part
- assert_nil pda.category_name_part_requirement
- assert_nil pdb.category_name_part_requirement
- assert_nil pdc.category_name_part_requirement
- assert_equal "foo", pdd.category_name_part_requirement.name_part
- assert_nil pde.category_name_part_requirement
+ assert_nil pda.category_name_part
+ assert_nil pdb.category_name_part
+ assert_nil pdc.category_name_part
+ assert_equal "foo", pdd.category_name_part
+ assert_nil pde.category_name_part
+ end
+
+ def test_version_requirements
+ assert_kind_of Array, pda.version_requirements
+ assert_equal 1, pda.version_requirements.size
+ assert_equal VersionSpec.new('1'), pda.version_requirements.first[:spec]
+ assert_equal ">=", pda.version_requirements.first[:operator]
+ assert_equal 0, pdb.version_requirements.size
+ assert_equal 0, pdc.version_requirements.size
+ assert_equal 0, pdd.version_requirements.size
+ assert_equal 0, pde.version_requirements.size
+ end
+
+ def test_version_requirements_mode
+ assert_kind_of Fixnum, pda.version_requirements_mode
+ assert_equal VersionRequirementsMode::And, pda.version_requirements_mode
end
### def test_use_requirements
diff --git a/ruby/generator_TEST.rb b/ruby/generator_TEST.rb
index 9359a1418..7b91c0820 100644
--- a/ruby/generator_TEST.rb
+++ b/ruby/generator_TEST.rb
@@ -59,8 +59,8 @@ module Paludis
assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []), nil, []).to_s,
"packages matching a/b"
assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []),
- nil, [:ignore_choice_requirements]).to_s,
- "packages matching a/b (ignoring choice requirements)"
+ nil, [:ignore_additional_requirements]).to_s,
+ "packages matching a/b (ignoring additional requirements)"
end
end
diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc
deleted file mode 100644
index 678a3e6af..000000000
--- a/ruby/package_dep_spec_constraint.cc
+++ /dev/null
@@ -1,527 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2011 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_ruby.hh>
-
-#include <paludis/package_dep_spec_requirement.hh>
-
-#include <algorithm>
-#include <list>
-#include <ruby.h>
-
-using namespace paludis;
-using namespace paludis::ruby;
-
-namespace
-{
- static VALUE c_package_dep_spec_requirement;
- static VALUE c_name_requirement;
- static VALUE c_package_name_part_requirement;
- static VALUE c_category_name_part_requirement;
- static VALUE c_version_requirement;
- static VALUE c_in_repository_requirement;
- static VALUE c_from_repository_requirement;
- static VALUE c_installed_at_path_requirement;
- static VALUE c_installable_to_path_requirement;
- static VALUE c_installable_to_repository_requirement;
- static VALUE c_any_slot_requirement;
- static VALUE c_exact_slot_requirement;
- static VALUE c_key_requirement;
- static VALUE c_choice_requirement;
-
- static VALUE c_key_requirement_operation;
-
- struct V
- {
- VALUE value;
- std::shared_ptr<const PackageDepSpecRequirement> mm;
-
- V(const std::shared_ptr<const PackageDepSpecRequirement> & m) :
- mm(m)
- {
- }
-
- void visit(const NameRequirement &)
- {
- value = Data_Wrap_Struct(c_name_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const CategoryNamePartRequirement &)
- {
- value = Data_Wrap_Struct(c_category_name_part_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const PackageNamePartRequirement &)
- {
- value = Data_Wrap_Struct(c_package_name_part_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const VersionRequirement &)
- {
- value = Data_Wrap_Struct(c_version_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const InRepositoryRequirement &)
- {
- value = Data_Wrap_Struct(c_in_repository_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const FromRepositoryRequirement &)
- {
- value = Data_Wrap_Struct(c_from_repository_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const InstalledAtPathRequirement &)
- {
- value = Data_Wrap_Struct(c_installed_at_path_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const InstallableToPathRequirement &)
- {
- value = Data_Wrap_Struct(c_installable_to_path_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const InstallableToRepositoryRequirement &)
- {
- value = Data_Wrap_Struct(c_installable_to_repository_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const AnySlotRequirement &)
- {
- value = Data_Wrap_Struct(c_any_slot_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const ExactSlotRequirement &)
- {
- value = Data_Wrap_Struct(c_exact_slot_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const KeyRequirement &)
- {
- value = Data_Wrap_Struct(c_key_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
-
- void visit(const ChoiceRequirement &)
- {
- value = Data_Wrap_Struct(c_choice_requirement, 0, &Common<std::shared_ptr<const PackageDepSpecRequirement> >::free,
- new std::shared_ptr<const PackageDepSpecRequirement>(mm));
- }
- };
-
- /*
- * Document-method: name
- *
- * The name requirement.
- */
- static VALUE
- name_requirement_name(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return qualified_package_name_to_value((std::static_pointer_cast<const NameRequirement>(*ptr))->name());
- }
-
- /*
- * Document-method: name_part
- *
- * The name part requirement.
- */
- static VALUE
- package_name_part_requirement_name_part(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const PackageNamePartRequirement>(*ptr))->name_part()).c_str());
- }
-
- /*
- * Document-method: name_part
- *
- * The name part requirement.
- */
- static VALUE
- category_name_part_requirement_name_part(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const CategoryNamePartRequirement>(*ptr))->name_part()).c_str());
- }
-
- /*
- * Document-method: name
- *
- * The name requirement.
- */
- static VALUE
- in_repository_requirement_name(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const InRepositoryRequirement>(*ptr))->name()).c_str());
- }
-
- /*
- * Document-method: name
- *
- * The name requirement.
- */
- static VALUE
- from_repository_requirement_name(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const FromRepositoryRequirement>(*ptr))->name()).c_str());
- }
-
- /*
- * Document-method: path
- *
- * The path requirement.
- */
- static VALUE
- installed_at_path_requirement_path(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const InstalledAtPathRequirement>(*ptr))->path()).c_str());
- }
-
- /*
- * Document-method: path
- *
- * The path requirement.
- */
- static VALUE
- installable_to_path_requirement_path(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const InstallableToPathRequirement>(*ptr))->path()).c_str());
- }
-
- /*
- * Document-method: include_masked?
- *
- * The include-masked requirement.
- */
- static VALUE
- installable_to_path_requirement_include_masked(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return (std::static_pointer_cast<const InstallableToPathRequirement>(*ptr))->include_masked() ? Qtrue : Qfalse;
- }
-
- /*
- * Document-method: name
- *
- * The name requirement.
- */
- static VALUE
- installable_to_repository_requirement_name(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const InstallableToRepositoryRequirement>(*ptr))->name()).c_str());
- }
-
- /*
- * Document-method: include_masked?
- *
- * The include-masked requirement.
- */
- static VALUE
- installable_to_repository_requirement_include_masked(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return (std::static_pointer_cast<const InstallableToRepositoryRequirement>(*ptr))->include_masked() ? Qtrue : Qfalse;
- }
-
- /*
- * Document-method: locking?
- *
- * The locking requirement.
- */
- static VALUE
- any_slot_requirement_locking(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return (std::static_pointer_cast<const AnySlotRequirement>(*ptr))->locking() ? Qtrue : Qfalse;
- }
-
- /*
- * Document-method: locked?
- *
- * The locked requirement.
- */
- static VALUE
- exact_slot_requirement_locked(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return (std::static_pointer_cast<const ExactSlotRequirement>(*ptr))->locked() ? Qtrue : Qfalse;
- }
-
- /*
- * Document-method: name
- *
- * The name requirement.
- */
- static VALUE
- exact_slot_requirement_name(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const ExactSlotRequirement>(*ptr))->name()).c_str());
- }
-
- /*
- * Document-method: key
- *
- * The key requirement.
- */
- static VALUE
- key_requirement_key(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const KeyRequirement>(*ptr))->key()).c_str());
- }
-
- /*
- * Document-method: pattern
- *
- * The pattern requirement.
- */
- static VALUE
- key_requirement_pattern(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const KeyRequirement>(*ptr))->pattern()).c_str());
- }
-
- /*
- * Document-method: operation
- *
- * The operation requirement.
- */
- static VALUE
- key_requirement_operation(VALUE self)
- {
- std::shared_ptr<const PackageDepSpecRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecRequirement>, ptr);
- return INT2FIX((std::static_pointer_cast<const KeyRequirement>(*ptr))->operation());
- }
-
- void do_register_package_dep_spec_requirement()
- {
- /*
- * Document-class: Paludis::PackageDepSpecRequirement
- *
- * Represents a requirement in a PackageDepSpec.
- */
- c_package_dep_spec_requirement = rb_define_class_under(paludis_module(), "PackageDepSpecRequirement", rb_cObject);
- rb_funcall(c_package_dep_spec_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
-
- /*
- * Document-class: Paludis::NameRequirement
- *
- * Represents a cat/pkg name requirement in a PackageDepSpec.
- */
- c_name_requirement = rb_define_class_under(
- paludis_module(), "NameRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_name_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_package_dep_spec_requirement, "name", RUBY_FUNC_CAST(&name_requirement_name), 0);
-
- /*
- * Document-class: Paludis::PackageNamePartRequirement
- *
- * Represents a /pkg name requirement in a PackageDepSpec.
- */
- c_package_name_part_requirement = rb_define_class_under(
- paludis_module(), "PackageNamePartRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_package_name_part_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_package_name_part_requirement, "name_part", RUBY_FUNC_CAST(
- &package_name_part_requirement_name_part), 0);
-
- /*
- * Document-class: Paludis::CategoryNamePartRequirement
- *
- * Represents a /pkg name requirement in a PackageDepSpec.
- */
- c_category_name_part_requirement = rb_define_class_under(
- paludis_module(), "CategoryNamePartRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_category_name_part_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_category_name_part_requirement, "name_part", RUBY_FUNC_CAST(
- &category_name_part_requirement_name_part), 0);
-
- /*
- * Document-class: Paludis::InRepositoryRequirement
- *
- * Represents a /pkg name requirement in a PackageDepSpec.
- */
- c_in_repository_requirement = rb_define_class_under(
- paludis_module(), "InRepositoryRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_in_repository_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_in_repository_requirement, "name", RUBY_FUNC_CAST(
- &in_repository_requirement_name), 0);
-
- /*
- * Document-class: Paludis::FromRepositoryRequirement
- *
- * Represents a /pkg name requirement in a PackageDepSpec.
- */
- c_from_repository_requirement = rb_define_class_under(
- paludis_module(), "FromRepositoryRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_from_repository_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_from_repository_requirement, "name", RUBY_FUNC_CAST(
- &from_repository_requirement_name), 0);
-
- /*
- * Document-class: Paludis::InstalledAtPathRequirement
- *
- * Represents a ::/ path requirement in a PackageDepSpec.
- */
- c_installed_at_path_requirement = rb_define_class_under(
- paludis_module(), "InstalledAtPathRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_installed_at_path_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_installed_at_path_requirement, "path", RUBY_FUNC_CAST(
- &installed_at_path_requirement_path), 0);
-
- /*
- * Document-class: Paludis::InstallableToPathRequirement
- *
- * Represents a ::/? path requirement in a PackageDepSpec.
- */
- c_installable_to_path_requirement = rb_define_class_under(
- paludis_module(), "InstallableToPathRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_installable_to_path_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_installable_to_path_requirement, "path", RUBY_FUNC_CAST(
- &installable_to_path_requirement_path), 0);
- rb_define_method(c_installable_to_path_requirement, "include_masked?", RUBY_FUNC_CAST(
- &installable_to_path_requirement_include_masked), 0);
-
- /*
- * Document-class: Paludis::InstallableToRepositoryRequirement
- *
- * Represents a ::repo? repository requirement in a PackageDepSpec.
- */
- c_installable_to_repository_requirement = rb_define_class_under(
- paludis_module(), "InstallableToRepositoryRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_installable_to_repository_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_installable_to_repository_requirement, "name", RUBY_FUNC_CAST(
- &installable_to_repository_requirement_name), 0);
- rb_define_method(c_installable_to_repository_requirement, "include_masked?", RUBY_FUNC_CAST(
- &installable_to_repository_requirement_include_masked), 0);
-
- /*
- * Document-class: Paludis::AnySlotRequirement
- *
- * Represents a :* or := requirement in a PackageDepSpec.
- */
- c_any_slot_requirement = rb_define_class_under(
- paludis_module(), "AnySlotRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_any_slot_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_any_slot_requirement, "locking?", RUBY_FUNC_CAST(
- &any_slot_requirement_locking), 0);
-
- /*
- * Document-class: Paludis::ExactSlotRequirement
- *
- * Represents a :slot or :=slot requirement in a PackageDepSpec.
- */
- c_exact_slot_requirement = rb_define_class_under(
- paludis_module(), "ExactSlotRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_exact_slot_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_exact_slot_requirement, "locked?", RUBY_FUNC_CAST(
- &exact_slot_requirement_locked), 0);
- rb_define_method(c_exact_slot_requirement, "name", RUBY_FUNC_CAST(
- &exact_slot_requirement_name), 0);
-
- /*
- * Document-class: Paludis::KeyRequirement
- *
- * Represents a [.key=value] requirement in a PackageDepSpec.
- */
- c_key_requirement = rb_define_class_under(
- paludis_module(), "KeyRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_key_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- rb_define_method(c_key_requirement, "key", RUBY_FUNC_CAST(
- &key_requirement_key), 0);
- rb_define_method(c_key_requirement, "pattern", RUBY_FUNC_CAST(
- &key_requirement_pattern), 0);
- rb_define_method(c_key_requirement, "operation", RUBY_FUNC_CAST(
- &key_requirement_operation), 0);
-
- /*
- * Document-module: Paludis::KeyRequirementOperation
- *
- * The operation for a KeyRequirement.
- */
- c_key_requirement_operation = rb_define_module_under(paludis_module(), "KeyRequirementOperation");
- for (KeyRequirementOperation l(static_cast<KeyRequirementOperation>(0)), l_end(last_kro) ; l != l_end ;
- l = static_cast<KeyRequirementOperation>(static_cast<int>(l) + 1))
- rb_define_const(c_key_requirement_operation, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
-
- // cc_enum_special<paludis/package_dep_spec_requirement-se.hh, KeyRequirement, c_key_requirement_operation>
-
- /*
- * Document-class: Paludis::ChoiceRequirement
- *
- * Represents a [flag] requirement in a PackageDepSpec.
- */
- c_choice_requirement = rb_define_class_under(
- paludis_module(), "ChoiceRequirement", c_package_dep_spec_requirement);
- rb_funcall(c_choice_requirement, rb_intern("private_class_method"), 1, rb_str_new2("new"));
- }
-}
-
-VALUE
-paludis::ruby::package_dep_spec_requirement_to_value(const std::shared_ptr<const PackageDepSpecRequirement> & m)
-{
- try
- {
- V v(m);
- m->accept(v);
- return v.value;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
-}
-
-RegisterRubyClass::Register paludis_ruby_register_package_dep_spec_requirement PALUDIS_ATTRIBUTE((used))
- (&do_register_package_dep_spec_requirement);
-
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 4900726df..cf749d216 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -384,8 +384,8 @@ paludis::ruby::value_to_match_package_options(VALUE v)
{
VALUE entry(rb_ary_entry(v, i));
Check_Type(entry, T_SYMBOL);
- if (SYM2ID(entry) == rb_intern("ignore_choice_requirements"))
- o += mpo_ignore_choice_requirements;
+ if (SYM2ID(entry) == rb_intern("ignore_additional_requirements"))
+ o += mpo_ignore_additional_requirements;
else
rb_raise(rb_eArgError, "Unknown MatchPackageOptions option '%s'", rb_obj_as_string(entry));
}
@@ -396,8 +396,8 @@ VALUE
paludis::ruby::match_package_options_to_value(const MatchPackageOptions & o)
{
VALUE a(rb_ary_new());
- if (o[mpo_ignore_choice_requirements])
- rb_ary_push(a, ID2SYM(rb_intern("ignore_choice_requirements")));
+ if (o[mpo_ignore_additional_requirements])
+ rb_ary_push(a, ID2SYM(rb_intern("ignore_additional_requirements")));
return a;
}
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index 0e2eb4636..aab1fb1c4 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -105,7 +105,6 @@ namespace paludis
VALUE choice_value_to_value(const std::shared_ptr<const ChoiceValue> & c);
VALUE match_package_options_to_value(const MatchPackageOptions & c);
VALUE bool_to_value(bool b);
- VALUE package_dep_spec_requirement_to_value(const std::shared_ptr<const PackageDepSpecRequirement> &);
VersionSpec value_to_version_spec(VALUE v);
std::shared_ptr<const PackageID> value_to_package_id(VALUE, bool nil_ok = false);