aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-01-06 16:44:00 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-01-06 16:44:00 +0000
commit09e7a58466f24b36649640f066db306df812987f (patch)
treeaae78c78eb21b37e744042097246a5eb06f422dc
parent39717aab4c648eb9e4227c26d574fd99679816c8 (diff)
downloadpaludis-09e7a58466f24b36649640f066db306df812987f.tar.gz
paludis-09e7a58466f24b36649640f066db306df812987f.tar.xz
Add DepList to ruby binding.
-rw-r--r--ruby/Makefile.am22
-rw-r--r--ruby/dep_atom.cc16
-rw-r--r--ruby/dep_list.cc688
-rw-r--r--ruby/dep_list_TEST.rb168
-rwxr-xr-xruby/dep_list_TEST_cleanup.sh12
-rwxr-xr-xruby/dep_list_TEST_setup.sh71
-rw-r--r--ruby/paludis_ruby.cc22
-rw-r--r--ruby/paludis_ruby.hh1
8 files changed, 995 insertions, 5 deletions
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index cc2afea..b42a7e9 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -28,7 +28,8 @@ IF_RUBY_TESTS = \
version_metadata_TEST.rb \
portage_dep_parser_TEST.rb \
qualified_package_name_TEST.rb \
- contents_TEST.rb
+ contents_TEST.rb \
+ dep_list_TEST.rb
IF_RUBY_QA_TESTS = \
message_TEST.rb \
@@ -50,7 +51,8 @@ IF_RUBY_SOURCES = \
version_metadata.cc \
portage_dep_parser.cc \
qualified_package_name.cc \
- contents.cc
+ contents.cc \
+ dep_list.cc
IF_RUBY_QA_SOURCES = \
message.cc \
@@ -67,7 +69,8 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
version_metadata_TEST_setup.sh version_metadata_TEST_cleanup.sh \
paludis_ruby_TEST_setup.sh paludis_ruby_TEST_cleanup.sh \
qa_environment_TEST_setup.sh qa_environment_TEST_cleanup.sh \
- check_TEST_setup.sh check_TEST_cleanup.sh
+ check_TEST_setup.sh check_TEST_cleanup.sh \
+ dep_list_TEST_setup.sh dep_list_TEST_cleanup.sh
TESTS_ENVIRONMENT = env \
PALUDIS_NO_GLOBAL_HOOKS="yes" \
@@ -80,6 +83,7 @@ TESTS_ENVIRONMENT = env \
\`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/util/.libs\`: \
\`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/environment/default/.libs\`: \
\`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/environment/no_config/.libs\`: \
+ \`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/dep_list/.libs\`: \
\`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/qa/.libs\`: \
\`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/libxml/.libs\`" \
| tr -d ' '` \
@@ -100,6 +104,7 @@ BASE_OBJECTS = \
portage_dep_parser.o \
qualified_package_name.o \
contents.o \
+ dep_list.o \
paludis_ruby.o
if ENABLE_QA
@@ -169,6 +174,9 @@ qualified_package_name.o : qualified_package_name.cc paludis_ruby.hh
contents.o : contents.cc paludis_ruby.hh
$(OUR_CXXCOMPILE) -o $@ $(srcdir)/contents.cc
+dep_list.o : dep_list.cc paludis_ruby.hh
+ $(OUR_CXXCOMPILE) -o $@ $(srcdir)/dep_list.cc
+
message.o : message.cc paludis_ruby.hh
$(OUR_CXXCOMPILE) -o $@ $(srcdir)/message.cc
@@ -198,6 +206,7 @@ if ENABLE_QA
$(top_builddir)/paludis/.libs/libpaludis.so \
$(top_builddir)/paludis/environment/default/.libs/libpaludisdefaultenvironment.so \
$(top_builddir)/paludis/environment/no_config/.libs/libpaludisnoconfigenvironment.so \
+ $(top_builddir)/paludis/dep_list/.libs/libpaludisdeplist.so \
$(top_builddir)/paludis/qa/.libs/libpaludisqa.so \
$(top_builddir)/paludis/libxml/.libs/libpaludislibxml.so \
$(PCREPLUSPLUS_LIBS)
@@ -213,6 +222,7 @@ Paludis.so : $(OUR_OBJECTS)
-L$(top_builddir)/paludis/.libs/ -lpaludis \
-L$(top_builddir)/paludis/environment/default/.libs/ -lpaludisdefaultenvironment \
-L$(top_builddir)/paludis/environment/no_config/.libs/ -lpaludisnoconfigenvironment \
+ -L$(top_builddir)/paludis/dep_list/.libs -lpaludisdeplist \
-L$(top_builddir)/paludis/qa/.libs/ -lpaludisqa \
-L$(top_builddir)/paludis/libxml/.libs/ -lpaludislibxml \
$(PCREPLUSPLUS_LIBS)
@@ -230,7 +240,8 @@ else
$(top_builddir)/paludis/util/.libs/libpaludisutil.so \
$(top_builddir)/paludis/.libs/libpaludis.so \
$(top_builddir)/paludis/environment/default/.libs/libpaludisdefaultenvironment.so \
- $(top_builddir)/paludis/environment/no_config/.libs/libpaludisnoconfigenvironment.so
+ $(top_builddir)/paludis/environment/no_config/.libs/libpaldisnoconfigenvironment.so \
+ $(top_builddir)/paludis/dep_list/.libs/libpaludisdeplist.so
Paludis.so : $(OUR_OBJECTS)
$(CXX) -fPIC -shared $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
@@ -242,7 +253,8 @@ Paludis.so : $(OUR_OBJECTS)
-L$(top_builddir)/paludis/util/.libs/ -lpaludisutil \
-L$(top_builddir)/paludis/.libs/ -lpaludis \
-L$(top_builddir)/paludis/environment/default/.libs/ -lpaludisdefaultenvironment \
- -L$(top_builddir)/paludis/environment/no_config/.libs/ -lpaludisnoconfigenvironment
+ -L$(top_builddir)/paludis/environment/no_config/.libs/ -lpaludisnoconfigenvironment \
+ -L$(top_builddir)/paludis/dep_list/.libs -lpaludisdeplist
endif
diff --git a/ruby/dep_atom.cc b/ruby/dep_atom.cc
index 0570ee2..9ad29fd 100644
--- a/ruby/dep_atom.cc
+++ b/ruby/dep_atom.cc
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Richard Brown <mynamewasgone@gmail.com>
*
* 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
@@ -340,6 +341,21 @@ paludis::ruby::value_to_package_dep_atom(VALUE v)
}
}
+DepAtom::ConstPointer
+paludis::ruby::value_to_dep_atom(VALUE v)
+{
+ if (rb_obj_is_kind_of(v, c_dep_atom))
+ {
+ DepAtom::ConstPointer * v_ptr;
+ Data_Get_Struct(v, DepAtom::ConstPointer, v_ptr);
+ return *v_ptr;
+ }
+ else
+ {
+ rb_raise(rb_eTypeError, "Can't convert %s into PackageDepAtom", rb_obj_classname(v));
+ }
+}
+
VALUE
paludis::ruby::dep_atom_to_value(DepAtom::ConstPointer m)
{
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
new file mode 100644
index 0000000..769045d
--- /dev/null
+++ b/ruby/dep_list.cc
@@ -0,0 +1,688 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Richard Brown <mynamewasgone@gmail.com>
+ *
+ * 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/dep_list/dep_list.hh>
+#include <ruby.h>
+
+using namespace paludis;
+using namespace paludis::ruby;
+
+#define RUBY_FUNC_CAST(x) reinterpret_cast<VALUE (*)(...)>(x)
+
+namespace
+{
+ static VALUE c_dep_list_target_type;
+ static VALUE c_dep_list_reinstall_option;
+ static VALUE c_dep_list_fall_back_option;
+ static VALUE c_dep_list_reinstall_scm_option;
+ static VALUE c_dep_list_upgrade_option;
+ static VALUE c_dep_list_new_slots_option;
+ static VALUE c_dep_list_deps_option;
+ static VALUE c_dep_list_circular_option;
+ static VALUE c_dep_list_entry_state;
+ static VALUE c_dep_list_options;
+ static VALUE c_dep_list;
+ static VALUE c_dep_list_entry;
+
+ DepListOptions
+ value_to_dep_list_options(VALUE v)
+ {
+ if (rb_obj_is_kind_of(v, c_dep_list_options))
+ {
+ DepListOptions * v_ptr;
+ Data_Get_Struct(v, DepListOptions, v_ptr);
+ return *v_ptr;
+ }
+ else
+ {
+ rb_raise(rb_eTypeError, "Can't convert %s into DepListOptions", rb_obj_classname(v));
+ }
+ }
+
+ VALUE
+ dep_list_entry_to_value(const DepListEntry & v)
+ {
+ DepListEntry * vv(new DepListEntry(v));
+ return Data_Wrap_Struct(c_dep_list_entry, 0, &Common<DepListEntry>::free, vv);
+ }
+
+ VALUE
+ dep_list_options_init(int, VALUE *, VALUE self)
+ {
+ return self;
+ }
+
+ VALUE
+ dep_list_options_new(int argc, VALUE *argv, VALUE self)
+ {
+ DepListOptions * ptr(0);
+ try
+ {
+ if (14 == argc)
+ {
+ int value_for_reinstall = NUM2INT(argv[0]);
+ int value_for_reinstall_scm = NUM2INT(argv[1]);
+ int value_for_target_type = NUM2INT(argv[2]);
+ int value_for_upgrade = NUM2INT(argv[3]);
+ int value_for_new_slots = NUM2INT(argv[4]);
+ int value_for_fall_back = NUM2INT(argv[5]);
+ int value_for_installed_deps_pre = NUM2INT(argv[6]);
+ int value_for_installed_deps_runtime = NUM2INT(argv[7]);
+ int value_for_installed_deps_post = NUM2INT(argv[8]);
+ int value_for_uninstalled_deps_pre = NUM2INT(argv[9]);
+ int value_for_uninstalled_deps_runtime = NUM2INT(argv[10]);
+ int value_for_uninstalled_deps_post = NUM2INT(argv[11]);
+ int value_for_circular = NUM2INT(argv[12]);
+ bool value_for_dependency_tags = Qtrue == argv[13] ? true : false;
+
+ if (value_for_reinstall< 0|| value_for_reinstall>= last_dl_reinstall)
+ rb_raise(rb_eArgError, "DepListReinstallOption out of range");
+ if (value_for_reinstall_scm< 0|| value_for_reinstall_scm>= last_dl_reinstall_scm)
+ rb_raise(rb_eArgError, "DepListReinstallScmOption out of range");
+ if (value_for_target_type< 0|| value_for_target_type>= last_dl_target)
+ rb_raise(rb_eArgError, "DepListTargetType out of range");
+ if (value_for_upgrade< 0|| value_for_upgrade>= last_dl_upgrade)
+ rb_raise(rb_eArgError, "DepListUpgradeOption out of range");
+ if (value_for_new_slots< 0|| value_for_new_slots>= last_dl_new_slots)
+ rb_raise(rb_eArgError, "DepListNewSlotsOption out of range");
+ if (value_for_fall_back< 0|| value_for_fall_back>= last_dl_fall_back)
+ rb_raise(rb_eArgError, "DepListFallBack out of range");
+ if (value_for_installed_deps_pre< 0|| value_for_installed_deps_pre>= last_dl_deps)
+ rb_raise(rb_eArgError, "DepListDepsOption out of range");
+ if (value_for_installed_deps_runtime< 0|| value_for_installed_deps_runtime>= last_dl_deps)
+ rb_raise(rb_eArgError, "DepListDepsOption out of range");
+ if (value_for_installed_deps_post< 0|| value_for_installed_deps_post>= last_dl_deps)
+ rb_raise(rb_eArgError, "DepListDepsOption out of range");
+ if (value_for_uninstalled_deps_pre< 0|| value_for_uninstalled_deps_pre>= last_dl_deps)
+ rb_raise(rb_eArgError, "DepListDepsOption out of range");
+ if (value_for_uninstalled_deps_runtime< 0|| value_for_uninstalled_deps_runtime>= last_dl_deps)
+ rb_raise(rb_eArgError, "DepListDepsOption out of range");
+ if (value_for_uninstalled_deps_post< 0|| value_for_uninstalled_deps_post>= last_dl_deps)
+ rb_raise(rb_eArgError, "DepListDepsOption out of range");
+ if (value_for_circular< 0|| value_for_circular>= last_dl_circular)
+ rb_raise(rb_eArgError, "DepListReinstallScmOption out of range");
+
+ ptr = new DepListOptions(static_cast<DepListReinstallOption>(value_for_reinstall),
+ static_cast<DepListReinstallScmOption>(value_for_reinstall_scm),
+ static_cast<DepListTargetType>(value_for_target_type),
+ static_cast<DepListUpgradeOption>(value_for_upgrade),
+ static_cast<DepListNewSlotsOption>(value_for_new_slots),
+ static_cast<DepListFallBackOption>(value_for_fall_back),
+ static_cast<DepListDepsOption>(value_for_installed_deps_pre),
+ static_cast<DepListDepsOption>(value_for_installed_deps_runtime),
+ static_cast<DepListDepsOption>(value_for_installed_deps_post),
+ static_cast<DepListDepsOption>(value_for_uninstalled_deps_pre),
+ static_cast<DepListDepsOption>(value_for_uninstalled_deps_runtime),
+ static_cast<DepListDepsOption>(value_for_uninstalled_deps_post),
+ static_cast<DepListCircularOption>(value_for_circular),
+ value_for_dependency_tags
+ );
+ }
+ else
+ {
+ rb_raise(rb_eArgError, "DepListOptions expects fourteen arguments, but got %d",argc);
+ }
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<DepListOptions>::free, ptr));
+ rb_obj_call_init(tdata, argc, argv);
+ return tdata;
+ }
+ catch (const std::exception & e)
+ {
+ delete ptr;
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * Document-method: reinstall
+ *
+ * call-seq:
+ * reinstall -> DepListReinstallOption
+ *
+ * Our DepListReinstallOption
+ */
+ /*
+ * Document-method: reinstall_scm
+ *
+ * call-seq:
+ * reinstall_scm -> DepListReinstallScmOption
+ *
+ * Our DepListReinstallScmOption
+ */
+ /*
+ * Document-method: target
+ *
+ * call-seq:
+ * target -> DepListTargetType
+ *
+ * Our DepListTargetType
+ */
+ /*
+ * Document-method: upgrade
+ *
+ * call-seq:
+ * upgrade -> DepListUpgradeOption
+ *
+ * Our DepListUpgradeOption
+ */
+ /*
+ * Document-method: new_slots
+ *
+ * call-seq:
+ * new_slots -> DepListNewSlotsOption
+ *
+ * Our DepListNewSlotsOption
+ */
+ /*
+ * Document-method: fall_back
+ *
+ * call-seq:
+ * fall_back -> DepListFallBackOption
+ *
+ * Our DepListFallBackOption
+ */
+ /*
+ * Document-method: installed_deps_pre
+ *
+ * call-seq:
+ * installed_deps_pre -> DepListDepsOption
+ *
+ * Our installed_deps_runtime
+ */
+ /*
+ * Document-method: installed_deps_runtime
+ *
+ * call-seq:
+ * installed_deps_runtime -> DepListDepsOption
+ *
+ * Our installed_deps_runtime
+ */
+ /*
+ * Document-method: installed_deps_post
+ *
+ * call-seq:
+ * installed_deps_post -> DepListDepsOption
+ *
+ * Our installed_deps_post
+ */
+ /*
+ * Document-method: uninstalled_deps_pre
+ *
+ * call-seq:
+ * uninstalled_deps_pre -> DepListDepsOption
+ *
+ * Our uninstalled_deps_runtime
+ */
+ /*
+ * Document-method: uninstalled_deps_runtime
+ *
+ * call-seq:
+ * uninstalled_deps_runtime -> DepListDepsOption
+ *
+ * Our uninstalled_deps_runtime
+ */
+ /*
+ * Document-method: uninstalled_deps_post
+ *
+ * call-seq:
+ * uninstalled_deps_post -> DepListDepsOption
+ *
+ * Our uninstalled_deps_post
+ */
+ /*
+ * Document-method: circular
+ *
+ * call-seq:
+ * circular -> DepListCircularOption
+ *
+ * Our DepListCircularOption
+ */
+ template <typename T_, T_ DepListOptions::* m_>
+ struct OptionsMember
+ {
+ static VALUE
+ fetch(VALUE self)
+ {
+ DepListOptions * p;
+ Data_Get_Struct(self, DepListOptions, p);
+ return INT2NUM(p->*m_);
+ }
+ };
+
+ /*
+ * call-seq:
+ * dependancy_tags -> true or false
+ *
+ * Out dependency_tags
+ */
+ VALUE
+ dep_list_options_dependency_tags(VALUE self)
+ {
+ DepListOptions * p;
+ Data_Get_Struct(self, DepListOptions, p);
+ return p->dependency_tags ? Qtrue : Qfalse;
+ }
+
+ VALUE
+ dep_list_init(int, VALUE *, VALUE self)
+ {
+ return self;
+ }
+
+ /*
+ * call-seq:
+ * new(environment, dep_list_options) -> DepList
+ *
+ * Create a new DepList
+ */
+ VALUE
+ dep_list_new(int argc, VALUE *argv, VALUE self)
+ {
+ DepList * ptr(0);
+ try
+ {
+ if (2 == argc)
+ {
+ ptr = new DepList(value_to_environment_data(argv[0])->env_ptr,
+ value_to_dep_list_options(argv[1]));
+ }
+ else
+ {
+ rb_raise(rb_eArgError, "DepList expects two arguments, but got %d",argc);
+ }
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<DepList>::free, ptr));
+ rb_obj_call_init(tdata, argc, argv);
+ return tdata;
+ }
+ catch (const std::exception & e)
+ {
+ delete ptr;
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * add(dep_atom)
+ *
+ * Add the packages required to resolve an additional dependency atom.
+ */
+ VALUE
+ dep_list_add(VALUE self, VALUE da)
+ {
+ try
+ {
+ DepList * p;
+ Data_Get_Struct(self, DepList, p);
+ p->add(value_to_dep_atom(da));
+ return self;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * clear
+ *
+ * Clear the list.
+ */
+ VALUE
+ dep_list_clear(VALUE self)
+ {
+ DepList * p;
+ Data_Get_Struct(self, DepList, p);
+ p->clear();
+ return self;
+ }
+
+ /*
+ * call-seq:
+ * already_installed?(dep_atom)
+ *
+ * Is an atom structure already installed?
+ */
+ VALUE
+ dep_list_already_installed(VALUE self, VALUE da)
+ {
+ DepList * p;
+ Data_Get_Struct(self, DepList, p);
+ return p->already_installed(value_to_dep_atom(da)) ? Qtrue : Qfalse;
+ }
+
+ /*
+ * call-seq:
+ * each {|dep_list_entry| block}
+ *
+ * Iterate over our DepListEntrys
+ */
+ VALUE
+ dep_list_each(VALUE self)
+ {
+ DepList * p;
+ Data_Get_Struct(self, DepList, p);
+ for (DepList::Iterator i(p->begin()), i_end(p->end()) ; i != i_end ; ++i)
+ rb_yield(dep_list_entry_to_value(*i));
+ return self;
+ }
+
+ /*
+ * call-seq:
+ * package -> PackageDatabaseEntry
+ *
+ * Our PackageDatabaseEntry.
+ */
+ VALUE
+ dep_list_entry_package(VALUE self)
+ {
+ try
+ {
+ DepListEntry * p;
+ Data_Get_Struct(self, DepListEntry, p);
+ return(package_database_entry_to_value(p->package));
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * metadata -> VersionMetadata
+ *
+ * Our VersionMetadata.
+ */
+ VALUE
+ dep_list_entry_metadata(VALUE self)
+ {
+ try
+ {
+ DepListEntry * p;
+ Data_Get_Struct(self, DepListEntry, p);
+ return(version_metadata_to_value(p->metadata));
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * destinations -> Array
+ *
+ * Our destinations repostiories.
+ */
+ VALUE
+ dep_list_entry_destinations(VALUE self)
+ {
+ try
+ {
+ DepListEntry * p;
+ Data_Get_Struct(self, DepListEntry, p);
+
+ VALUE result(rb_ary_new());
+ for (RepositoryNameCollection::Iterator r(p->destinations->begin()),
+ r_end(p->destinations->end()) ; r != r_end ; ++r)
+ rb_ary_push(result, rb_str_new2(stringify(*r).c_str()));
+
+ return result;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * entry_state -> DepListEntryState
+ *
+ * Our DepListEntryState.
+ */
+ VALUE
+ dep_list_entry_state(VALUE self)
+ {
+ try
+ {
+ DepListEntry * p;
+ Data_Get_Struct(self, DepListEntry, p);
+ return INT2NUM(p->state);
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ /*
+ * call-seq:
+ * skip_install -> true or false
+ *
+ * Our skip_install.
+ */
+ VALUE
+ dep_list_entry_skip_install(VALUE self)
+ {
+ try
+ {
+ DepListEntry * p;
+ Data_Get_Struct(self, DepListEntry, p);
+ return p->skip_install == true ? Qtrue : Qfalse;
+ }
+ catch (const std::exception & e)
+ {
+ exception_to_ruby_exception(e);
+ }
+ }
+
+ void do_register_dep_list()
+ {
+ /*
+ * Document-module: Paludis::DepListTargetType
+ *
+ * What type of target are we handling at the top level.
+ *
+ */
+ c_dep_list_target_type = rb_define_module_under(paludis_module(), "DepListTargetType");
+ for (DepListTargetType l(static_cast<DepListTargetType>(0)), l_end(last_dl_target) ; l != l_end ;
+ l = static_cast<DepListTargetType>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_target_type, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListTargetType, c_dep_list_target_type>
+
+ /*
+ * Document-module: Paludis::DepListReinstallOption
+ *
+ * What should we reinstall.
+ *
+ */
+ c_dep_list_reinstall_option = rb_define_module_under(paludis_module(), "DepListReinstallOption");
+ for (DepListReinstallOption l(static_cast<DepListReinstallOption>(0)), l_end(last_dl_reinstall) ; l != l_end ;
+ l = static_cast<DepListReinstallOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_reinstall_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListReinstallOption, c_dep_list_reinstall_option>
+
+ /*
+ * Document-module: Paludis::DepListFallBackOption
+ *
+ * When can we fall back to installed?
+ *
+ */
+ c_dep_list_fall_back_option = rb_define_module_under(paludis_module(), "DepListFallBackOption");
+ for (DepListFallBackOption l(static_cast<DepListFallBackOption>(0)), l_end(last_dl_fall_back) ; l != l_end ;
+ l = static_cast<DepListFallBackOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_fall_back_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListFallBackOption, c_dep_list_fall_back_option>
+
+ /*
+ * Document-module: Paludis::DepListReinstallScmOption
+ *
+ * When should we reinstall scm.
+ *
+ */
+ c_dep_list_reinstall_scm_option = rb_define_module_under(paludis_module(), "DepListReinstallScmOption");
+ for (DepListReinstallScmOption l(static_cast<DepListReinstallScmOption>(0)), l_end(last_dl_reinstall_scm) ; l != l_end ;
+ l = static_cast<DepListReinstallScmOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_reinstall_scm_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListReinstalScmlOption, c_dep_list_reinstall_scm_option>
+
+ /*
+ * Document-module: Paludis::DepListUpgradeOption
+ *
+ * When should we upgrade.
+ *
+ */
+ c_dep_list_upgrade_option = rb_define_module_under(paludis_module(), "DepListUpgradeOption");
+ for (DepListUpgradeOption l(static_cast<DepListUpgradeOption>(0)), l_end(last_dl_upgrade) ; l != l_end ;
+ l = static_cast<DepListUpgradeOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_upgrade_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListUpgradeOption, c_dep_list_upgrade_option>
+
+ /*
+ * Document-module: Paludis::DepListNewSlotsOption
+ *
+ * When should we pull in a new slot.
+ *
+ */
+ c_dep_list_new_slots_option = rb_define_module_under(paludis_module(), "DepListNewSlotsOption");
+ for (DepListNewSlotsOption l(static_cast<DepListNewSlotsOption>(0)), l_end(last_dl_new_slots) ; l != l_end ;
+ l = static_cast<DepListNewSlotsOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_new_slots_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListNewSlotsOption, c_dep_list_new_slots_option>
+
+ /*
+ * Document-module: Paludis::DepListDepsOption
+ *
+ * How should we handle a dep class.
+ *
+ */
+ c_dep_list_deps_option = rb_define_module_under(paludis_module(), "DepListDepsOption");
+ for (DepListDepsOption l(static_cast<DepListDepsOption>(0)), l_end(last_dl_deps) ; l != l_end ;
+ l = static_cast<DepListDepsOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_deps_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListDepsOption, c_dep_list_deps_option>
+
+ /*
+ * Document-module: Paludis::DepListCircularOption
+ *
+ * How we handle circular deps.
+ *
+ */
+ c_dep_list_circular_option = rb_define_module_under(paludis_module(), "DepListCircularOption");
+ for (DepListCircularOption l(static_cast<DepListCircularOption>(0)), l_end(last_dl_circular) ; l != l_end ;
+ l = static_cast<DepListCircularOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_circular_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListCircularOption, c_dep_list_circular_option>
+
+ /*
+ * Document-module: Paludis::DepListEntryState
+ *
+ * State of a DepListEntry.
+ *
+ */
+ c_dep_list_entry_state= rb_define_module_under(paludis_module(), "DepListEntryState");
+ for (DepListEntryState l(static_cast<DepListEntryState>(0)), l_end(last_dle) ; l != l_end ;
+ l = static_cast<DepListEntryState>(static_cast<int>(l) + 1))
+ rb_define_const(c_dep_list_entry_state, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/dep_list/dep_list.hh, DepListEntryState, c_dep_list_entry_state>
+
+ /*
+ * Document-class: Paludis::DepListOptions
+ *
+ * Parameters for a DepList.
+ */
+ c_dep_list_options = rb_define_class_under(paludis_module(), "DepListOptions", rb_cObject);
+ rb_define_singleton_method(c_dep_list_options, "new", RUBY_FUNC_CAST(&dep_list_options_new), -1);
+ rb_define_method(c_dep_list_options, "initialize", RUBY_FUNC_CAST(&dep_list_options_init), -1);
+ rb_define_method(c_dep_list_options, "reinstall",
+ RUBY_FUNC_CAST((&OptionsMember<DepListReinstallOption, &DepListOptions::reinstall>::fetch)),0);
+ rb_define_method(c_dep_list_options, "reinstall_scm",
+ RUBY_FUNC_CAST((&OptionsMember<DepListReinstallScmOption, &DepListOptions::reinstall_scm>::fetch)),0);
+ rb_define_method(c_dep_list_options, "target_type",
+ RUBY_FUNC_CAST((&OptionsMember<DepListTargetType, &DepListOptions::target_type>::fetch)),0);
+ rb_define_method(c_dep_list_options, "upgrade",
+ RUBY_FUNC_CAST((&OptionsMember<DepListUpgradeOption, &DepListOptions::upgrade>::fetch)),0);
+ rb_define_method(c_dep_list_options, "new_slots",
+ RUBY_FUNC_CAST((&OptionsMember<DepListNewSlotsOption, &DepListOptions::new_slots>::fetch)),0);
+ rb_define_method(c_dep_list_options, "fall_back",
+ RUBY_FUNC_CAST((&OptionsMember<DepListFallBackOption, &DepListOptions::fall_back>::fetch)),0);
+ rb_define_method(c_dep_list_options, "installed_deps_pre",
+ RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, &DepListOptions::installed_deps_pre>::fetch)),0);
+ rb_define_method(c_dep_list_options, "installed_deps_runtime",
+ RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, &DepListOptions::installed_deps_runtime>::fetch)),0);
+ rb_define_method(c_dep_list_options, "installed_deps_post",
+ RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, &DepListOptions::installed_deps_post>::fetch)),0);
+ rb_define_method(c_dep_list_options, "uninstalled_deps_pre",
+ RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, &DepListOptions::uninstalled_deps_pre>::fetch)),0);
+ rb_define_method(c_dep_list_options, "uninstalled_deps_runtime",
+ RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, &DepListOptions::uninstalled_deps_runtime>::fetch)),0);
+ rb_define_method(c_dep_list_options, "uninstalled_deps_post",
+ RUBY_FUNC_CAST((&OptionsMember<DepListDepsOption, &DepListOptions::installed_deps_post>::fetch)),0);
+ rb_define_method(c_dep_list_options, "circular",
+ RUBY_FUNC_CAST((&OptionsMember<DepListCircularOption, &DepListOptions::circular>::fetch)),0);
+
+ rb_define_method(c_dep_list_options, "dependency_tags", RUBY_FUNC_CAST(&dep_list_options_dependency_tags),0);
+
+ /*
+ * Document-class: Paludis::DepList
+ *
+ * Holds a list of dependencies in merge order. Includes Enumerable[http://www.ruby-doc.org/core/classes/Enumerable.html],
+ * but not Comparable.
+ */
+ c_dep_list= rb_define_class_under(paludis_module(), "DepList", rb_cObject);
+ rb_define_singleton_method(c_dep_list, "new", RUBY_FUNC_CAST(&dep_list_new), -1);
+ rb_define_method(c_dep_list, "initialize", RUBY_FUNC_CAST(&dep_list_init), -1);
+ rb_define_method(c_dep_list, "add", RUBY_FUNC_CAST(&dep_list_add), 1);
+ rb_define_method(c_dep_list, "clear", RUBY_FUNC_CAST(&dep_list_clear), 0);
+ rb_define_method(c_dep_list, "already_installed?", RUBY_FUNC_CAST(&dep_list_already_installed), 1);
+ rb_define_method(c_dep_list, "each", RUBY_FUNC_CAST(&dep_list_each), 0);
+ rb_include_module(c_dep_list, rb_mEnumerable);
+
+ /*
+ * Document-class Paludis::DepListEntry
+ *
+ * An entry in a DepList.
+ */
+ c_dep_list_entry = rb_define_class_under(paludis_module(), "DepListEntry", rb_cObject);
+ rb_funcall(c_dep_list_entry, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_dep_list_entry, "package", RUBY_FUNC_CAST(&dep_list_entry_package),0);
+ rb_define_method(c_dep_list_entry, "metadata", RUBY_FUNC_CAST(&dep_list_entry_metadata),0);
+ rb_define_method(c_dep_list_entry, "destinations", RUBY_FUNC_CAST(&dep_list_entry_destinations),0);
+ rb_define_method(c_dep_list_entry, "state", RUBY_FUNC_CAST(&dep_list_entry_state),0);
+ rb_define_method(c_dep_list_entry, "skip_install", RUBY_FUNC_CAST(&dep_list_entry_skip_install),0);
+ }
+}
+
+
+RegisterRubyClass::Register paludis_ruby_register_dep_list PALUDIS_ATTRIBUTE((used))
+ (&do_register_dep_list);
+
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
new file mode 100644
index 0000000..bea3dd0
--- /dev/null
+++ b/ruby/dep_list_TEST.rb
@@ -0,0 +1,168 @@
+#!/usr/bin/env ruby
+# vim: set sw=4 sts=4 et tw=80 :
+
+#
+# Copyright (c) 2007 Richard Brown <mynamewasgone@gmail.com>
+#
+# 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
+#
+
+ENV['PALUDIS_HOME'] = Dir.getwd() + '/dep_list_TEST_dir/home'
+
+require 'test/unit'
+require 'Paludis'
+
+Paludis::Log.instance.log_level = Paludis::LogLevel::Warning
+
+module Paludis
+ module Shared
+ def dlo
+ DepListOptions.new(
+ DepListReinstallOption::ReinstallAlways,
+ DepListReinstallScmOption::ReinstallScmAlways,
+ DepListTargetType::TargetPackage,
+ DepListUpgradeOption::UpgradeAlways,
+ DepListNewSlotsOption::NewSlotsAlways,
+ DepListFallBackOption::FallBackAsNeededExceptTargets,
+ DepListDepsOption::DepsDiscard,
+ DepListDepsOption::DepsDiscard,
+ DepListDepsOption::DepsDiscard,
+ DepListDepsOption::DepsDiscard,
+ DepListDepsOption::DepsDiscard,
+ DepListDepsOption::DepsDiscard,
+ DepListCircularOption::CircularDiscard,
+ false
+ )
+ end
+
+ def env
+ DefaultEnvironment.instance
+ end
+
+ def dl
+ DepList.new(env,dlo)
+ end
+
+ def pda
+ PackageDepAtom.new('foo/bar')
+ end
+ end
+
+ class TestCase_DepListOptions < Test::Unit::TestCase
+ include Shared
+
+ def options_hash
+ {
+ :reinstall => DepListReinstallOption::ReinstallAlways,
+ :reinstall_scm => DepListReinstallScmOption::ReinstallScmAlways,
+ :target_type => DepListTargetType::TargetPackage,
+ :upgrade => DepListUpgradeOption::UpgradeAlways,
+ :new_slots => DepListNewSlotsOption::NewSlotsAlways,
+ :fall_back => DepListFallBackOption::FallBackAsNeededExceptTargets,
+ :installed_deps_pre => DepListDepsOption::DepsDiscard,
+ :installed_deps_runtime => DepListDepsOption::DepsDiscard,
+ :installed_deps_post => DepListDepsOption::DepsDiscard,
+ :uninstalled_deps_pre => DepListDepsOption::DepsDiscard,
+ :uninstalled_deps_runtime => DepListDepsOption::DepsDiscard,
+ :uninstalled_deps_post => DepListDepsOption::DepsDiscard,
+ :circular => DepListCircularOption::CircularDiscard,
+ :dependency_tags => false
+ }
+ end
+
+ def test_create
+ assert_nothing_raised do
+ dlo
+ end
+ end
+
+ def test_respond_to
+ options = dlo
+ options_hash.each_pair do |method, value|
+ assert_respond_to options, method
+ assert_equal value, options.send(method)
+ end
+ end
+ end
+
+ class TestCase_DepList < Test::Unit::TestCase
+ include Shared
+
+ def test_create
+ assert_nothing_raised do
+ dl
+ end
+ end
+
+ def test_respond
+ dep_list = dl
+ [:add, :clear, :already_installed?, :each].each {|sym| assert_respond_to dep_list, sym}
+ end
+
+ def test_add
+ assert_nothing_raised do
+ dl.add(pda)
+ end
+ end
+
+ def test_clear
+ assert_nothing_raised do
+ dl.clear
+ end
+ end
+
+ def test_already_installed?
+ dep_atom = pda
+ dep_list = dl
+ assert !dep_list.already_installed?(dep_atom)
+ dep_list.add(dep_atom)
+ assert dep_list.already_installed?(dep_atom)
+ end
+
+ def test_each
+ assert_kind_of DepListEntry, dl.add(pda).entries.first
+ end
+
+ def test_errors
+ assert_raise AllMaskedError do
+ dl.add(PackageDepAtom.new('foo/ba'))
+ end
+ end
+ end
+
+ class TestCase_DepListEntry < Test::Unit::TestCase
+ include Shared
+
+ def dle
+ dl.add(pda).entries.first
+ end
+
+ def test_create
+ assert_raise NoMethodError do
+ DepListEntry.new
+ end
+ end
+
+ def test_methods
+ dep_list_entry = dle
+ {:package => PackageDatabaseEntry, :metadata => VersionMetadata,
+ :destinations => Array, :state=> Integer}.each_pair do |method, returns|
+
+ assert_respond_to dep_list_entry, method
+ assert_kind_of returns, dep_list_entry.send(method)
+ end
+ assert_respond_to dep_list_entry, :skip_install
+ end
+ end
+end
diff --git a/ruby/dep_list_TEST_cleanup.sh b/ruby/dep_list_TEST_cleanup.sh
new file mode 100755
index 0000000..ee4aa20
--- /dev/null
+++ b/ruby/dep_list_TEST_cleanup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d dep_list_TEST_dir ] ; then
+ rm -fr dep_list_TEST_dir
+else
+ true
+fi
+
+
+
+
diff --git a/ruby/dep_list_TEST_setup.sh b/ruby/dep_list_TEST_setup.sh
new file mode 100755
index 0000000..6707c4e
--- /dev/null
+++ b/ruby/dep_list_TEST_setup.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir dep_list_TEST_dir || exit 1
+cd dep_list_TEST_dir || exit 1
+
+mkdir -p home/.paludis/repositories
+
+cat <<END > home/.paludis/repositories/testrepo.conf
+location = `pwd`/testrepo
+format = portage
+names_cache = /var/empty
+cache = /var/empty
+profiles = \${location}/profiles/testprofile
+END
+
+cat <<END > home/.paludis/keywords.conf
+* test
+~foo/bar-1.0 ~test
+END
+
+cat <<END > home/.paludis/use.conf
+* enabled
+~foo/bar-1.0 sometimes_enabled
+END
+
+cat <<END > home/.paludis/package_mask.conf
+=foo/bar-3*
+END
+
+cat <<END > home/.paludis/licenses.conf
+* *
+END
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+END
+
+cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+END
+
+cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="~test"
+END
+cd ..
+
+
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 4cc8003..3f3082d 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006, 2007 Richard Brown <mynamewasgone@gmail.com>
*
* 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
@@ -20,6 +21,7 @@
#include <paludis/paludis.hh>
#include <paludis_ruby.hh>
#include <paludis/config_file.hh>
+#include <paludis/dep_list/dep_list.hh>
#include <ruby.h>
#include <list>
#include <ctype.h>
@@ -62,6 +64,11 @@ namespace
static VALUE c_dep_string_nesting_error;
static VALUE c_configuration_error;
static VALUE c_config_file_error;
+ static VALUE c_dep_list_error;
+ static VALUE c_all_masked_error;
+ static VALUE c_block_error;
+ static VALUE c_circular_dependency_error;
+ static VALUE c_use_requirements_not_met_error;
static VALUE c_environment;
static VALUE c_no_config_environment;
@@ -154,6 +161,16 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
rb_raise(c_dep_string_parse_error, dynamic_cast<const paludis::DepStringParseError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::DepStringError *>(&ee))
rb_raise(c_dep_string_error, dynamic_cast<const paludis::DepStringError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::AllMaskedError *>(&ee))
+ rb_raise(c_all_masked_error, dynamic_cast<const paludis::AllMaskedError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::BlockError *>(&ee))
+ rb_raise(c_block_error, dynamic_cast<const paludis::BlockError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::CircularDependencyError *>(&ee))
+ rb_raise(c_circular_dependency_error, dynamic_cast<const paludis::CircularDependencyError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::UseRequirementsNotMetError *>(&ee))
+ rb_raise(c_use_requirements_not_met_error, dynamic_cast<const paludis::UseRequirementsNotMetError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::DepListError *>(&ee))
+ rb_raise(c_dep_list_error, dynamic_cast<const paludis::DepListError *>(&ee)->message().c_str());
#ifdef ENABLE_RUBY_QA
else if (0 != dynamic_cast<const paludis::qa::NoSuchFileCheckTypeError *>(&ee))
rb_raise(c_no_such_file_check_type_error, dynamic_cast<const paludis::qa::NoSuchFileCheckTypeError *>(&ee)->message().c_str());
@@ -254,6 +271,11 @@ extern "C"
c_dep_string_nesting_error = rb_define_class_under(c_paludis_module, "DepStringNestingError", c_dep_string_parse_error);
c_configuration_error = rb_define_class_under(c_paludis_module, "ConfigurationError", rb_eRuntimeError);
c_config_file_error = rb_define_class_under(c_paludis_module, "ConfigFileError", c_configuration_error);
+ c_dep_list_error = rb_define_class_under(c_paludis_module, "DepListError", rb_eRuntimeError);
+ c_all_masked_error = rb_define_class_under(c_paludis_module, "AllMaskedError", c_dep_list_error);
+ c_block_error = rb_define_class_under(c_paludis_module, "BlockError", c_dep_list_error);
+ c_circular_dependency_error = rb_define_class_under(c_paludis_module, "CircularDependencyError", c_dep_list_error);
+ c_use_requirements_not_met_error = rb_define_class_under(c_paludis_module, "UseRequirementsNotMetError", c_dep_list_error);
rb_define_module_function(c_paludis_module, "match_package", RUBY_FUNC_CAST(&paludis_match_package), 3);
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index d6f9124..c1b7b4e 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -94,6 +94,7 @@ namespace paludis
VersionSpec value_to_version_spec(VALUE v);
VersionMetadata::ConstPointer value_to_version_metadata(VALUE);
PackageDepAtom::ConstPointer value_to_package_dep_atom(VALUE v);
+ DepAtom::ConstPointer value_to_dep_atom(VALUE v);
QualifiedPackageName value_to_qualified_package_name(VALUE v);
PackageDatabaseEntry value_to_package_database_entry(VALUE v);
EnvironmentData* value_to_environment_data(VALUE v);