aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-14 20:04:40 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-15 10:42:03 +0100
commite53ad79f17aed32bd5b95c64d9976af2cf59dd39 (patch)
tree628e318d09207316a45e4d8e6db550df76061824
parent09083171a3c5ea3d3d019e4724c8a02488f3eebb (diff)
downloadpaludis-e53ad79f17aed32bd5b95c64d9976af2cf59dd39.tar.gz
paludis-e53ad79f17aed32bd5b95c64d9976af2cf59dd39.tar.xz
Update Ruby bindings for parse_user_package_dep_spec changes (continued)
-rw-r--r--ruby/Makefile.am1
-rw-r--r--ruby/dep_list_TEST.rb2
-rw-r--r--ruby/dep_spec.cc40
-rw-r--r--ruby/dep_spec_TEST.rb43
-rwxr-xr-xruby/dep_spec_TEST_setup.sh6
-rw-r--r--ruby/dep_tag_TEST.rb2
-rw-r--r--ruby/environment_TEST.rb33
-rw-r--r--ruby/generator_TEST.rb11
-rwxr-xr-xruby/generator_TEST_cleanup.sh9
-rwxr-xr-xruby/generator_TEST_setup.sh34
-rw-r--r--ruby/paludis_ruby.cc11
-rw-r--r--ruby/paludis_ruby_TEST.rb12
-rw-r--r--ruby/qualified_package_name_TEST.rb4
-rw-r--r--ruby/repository_TEST.rb5
14 files changed, 164 insertions, 49 deletions
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 240dc6b..5a08bc2 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -78,6 +78,7 @@ EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \
dep_list_TEST_setup.sh dep_list_TEST_cleanup.sh \
environment_TEST_setup.sh environment_TEST_cleanup.sh \
find_unused_packages_task_TEST_setup.sh find_unused_packages_task_TEST_cleanup.sh \
+ generator_TEST_setup.sh generator_TEST_cleanup.sh \
nice_names.nn \
package_database_TEST_setup.sh package_database_TEST_cleanup.sh \
package_id_TEST_setup.sh package_id_TEST_cleanup.sh \
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
index edba6f1..4b93eae 100644
--- a/ruby/dep_list_TEST.rb
+++ b/ruby/dep_list_TEST.rb
@@ -118,7 +118,7 @@ module Paludis
end
def pda
- Paludis::parse_user_package_dep_spec('foo/bar', [])
+ Paludis::parse_user_package_dep_spec('foo/bar', env, [])
end
def dd
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 0d1aa3c..19496f9 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -826,35 +826,55 @@ namespace
* Document-method: parse_user_package_dep_spec
*
* call-seq:
- * parse_user_package_dep_spec(String, Array) -> PackageDepSpec
+ * parse_user_package_dep_spec(String, Env, Array) -> PackageDepSpec
+ * parse_user_package_dep_spec(String, Env, Array, Filter) -> PackageDepSpec
*
* Return a PackageDepSpec parsed from user input. The second parameter is either an empty
- * array, or [ :allow_wildcards ] to allow wildcards.
+ * array, or can contain :allow_wildcards to allow wildcards, :throw_if_set to get a
+ * GotASetNotAPackageDepSpec exception if the string is a set name and :no_disambiguation
+ * to disallow disambiguation (require an explicit category). The Filter, if
+ * provided, is used to restrict disambiguation as per
+ * PackageDatabase#fetch_unique_qualified_package_name.
*
*/
- VALUE paludis_parse_user_dep_spec(VALUE, VALUE str, VALUE opts)
+ VALUE paludis_parse_user_dep_spec(int argc, VALUE * argv, VALUE)
{
std::tr1::shared_ptr<const WrappedSpecBase> * ptr(0);
+ if (argc < 3 || argc > 4)
+ rb_raise(rb_eArgError, "parse_user_package_dep_spec expects three to four arguments, but got %d", argc);
+
try
{
- std::string s(StringValuePtr(str));
+ std::string s(StringValuePtr(argv[0]));
+ std::tr1::shared_ptr<Environment> e(value_to_environment(argv[1]));
- Check_Type(opts, T_ARRAY);
+ Check_Type(argv[2], T_ARRAY);
UserPackageDepSpecOptions o;
- for (unsigned i(0) ; i < RARRAY(opts)->len ; ++i)
+ for (int i(0) ; i < RARRAY(argv[2])->len ; ++i)
{
- VALUE entry(rb_ary_entry(opts, i));
+ VALUE entry(rb_ary_entry(argv[2], i));
Check_Type(entry, T_SYMBOL);
if (SYM2ID(entry) == rb_intern("allow_wildcards"))
o += updso_allow_wildcards;
+ else if (SYM2ID(entry) == rb_intern("throw_if_set"))
+ o += updso_throw_if_set;
+ else if (SYM2ID(entry) == rb_intern("no_disambiguation"))
+ o += updso_no_disambiguation;
else
rb_raise(rb_eArgError, "Unknown parse_user_package_dep_spec option '%s'", rb_obj_as_string(entry));
}
+ Filter f(
+ argc >= 4 ?
+ value_to_filter(argv[3]) :
+ filter::All()
+ );
+
ptr = new std::tr1::shared_ptr<const WrappedSpecBase>(new WrappedSpec<PackageDepSpec>(
- make_shared_ptr(new PackageDepSpec(parse_user_package_dep_spec(s, o)))));
- return Data_Wrap_Struct(c_package_dep_spec, 0, &Common<std::tr1::shared_ptr<const WrappedSpecBase> >::free, ptr);
+ make_shared_ptr(new PackageDepSpec(parse_user_package_dep_spec(s, e.get(), o, f)))));
+ return Data_Wrap_Struct(c_package_dep_spec, 0,
+ &Common<std::tr1::shared_ptr<const WrappedSpecBase> >::free, ptr);
}
catch (const std::exception & e)
{
@@ -1159,7 +1179,7 @@ namespace
// 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), 2);
+ rb_define_module_function(paludis_module(), "parse_user_package_dep_spec", RUBY_FUNC_CAST(&paludis_parse_user_dep_spec), -1);
}
}
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 9b77651..c9ee229 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -42,12 +42,16 @@ module Paludis
end
class TestCase_PackageDepSpec < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ end
+
def pda
- Paludis::parse_user_package_dep_spec('>=foo/bar-1:100::testrepo[a][-b]', [])
+ Paludis::parse_user_package_dep_spec('>=foo/bar-1:100::testrepo[a][-b]', env, [])
end
def pdb
- Paludis::parse_user_package_dep_spec('*/bar', [:allow_wildcards])
+ Paludis::parse_user_package_dep_spec('*/bar', env, [:allow_wildcards])
end
def test_create
@@ -60,16 +64,19 @@ module Paludis
v = PackageDepSpec.new("foo")
end
assert_raise PackageDepSpecError do
- Paludis::parse_user_package_dep_spec("=sys-apps/foo", [])
+ Paludis::parse_user_package_dep_spec("=sys-apps/foo", env, [])
end
assert_raise TypeError do
- Paludis::parse_user_package_dep_spec("sys-apps/foo", {})
+ Paludis::parse_user_package_dep_spec("sys-apps/foo", env, {})
end
assert_raise TypeError do
- Paludis::parse_user_package_dep_spec("sys-apps/foo", ["foo"])
+ Paludis::parse_user_package_dep_spec("sys-apps/foo", env, ["foo"])
end
assert_raise ArgumentError do
- Paludis::parse_user_package_dep_spec("sys-apps/foo", [:unknown])
+ Paludis::parse_user_package_dep_spec("sys-apps/foo", env, [:unknown])
+ end
+ assert_raise TypeError do
+ Paludis::parse_user_package_dep_spec("sys-apps/foo", env, [], "foo")
end
assert_raise ArgumentError do
Paludis::parse_user_package_dep_spec("sys-apps/foo")
@@ -86,6 +93,21 @@ module Paludis
assert_equal "*/bar", pdb.text
end
+ def test_disambiguate
+ assert_equal Paludis::parse_user_package_dep_spec("foo", env, []).to_s, "bar/foo"
+ assert_raise NoSuchPackageError do
+ Paludis::parse_user_package_dep_spec("foo", env, [], Filter::SupportsAction.new(InstalledAction))
+ end
+ assert_raise AmbiguousPackageNameError do
+ Paludis::parse_user_package_dep_spec("bar", env, [])
+ end
+ assert_raise AmbiguousPackageNameError do
+ Paludis::parse_user_package_dep_spec("bar", env, [], Filter::All.new())
+ end
+ assert_equal Paludis::parse_user_package_dep_spec("bar", env, [],
+ Filter::SupportsAction.new(InstallAction)).to_s, "foo/bar"
+ end
+
### def test_slot
### assert_equal "100", pda.slot
### assert_nil pdb.slot
@@ -170,8 +192,12 @@ module Paludis
end
class TestCase_BlockDepSpec < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ end
+
def test_create
- v = BlockDepSpec.new(Paludis::parse_user_package_dep_spec(">=foo/bar-1", []))
+ v = BlockDepSpec.new(Paludis::parse_user_package_dep_spec(">=foo/bar-1", env, []))
end
def test_create_error
@@ -185,7 +211,8 @@ module Paludis
end
def test_blocked_spec
- assert_equal "foo/baz", BlockDepSpec.new(Paludis::parse_user_package_dep_spec("foo/baz", [])).blocked_spec.to_s
+ assert_equal "foo/baz", BlockDepSpec.new(Paludis::parse_user_package_dep_spec(
+ "foo/baz", env, [])).blocked_spec.to_s
end
end
diff --git a/ruby/dep_spec_TEST_setup.sh b/ruby/dep_spec_TEST_setup.sh
index 9f90744..4eac2ae 100755
--- a/ruby/dep_spec_TEST_setup.sh
+++ b/ruby/dep_spec_TEST_setup.sh
@@ -18,7 +18,7 @@ cat <<END > home/.paludis/environment.conf
world = /dev/null
END
-mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files,bar/foo/files} || exit 1
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar,bar/foo,bar/bar} || exit 1
cd testrepo || exit 1
echo "testrepo" > profiles/repo_name || exit 1
cat <<END > profiles/categories || exit 1
@@ -57,3 +57,7 @@ PLATFORMS="test"
DEPENDENCIES=""
END
+cat <<"END" > bar/bar/bar-1.0.ebuild || exit 1
+EAPI="giant-space-monkey"
+END
+
diff --git a/ruby/dep_tag_TEST.rb b/ruby/dep_tag_TEST.rb
index d45955d..170f48c 100644
--- a/ruby/dep_tag_TEST.rb
+++ b/ruby/dep_tag_TEST.rb
@@ -38,7 +38,7 @@ module Paludis
def get_dt
DependencyDepTag.new(env[Selection::RequireExactlyOne.new(Generator::All.new)].last,
- Paludis::parse_user_package_dep_spec('foo/bar', []))
+ Paludis::parse_user_package_dep_spec('foo/bar', env, []))
end
def test_create
diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb
index e54e4a4..70ca56b 100644
--- a/ruby/environment_TEST.rb
+++ b/ruby/environment_TEST.rb
@@ -80,7 +80,7 @@ module Paludis
def test_query_use
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert env.query_use("enabled", pid)
assert ! env.query_use("not_enabled", pid)
@@ -104,7 +104,7 @@ module Paludis
def pid
env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
end
def test_accept_license
@@ -112,7 +112,7 @@ module Paludis
assert !env.accept_license('Failure', pid)
pid2 = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/baz-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/baz-1.0::testrepo', env, [])))].first
assert env.accept_license('GPL-2', pid2)
assert env.accept_license('Failure', pid2)
end
@@ -131,7 +131,7 @@ module Paludis
def pid
env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
end
def test_accept_keywords
@@ -160,7 +160,7 @@ module Paludis
def test_query_use
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert ! env.query_use("foo", pid)
end
@@ -199,26 +199,26 @@ module Paludis
def test_adapt_use
pid = env[Selection::RequireExactlyOne.new(
- Generator::Matches.new(Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Generator::Matches.new(Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert env.query_use("enabled", pid)
assert ! env.query_use("not_enabled", pid)
assert env.query_use("sometimes_enabled", pid)
- env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', []), 'enabled', false);
+ env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', env, []), 'enabled', false);
assert ! env.query_use('enabled', pid);
- env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', []), 'not_enabled', true);
+ env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', env, []), 'not_enabled', true);
assert env.query_use("not_enabled", pid)
- env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', []), 'sometimes_enabled', false);
+ env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', env, []), 'sometimes_enabled', false);
assert ! env.query_use("sometimes_enabled", pid)
end
def test_adapt_use_bad
assert_raise TypeError do
- env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', []), 'not_enabled', 'lemon');
+ env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', env, []), 'not_enabled', 'lemon');
end
assert_raise TypeError do
- env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', []), 7, false);
+ env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', env, []), 7, false);
end
end
end
@@ -230,11 +230,11 @@ module Paludis
def test_clear_adaptions
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert env.query_use("enabled", pid)
- env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', []), 'enabled', false);
+ env.adapt_use(Paludis::parse_user_package_dep_spec('foo/bar', env, []), 'enabled', false);
assert ! env.query_use('enabled', pid);
env.clear_adaptions;
@@ -425,11 +425,11 @@ module Paludis
end
def pda
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0', [])
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0', env, [])
end
def pda2
- Paludis::parse_user_package_dep_spec('foo/bar', [])
+ Paludis::parse_user_package_dep_spec('foo/bar', env, [])
end
def test_arg_count
@@ -495,7 +495,8 @@ module Paludis
assert_equal pid.repository_name, pid2.repository_name
- a = env[Selection::AllVersionsUnsorted.new(Generator::Matches.new(Paludis::parse_user_package_dep_spec('>=foo/bar-27', [])))]
+ a = env[Selection::AllVersionsUnsorted.new(Generator::Matches.new(Paludis::parse_user_package_dep_spec(
+ '>=foo/bar-27', env, [])))]
assert a.empty?
a = env[Selection::AllVersionsUnsorted.new(Generator::Matches.new(pda2) | Filter::SupportsAction.new(InstalledAction))]
diff --git a/ruby/generator_TEST.rb b/ruby/generator_TEST.rb
index 12456fb..9f1e994 100644
--- a/ruby/generator_TEST.rb
+++ b/ruby/generator_TEST.rb
@@ -21,6 +21,8 @@
require 'test/unit'
require 'Paludis'
+ENV['PALUDIS_HOME'] = Dir.getwd() + '/generator_TEST_dir/home'
+
module Paludis
class TestCase_Generator < Test::Unit::TestCase
def test_no_create
@@ -43,14 +45,19 @@ module Paludis
end
class TestCase_GeneratorMatches < Test::Unit::TestCase
+ def env
+ @env or @env = EnvironmentMaker.instance.make_from_spec("")
+ end
+
def test_create
assert_nothing_raised do
- Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", []))
+ Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, []))
end
end
def test_to_s
- assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", [])).to_s, "packages matching a/b"
+ assert_equal Generator::Matches.new(Paludis::parse_user_package_dep_spec("a/b", env, [])).to_s,
+ "packages matching a/b"
end
end
diff --git a/ruby/generator_TEST_cleanup.sh b/ruby/generator_TEST_cleanup.sh
new file mode 100755
index 0000000..edfb61c
--- /dev/null
+++ b/ruby/generator_TEST_cleanup.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d generator_TEST_dir ] ; then
+ rm -fr generator_TEST_dir
+else
+ true
+fi
+
diff --git a/ruby/generator_TEST_setup.sh b/ruby/generator_TEST_setup.sh
new file mode 100755
index 0000000..9b720e9
--- /dev/null
+++ b/ruby/generator_TEST_setup.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir generator_TEST_dir || exit 1
+cd generator_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/environment.conf
+world = /dev/null
+END
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+END
+
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index aa18ec0..07e49ea 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -75,6 +75,7 @@ namespace
static VALUE c_uninstall_action_error;
static VALUE c_action_error;
static VALUE c_bad_version_operator_error;
+ static VALUE c_got_a_set_not_a_package_dep_spec;
/*
* Document-method: match_package
@@ -180,6 +181,8 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
if (0 != dynamic_cast<const paludis::InternalError *>(&ee))
rb_raise(rb_eRuntimeError, "Unexpected paludis::InternalError: %s (%s)",
dynamic_cast<const paludis::InternalError *>(&ee)->message().c_str(), ee.what());
+ else if (0 != dynamic_cast<const paludis::GotASetNotAPackageDepSpec *>(&ee))
+ rb_raise(c_got_a_set_not_a_package_dep_spec, dynamic_cast<const paludis::GotASetNotAPackageDepSpec *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::BadVersionSpecError *>(&ee))
rb_raise(c_bad_version_spec_error, dynamic_cast<const paludis::BadVersionSpecError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::SetNameError *>(&ee))
@@ -473,6 +476,14 @@ void PALUDIS_VISIBLE paludis::ruby::init()
c_uninstall_action_error = rb_define_class_under(c_paludis_module, "UninstallActionError", c_action_error);
/*
+ * Document-class: Paludis::GotASetNotAPackageDepSpec
+ *
+ * Thrown if parse_user_package_dep_spec gets a set.
+ */
+ c_got_a_set_not_a_package_dep_spec = rb_define_class_under(c_paludis_module, "GotASetNotAPackageDepSpec",
+ rb_eRuntimeError);
+
+ /*
* Document-class: Paludis::BadVersionOperatorError
*
* Thrown if a bad version operator is encountered
diff --git a/ruby/paludis_ruby_TEST.rb b/ruby/paludis_ruby_TEST.rb
index 4d6f7c9..f46d785 100644
--- a/ruby/paludis_ruby_TEST.rb
+++ b/ruby/paludis_ruby_TEST.rb
@@ -39,10 +39,10 @@ module Paludis
def test_match_package
env = EnvironmentMaker.instance.make_from_spec("")
- spec_good = Paludis::parse_user_package_dep_spec('>=foo/bar-1', [])
- spec_bad = Paludis::parse_user_package_dep_spec('>=foo/bar-2', [])
+ spec_good = Paludis::parse_user_package_dep_spec('>=foo/bar-1', env, [])
+ spec_bad = Paludis::parse_user_package_dep_spec('>=foo/bar-2', env, [])
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert Paludis::match_package(env, spec_good, pid)
assert !Paludis::match_package(env, spec_bad, pid)
@@ -53,16 +53,16 @@ module Paludis
env = EnvironmentMaker.instance.make_from_spec("")
world = env.set('world')
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert Paludis::match_package_in_set(env, world, pid)
end
def test_type_errors
env = EnvironmentMaker.instance.make_from_spec("")
- spec = Paludis::parse_user_package_dep_spec('>=foo/bar-1', [])
+ spec = Paludis::parse_user_package_dep_spec('>=foo/bar-1', env, [])
pid = env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-1.0::testrepo', env, [])))].first
assert_raise TypeError do
Paludis::match_package(spec,spec,pid)
diff --git a/ruby/qualified_package_name_TEST.rb b/ruby/qualified_package_name_TEST.rb
index 0ca6e0f..8acf27a 100644
--- a/ruby/qualified_package_name_TEST.rb
+++ b/ruby/qualified_package_name_TEST.rb
@@ -2,7 +2,7 @@
# vim: set sw=4 sts=4 et tw=80 :
#
-# Copyright (c) 2006, 2007 Ciaran McCreesh
+# Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
# Copyright (c) 2008 Richard Brown
#
# This file is part of the Paludis package manager. Paludis is free software;
@@ -96,7 +96,7 @@ module Paludis
def test_to_value_type_error
assert_raise TypeError do
- QualifiedPackageName.new('foo-bar/baz') <=> Paludis::parse_user_package_dep_spec('foo-bar/baz', [])
+ QualifiedPackageName.new('foo-bar/baz') <=> 0
end
end
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index 53f9b1d..9433a5b 100644
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -55,7 +55,7 @@ module Paludis
def p
env[Selection::RequireExactlyOne.new(Generator::Matches.new(
- Paludis::parse_user_package_dep_spec('=foo/bar-2.0::testrepo', [])))].first
+ Paludis::parse_user_package_dep_spec('=foo/bar-2.0::testrepo', env, [])))].first
end
def installed_pid
@@ -184,7 +184,8 @@ module Paludis
end
def test_get_environment_variable
- pid = env[Selection::BestVersionOnly.new(Generator::Matches.new(Paludis::parse_user_package_dep_spec('=foo/bar-1.0', [])))].first;
+ pid = env[Selection::BestVersionOnly.new(Generator::Matches.new(Paludis::parse_user_package_dep_spec(
+ '=foo/bar-1.0', env, [])))].first;
assert_equal "hello", repo.get_environment_variable(pid, "TEST_ENV_VAR")
assert_equal "", repo.get_environment_variable(pid, "TEST_UNSET_ENV_VAR")
end