aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-11-08 20:21:36 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-11-08 20:21:36 +0000
commite251d1abc51475aa542cb0af72e45b2f0fa67752 (patch)
treed26a713e3462ae535dc5b897c40b3ddab76843e0
parentfa9fac2fc5edb475aa6802d406cbe8f0782a8e92 (diff)
downloadpaludis-e251d1abc51475aa542cb0af72e45b2f0fa67752.tar.gz
paludis-e251d1abc51475aa542cb0af72e45b2f0fa67752.tar.xz
(ruby) Add binding for InstallAction.
-rw-r--r--ruby/Makefile.am3
-rw-r--r--ruby/action.cc339
-rw-r--r--ruby/action_TEST.rb53
-rwxr-xr-xruby/action_TEST_cleanup.sh14
-rwxr-xr-xruby/action_TEST_setup.sh137
-rw-r--r--ruby/paludis_ruby.cc10
6 files changed, 508 insertions, 48 deletions
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 2b19aad..1afcce6 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -67,7 +67,8 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
package_id_TEST_setup.sh package_id_TEST_cleanup.sh \
paludis_ruby_TEST_setup.sh paludis_ruby_TEST_cleanup.sh \
- repository_TEST_setup.sh repository_TEST_cleanup.sh
+ repository_TEST_setup.sh repository_TEST_cleanup.sh \
+ action_TEST_setup.sh action_TEST_cleanup.sh
TESTS_ENVIRONMENT = env \
TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
diff --git a/ruby/action.cc b/ruby/action.cc
index 6b247f9..f1fcfb1 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -34,6 +34,7 @@ namespace
static VALUE c_supports_fetch_action_test;
static VALUE c_supports_info_action_test;
static VALUE c_supports_config_action_test;
+ static VALUE c_supports_install_action_test;
static VALUE c_action;
static VALUE c_fetch_action;
@@ -43,6 +44,25 @@ namespace
static VALUE c_info_action;
static VALUE c_config_action;
+ static VALUE c_install_action_options;
+ static VALUE c_install_action_debug_option;
+ static VALUE c_install_action_checks_option;
+ static VALUE c_install_action;
+
+ const bool
+ value_to_bool(VALUE v)
+ {
+ if (Qfalse == v || Qnil == v)
+ return false;
+ return true;
+ }
+
+ VALUE
+ bool_to_value(bool b)
+ {
+ return b ? Qtrue : Qfalse;
+ }
+
const FetchActionOptions
value_to_fetch_action_options(VALUE v)
{
@@ -73,6 +93,36 @@ namespace
}
}
+ const InstallActionOptions
+ value_to_install_action_options(VALUE v)
+ {
+ if (rb_obj_is_kind_of(v, c_install_action_options))
+ {
+ InstallActionOptions * v_ptr;
+ Data_Get_Struct(v, InstallActionOptions, v_ptr);
+ return *v_ptr;
+ }
+ else
+ {
+ rb_raise(rb_eTypeError, "Can't convert %s into InstallActionOptions", rb_obj_classname(v));
+ }
+ }
+
+ VALUE
+ install_action_options_to_value(const InstallActionOptions & m)
+ {
+ InstallActionOptions * m_ptr(new InstallActionOptions(m));
+ try
+ {
+ return Data_Wrap_Struct(c_install_action_options, 0, &Common<InstallActionOptions>::free, m_ptr);
+ }
+ catch (const std::exception & e)
+ {
+ delete m_ptr;
+ exception_to_ruby_exception(e);
+ }
+ }
+
const FetchActionFailure
value_to_fetch_action_failure(VALUE v)
{
@@ -179,34 +229,6 @@ namespace
}
/*
- * Document-method: fetch_unneeded
- *
- * call-seq:
- * fetch_unneeded -> true or false
- */
- VALUE
- fetch_action_options_fetch_unneeded(VALUE self)
- {
- FetchActionOptions * p;
- Data_Get_Struct(self, FetchActionOptions, p);
- return p->fetch_unneeded ? Qtrue : Qfalse;
- }
-
- /*
- * Document-method: safe_resume
- *
- * call-seq:
- * safe_resume -> true or false
- */
- VALUE
- fetch_action_options_safe_resume(VALUE self)
- {
- FetchActionOptions * p;
- Data_Get_Struct(self, FetchActionOptions, p);
- return p->safe_resume ? Qtrue : Qfalse;
- }
-
- /*
* call-seq:
* FetchAction.new -> FetchAction
*/
@@ -267,17 +289,17 @@ namespace
VALUE v0 = (rb_hash_aref(argv[0], ID2SYM(rb_intern("target_file"))));
v_target_file = StringValuePtr(v0);
v_requires_manual_fetching =
- rb_hash_aref(argv[0], ID2SYM(rb_intern("requires_manual_fetching"))) != Qfalse;
+ value_to_bool(rb_hash_aref(argv[0], ID2SYM(rb_intern("requires_manual_fetching"))));
v_failed_automatic_fetching =
- rb_hash_aref(argv[0], ID2SYM(rb_intern("failed_automatic_fetching"))) != Qfalse;
+ value_to_bool(rb_hash_aref(argv[0], ID2SYM(rb_intern("failed_automatic_fetching"))));
VALUE v1 = rb_hash_aref(argv[0], ID2SYM(rb_intern("failed_integrity_checks")));
v_failed_integrity_checks = StringValuePtr(v1);
}
else if (4 == argc)
{
v_target_file = StringValuePtr(argv[0]);
- v_requires_manual_fetching = argv[1] != Qfalse;
- v_failed_automatic_fetching = argv[2] != Qfalse;
+ v_requires_manual_fetching = value_to_bool(argv[1]);
+ v_failed_automatic_fetching = value_to_bool(argv[2]);
v_failed_integrity_checks = StringValuePtr(argv[3]);
}
else
@@ -330,28 +352,50 @@ namespace
};
/*
+ * Document-method: fetch_unneeded?
+ *
+ * call-seq:
+ * fetch_unneeded -> true or false
+ */
+ /*
+ * Document-method: safe_resume?
+ *
+ * call-seq:
+ * safe_resume -> true or false
+ */
+ /*
* Document-method: requires_manual_fetching?
*
- * call-seq: requires_manual_fetching? -> true or false
+ * call-seq:
+ * requires_manual_fetching? -> true or false
*
* Do we require manual fetching?
*/
/*
* Document-method: failed_automatic_fetching?
*
- * call-seq: failed_automatic_fetching? -> true or false
+ * call-seq:
+ * failed_automatic_fetching? -> true or false
*
* Did we fail automatic fetching?
*/
- template <bool FetchActionFailure::* m_>
- struct FailureBoolFetch
+ /*
+ * Document-method: no_config_protect?
+ *
+ * call-seq:
+ * no_config_protect? -> true or false
+ *
+ * Do we ignore config protection.
+ */
+ template <typename T_, bool T_::* m_>
+ struct BoolFetch
{
static VALUE
fetch(VALUE self)
{
- FetchActionFailure * ptr;
- Data_Get_Struct(self, FetchActionFailure, ptr);
- return (((*ptr).*m_)) != Qfalse;
+ T_ * p;
+ Data_Get_Struct(self, T_, p);
+ return bool_to_value((*p).*m_);
}
};
@@ -384,6 +428,149 @@ namespace
}
};
+ /*
+ * call-seq:
+ * InstallActionOptions.new(fetch_unneeded, safe_resume) -> InstallActionOptions
+ * InstallActionOptions.new(Hash) -> InstallActionOptions
+ *
+ * InstallActionOptions.new can either be called with all parameters in order, or with one hash
+ * parameter, where the hash keys are symbols with the names above.
+ */
+ VALUE
+ install_action_options_new(int argc, VALUE *argv, VALUE self)
+ {
+ InstallActionOptions * ptr(0);
+ try
+ {
+ bool v_no_config_protect;
+ InstallActionDebugOption v_debug_build;
+ InstallActionChecksOption v_checks;
+ tr1::shared_ptr<Repository> v_destination;
+
+ if (1 == argc && rb_obj_is_kind_of(argv[0], rb_cHash))
+ {
+ if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("no_config_protect"))))
+ rb_raise(rb_eArgError, "Missing Parameter: no_config_protect");
+ if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("debug_build"))))
+ rb_raise(rb_eArgError, "Missing Parameter: debug_build");
+ if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("checks"))))
+ rb_raise(rb_eArgError, "Missing Parameter: checks");
+ if (Qnil == rb_hash_aref(argv[0], ID2SYM(rb_intern("destination"))))
+ rb_raise(rb_eArgError, "Missing Parameter: destination");
+ v_no_config_protect =
+ value_to_bool(rb_hash_aref(argv[0], ID2SYM(rb_intern("no_config_protect"))));
+ v_debug_build = static_cast<InstallActionDebugOption>(NUM2INT(
+ rb_hash_aref(argv[0], ID2SYM(rb_intern("debug_build")))
+ ));
+ v_checks = static_cast<InstallActionChecksOption>(NUM2INT(
+ rb_hash_aref(argv[0], ID2SYM(rb_intern("checks")))
+ ));
+ v_destination = value_to_repository(rb_hash_aref(argv[0], ID2SYM(rb_intern("destination"))));
+ }
+ else if (4 == argc)
+ {
+ v_no_config_protect = value_to_bool(argv[0]);
+ v_debug_build = static_cast<InstallActionDebugOption>(NUM2INT(argv[1]));
+ v_checks = static_cast<InstallActionChecksOption>(NUM2INT(argv[2]));
+ v_destination = value_to_repository(argv[3]);
+ }
+ else
+ {
+ rb_raise(rb_eArgError, "InstallActionOptions expects one or four arguments, but got %d",argc);
+ }
+
+ ptr = new InstallActionOptions(InstallActionOptions::create()
+ .no_config_protect(v_no_config_protect)
+ .debug_build(v_debug_build)
+ .checks(v_checks)
+ .destination(v_destination)
+ );
+
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<InstallActionOptions>::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: debug_build
+ *
+ * call-seq:
+ * debug_build -> Fixnum
+ *
+ * Our InstallActionDebugOption
+ */
+ /*
+ * Document-method: checks
+ *
+ * call-seq:
+ * checks -> FixNum
+ *
+ * Our InstallActionChecksOption
+ *
+ */
+ template <typename T_, T_ InstallActionOptions::* m_>
+ struct IAOMember
+ {
+ static VALUE
+ fetch(VALUE self)
+ {
+ InstallActionOptions * p;
+ Data_Get_Struct(self, InstallActionOptions, p);
+ return INT2FIX((*p).*m_);
+ }
+ };
+
+ /*
+ * Document-method: destination
+ *
+ * call-seq:
+ * destination -> Repository
+ *
+ * Our destination
+ */
+ VALUE
+ install_action_options_destination(VALUE self)
+ {
+ InstallActionOptions * p;
+ Data_Get_Struct(self, InstallActionOptions, p);
+ return repository_to_value(p->destination);
+ }
+
+ /*
+ * call-seq:
+ * InstallAction.new -> InstallAction
+ */
+ VALUE
+ install_action_new(VALUE self, VALUE opts)
+ {
+ const InstallActionOptions opts_ptr(value_to_install_action_options(opts));
+ tr1::shared_ptr<Action> * a(
+ new tr1::shared_ptr<Action>(new InstallAction(opts_ptr)));
+ VALUE tdata(Data_Wrap_Struct(self, 0, &Common<tr1::shared_ptr<Action> >::free, a));
+ rb_obj_call_init(tdata, 1, &self);
+ return tdata;
+ }
+
+ /*
+ * call-seq:
+ * options -> InstallActionOptions
+ *
+ * Our InstallActionOptions.
+ */
+ VALUE
+ install_action_options(VALUE self)
+ {
+ tr1::shared_ptr<Action> * p;
+ Data_Get_Struct(self, tr1::shared_ptr<Action>, p);
+ return install_action_options_to_value(tr1::static_pointer_cast<InstallAction>(*p)->options);
+ }
+
void do_register_action()
{
/*
@@ -425,6 +612,16 @@ namespace
rb_define_method(c_supports_config_action_test, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
/*
+ * Document-class: Paludis::SupportsInstallActionTest
+ *
+ * Tests whether a Paludis::PackageID supports a Paludis::InstallAction.
+ */
+ c_supports_install_action_test = rb_define_class_under(paludis_module(), "SupportsInstallActionTest", c_supports_action_test_base);
+ rb_define_singleton_method(c_supports_install_action_test, "new",
+ RUBY_FUNC_CAST((&SupportsActionTestNew<InstallAction>::supports_action_test_new)), 0);
+ rb_define_method(c_supports_install_action_test, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
+
+ /*
* Document-class: Paludis::Action
*
* Base class for actions, used by Paludis::PackageID#perform_action.
@@ -450,8 +647,10 @@ namespace
c_fetch_action_options = rb_define_class_under(paludis_module(), "FetchActionOptions", rb_cObject);
rb_define_singleton_method(c_fetch_action_options, "new", RUBY_FUNC_CAST(&fetch_action_options_new), -1);
rb_define_method(c_fetch_action_options, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
- rb_define_method(c_fetch_action_options, "fetch_unneeded", RUBY_FUNC_CAST(&fetch_action_options_fetch_unneeded), 0);
- rb_define_method(c_fetch_action_options, "safe_resume", RUBY_FUNC_CAST(&fetch_action_options_safe_resume), 0);
+ rb_define_method(c_fetch_action_options, "fetch_unneeded?",
+ RUBY_FUNC_CAST((&BoolFetch<FetchActionOptions, &FetchActionOptions::fetch_unneeded>::fetch)), 0);
+ rb_define_method(c_fetch_action_options, "safe_resume?",
+ RUBY_FUNC_CAST((&BoolFetch<FetchActionOptions, &FetchActionOptions::safe_resume>::fetch)), 0);
/*
* Document-class: Paludis::FetchActionFailure
@@ -464,9 +663,9 @@ namespace
rb_define_method(c_fetch_action_failure, "target_file",
RUBY_FUNC_CAST((&FailureStringFetch<&FetchActionFailure::target_file>::fetch)), 0);
rb_define_method(c_fetch_action_failure, "requires_manual_fetching?",
- RUBY_FUNC_CAST((&FailureBoolFetch<&FetchActionFailure::requires_manual_fetching>::fetch)), 0);
+ RUBY_FUNC_CAST((&BoolFetch<FetchActionFailure, &FetchActionFailure::requires_manual_fetching>::fetch)), 0);
rb_define_method(c_fetch_action_failure, "failed_automatic_fetching?",
- RUBY_FUNC_CAST((&FailureBoolFetch<&FetchActionFailure::failed_automatic_fetching>::fetch)), 0);
+ RUBY_FUNC_CAST((&BoolFetch<FetchActionFailure, &FetchActionFailure::failed_automatic_fetching>::fetch)), 0);
rb_define_method(c_fetch_action_failure, "failed_integrity_checks",
RUBY_FUNC_CAST((&FailureStringFetch<&FetchActionFailure::failed_integrity_checks>::fetch)), 0);
@@ -489,6 +688,60 @@ namespace
rb_define_singleton_method(c_config_action, "new",
RUBY_FUNC_CAST((&EasyActionNew<ConfigAction>::easy_action_new)), 0);
rb_define_method(c_config_action, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
+
+ /*
+ * Document-module: Paludis::InstallActionDebugOption
+ *
+ * Debug build mode for an InstallAction.
+ *
+ * May be ignored by some repositories, and by packages where there isn't a sensible concept of debugging.
+ *
+ */
+ c_install_action_debug_option = rb_define_module_under(paludis_module(), "InstallActionDebugOption");
+ for (InstallActionDebugOption l(static_cast<InstallActionDebugOption>(0)), l_end(last_iado) ; l != l_end ;
+ l = static_cast<InstallActionDebugOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_install_action_debug_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/action-se.hh, InstallActionDebugOption, c_install_action_debug_option>
+
+ /*
+ * Document-module: Paludis::InstallActionChecksOption
+ *
+ * Whether to run post-build checks (for example, 'make check' or 'src_test'), if they are available.
+ *
+ */
+ c_install_action_checks_option = rb_define_module_under(paludis_module(), "InstallActionChecksOption");
+ for (InstallActionChecksOption l(static_cast<InstallActionChecksOption>(0)), l_end(last_iaco) ; l != l_end ;
+ l = static_cast<InstallActionChecksOption>(static_cast<int>(l) + 1))
+ rb_define_const(c_install_action_checks_option, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l));
+
+ // cc_enum_special<paludis/action-se.hh, InstallActionChecksOption, c_install_action_checks_option>
+
+ /*
+ * Document-class: Paludis::InstallActionOptions
+ *
+ * Options for Paludis::InstallAction.
+ */
+ c_install_action_options = rb_define_class_under(paludis_module(), "InstallActionOptions", rb_cObject);
+ rb_define_singleton_method(c_install_action_options, "new", RUBY_FUNC_CAST(&install_action_options_new), -1);
+ rb_define_method(c_install_action_options, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
+ rb_define_method(c_install_action_options, "no_config_protect?",
+ RUBY_FUNC_CAST((&BoolFetch<InstallActionOptions, &InstallActionOptions::no_config_protect>::fetch)), 0);
+ rb_define_method(c_install_action_options, "debug_build",
+ RUBY_FUNC_CAST((&IAOMember<InstallActionDebugOption, &InstallActionOptions::debug_build>::fetch)), 0);
+ rb_define_method(c_install_action_options, "checks",
+ RUBY_FUNC_CAST((&IAOMember<InstallActionChecksOption, &InstallActionOptions::checks>::fetch)), 0);
+ rb_define_method(c_install_action_options, "destination", RUBY_FUNC_CAST(&install_action_options_destination), 0);
+
+ /*
+ * Document-class: Paludis::InstallAction
+ *
+ * An InstallAction is used by InstallTask to perform a build / install on a PackageID.
+ */
+ c_install_action = rb_define_class_under(paludis_module(), "InstallAction", c_action);
+ rb_define_singleton_method(c_install_action, "new", RUBY_FUNC_CAST(&install_action_new), 1);
+ rb_define_method(c_install_action, "initialize", RUBY_FUNC_CAST(&empty_init), -1);
+ rb_define_method(c_install_action, "options", RUBY_FUNC_CAST(&install_action_options), 0);
}
}
diff --git a/ruby/action_TEST.rb b/ruby/action_TEST.rb
index 6409ac6..de00967 100644
--- a/ruby/action_TEST.rb
+++ b/ruby/action_TEST.rb
@@ -17,6 +17,8 @@
# Place, Suite 330, Boston, MA 02111-1307 USA
#
+ENV["PALUDIS_HOME"] = Dir.getwd().to_s + "/action_TEST_dir/home";
+
require 'test/unit'
require 'Paludis'
@@ -66,6 +68,49 @@ module Paludis
end
end
+ class TestCase_InstallActionOptions < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ end
+
+ def hash_args
+ InstallActionOptions.new(
+ {:no_config_protect => true, :debug_build => InstallActionDebugOption::Internal,
+ :checks => InstallActionChecksOption::Always, :destination => destination}
+ )
+ end
+
+ def long_args
+ InstallActionOptions.new(false, InstallActionDebugOption::Split,
+ InstallActionChecksOption::Default, destination)
+ end
+
+ def destination
+ @destination or @destination = FakeRepository.new(env, 'fake');
+ end
+
+ def test_create
+ assert_kind_of InstallActionOptions, long_args
+ assert_kind_of InstallActionOptions, hash_args
+ end
+
+ def test_methods_hash_args
+ opts = hash_args
+ assert opts.no_config_protect?
+ assert_equal InstallActionDebugOption::Internal, opts.debug_build
+ assert_equal InstallActionChecksOption::Always, opts.checks
+ assert_equal destination.name, opts.destination.name
+ end
+
+ def test_methods_long_args
+ opts = long_args
+ assert !opts.no_config_protect?
+ assert_equal InstallActionDebugOption::Split, opts.debug_build
+ assert_equal InstallActionChecksOption::Default, opts.checks
+ assert_equal destination.name, opts.destination.name
+ end
+ end
+
class TestCase_FetchActionFailure < Test::Unit::TestCase
def test_create
assert_kind_of FetchActionFailure, FetchActionFailure.new('target_file', false, false, 'fic')
@@ -120,12 +165,12 @@ module Paludis
def test_options
a = FetchAction.new(FetchActionOptions.new(false, true))
- assert_equal a.options.fetch_unneeded, false
- assert_equal a.options.safe_resume, true
+ assert !a.options.fetch_unneeded?
+ assert a.options.safe_resume?
a = FetchAction.new(FetchActionOptions.new({:safe_resume => false, :fetch_unneeded => true}))
- assert_equal a.options.fetch_unneeded, true
- assert_equal a.options.safe_resume, false
+ assert a.options.fetch_unneeded?
+ assert !a.options.safe_resume?
end
end
diff --git a/ruby/action_TEST_cleanup.sh b/ruby/action_TEST_cleanup.sh
new file mode 100755
index 0000000..2d6ea37
--- /dev/null
+++ b/ruby/action_TEST_cleanup.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d action_TEST_dir ] ; then
+ rm -fr action_TEST_dir
+else
+ true
+fi
+
+
+
+
+
+
diff --git a/ruby/action_TEST_setup.sh b/ruby/action_TEST_setup.sh
new file mode 100755
index 0000000..2611b94
--- /dev/null
+++ b/ruby/action_TEST_setup.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir action_TEST_dir || exit 1
+cd action_TEST_dir || exit 1
+
+mkdir -p home/.paludis/repositories
+
+cat <<END > home/.paludis/repositories/testrepo.conf
+location = `pwd`/testrepo
+format = ebuild
+names_cache = /var/empty
+cache = /var/empty
+profiles = \${location}/profiles/testprofile
+END
+
+cat <<END > home/.paludis/repositories/installed.conf
+location = `pwd`/installed
+format = vdb
+names_cache = /var/empty
+provides_cache = /var/empty
+END
+
+cat <<END > home/.paludis/keywords.conf
+*/* test
+~foo/bar-1 ~test
+END
+
+cat <<END > home/.paludis/use.conf
+*/* enabled
+~foo/bar-1 sometimes_enabled
+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 "stray" > stray
+
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+
+cat <<END > profiles/profiles.desc || exit 1
+x86 testprofile stable
+END
+
+cat <<END > profiles/package.mask || exit 1
+foo1/bar
+foo2/bar
+END
+
+cat <<END > profiles/testprofile/make.defaults || exit 1
+ARCH=test
+USERLAND=test
+KERNEL=test
+USE="test1 test2 -test5"
+END
+
+cat <<END > profiles/testprofile/package.mask || exit 1
+foo1/bar
+foo3/bar
+END
+
+cat <<END > profiles/testprofile/package.use || exit 1
+foo/bar -test2 test3
+END
+
+cat <<END > profiles/testprofile/use.mask || exit 1
+test4
+END
+
+cat <<END > profiles/testprofile/package.use.mask || exit 1
+foo/bar -test4 test5
+END
+
+cat <<END > profiles/testprofile/use.force || exit 1
+test6
+END
+
+cat <<END > profiles/testprofile/package.use.force || exit 1
+foo/bar test7
+END
+
+cat <<END > profiles/use.desc || exit 1
+test1 - A test use flag
+END
+
+cat <<END > profiles/use.local.desc || exit 1
+foo/bar:test2 - A test local use flag
+END
+
+touch foo/metadata.xml
+
+cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.pioto.org/"
+SRC_URI=""
+SLOT="0"
+IUSE="test1"
+LICENSE="GPL-2"
+KEYWORDS="test"
+END
+
+cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.pioto.org/"
+SRC_URI=""
+SLOT="0"
+IUSE="test2"
+LICENSE="GPL-2"
+KEYWORDS="~test"
+END
+cd ..
+
+mkdir -p installed/cat-one/pkg-one-1 || exit 1
+
+for i in SLOT EAPI; do
+ echo "0" >installed/cat-one/pkg-one-1/${i}
+done
+
+for i in DEPEND RDEPEND LICENSE INHERITED IUSE PDEPEND PROVIDE; do
+ touch installed/cat-one/pkg-one-1/${i}
+done
+
+echo "flag1 flag2" >>installed/cat-one/pkg-one-1/USE
+
+cat <<END >installed/cat-one/pkg-one-1/CONTENTS
+dir //test
+obj /test/test_file de54c26b0678df67aca147575523b3c2 1165250496
+sym /test/test_link -> /test/test_file 1165250496
+END
+
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index 2ecc231..44231dd 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -70,6 +70,7 @@ namespace
static VALUE c_fetch_action_error;
static VALUE c_info_action_error;
static VALUE c_config_action_error;
+ static VALUE c_install_action_error;
static VALUE c_action_error;
static VALUE c_environment;
@@ -188,6 +189,8 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
rb_raise(c_info_action_error, dynamic_cast<const paludis::InfoActionError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::ConfigActionError *>(&ee))
rb_raise(c_config_action_error, dynamic_cast<const paludis::ConfigActionError *>(&ee)->message().c_str());
+ else if (0 != dynamic_cast<const paludis::InstallActionError *>(&ee))
+ rb_raise(c_install_action_error, dynamic_cast<const paludis::InstallActionError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::ActionError *>(&ee))
rb_raise(c_action_error, dynamic_cast<const paludis::ActionError *>(&ee)->message().c_str());
@@ -378,6 +381,13 @@ void PALUDIS_VISIBLE paludis::ruby::init()
*/
c_config_action_error = rb_define_class_under(c_paludis_module, "ConfigActionError", c_action_error);
+ /*
+ * Document-class: Paludis::InstallActionError
+ *
+ * Thrown if a PackageID fails to perform a InstallAction.
+ */
+ c_install_action_error = rb_define_class_under(c_paludis_module, "InstallActionError", c_action_error);
+
rb_define_module_function(c_paludis_module, "match_package", RUBY_FUNC_CAST(&paludis_match_package), 3);
rb_define_const(c_paludis_module, "Version", rb_str_new2((stringify(PALUDIS_VERSION_MAJOR) + "."