aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-07-18 21:04:22 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-07-18 21:04:22 +0000
commitbaf73d121e213089dc6c016158d85dc8efe62aa9 (patch)
tree8c7de97ecdf81036c24d16a86f1fd8bf7ba1d447
parentb0984f6e15f2da0e52dd341d1bab63f94de927b8 (diff)
downloadpaludis-baf73d121e213089dc6c016158d85dc8efe62aa9.tar.gz
paludis-baf73d121e213089dc6c016158d85dc8efe62aa9.tar.xz
(ruby) Make Repository non-const and change PackageID.repository to repository_name.
-rw-r--r--ruby/package_database_TEST.rb14
-rw-r--r--ruby/package_id.cc6
-rw-r--r--ruby/package_id_TEST.rb16
-rw-r--r--ruby/paludis_ruby.hh4
-rw-r--r--ruby/repository.cc10
5 files changed, 24 insertions, 26 deletions
diff --git a/ruby/package_database_TEST.rb b/ruby/package_database_TEST.rb
index 369eb00..053b5b5 100644
--- a/ruby/package_database_TEST.rb
+++ b/ruby/package_database_TEST.rb
@@ -116,7 +116,7 @@ module Paludis
assert_kind_of PackageID, pid
assert_equal 'foo/bar', pid.name
assert_equal '1.0', pid.version.to_s
- assert_equal 'testrepo', pid.repository.name
+ assert_equal 'testrepo', pid.repository_name
a = db.query(Query::Matches.new(pda) & Query::SupportsInstallAction.new,
QueryOrder::Whatever)
@@ -126,7 +126,7 @@ module Paludis
assert_kind_of PackageID, pid
assert_equal 'foo/bar', pid.name
assert_equal '1.0', pid.version.to_s
- assert_equal 'testrepo', pid.repository.name
+ assert_equal 'testrepo', pid.repository_name
a = db.query(pda, InstallState::Any, QueryOrder::Whatever)
assert_kind_of Array, a
@@ -135,7 +135,7 @@ module Paludis
assert_kind_of PackageID, pid
assert_equal 'foo/bar', pid.name
assert_equal '1.0', pid.version.to_s
- assert_equal 'testrepo', pid.repository.name
+ assert_equal 'testrepo', pid.repository_name
a = db.query(pda2, InstallState::InstallableOnly, QueryOrder::OrderByVersion)
assert_kind_of Array, a
@@ -144,12 +144,12 @@ module Paludis
assert_kind_of PackageID, pid
assert_equal 'foo/bar', pid.name
assert_equal '1.0', pid.version.to_s
- assert_equal 'testrepo', pid.repository.name
+ assert_equal 'testrepo', pid.repository_name
pid2 = a.shift
assert_kind_of PackageID, pid2
assert_equal pid.name, pid2.name
assert_equal '2.0', pid2.version.to_s
- assert_equal pid.repository.name, pid2.repository.name
+ assert_equal pid.repository_name, pid2.repository_name
a = db.query(Query::Package.new('foo/bar'), QueryOrder::OrderByVersion)
@@ -159,12 +159,12 @@ module Paludis
assert_kind_of PackageID, pid
assert_equal 'foo/bar', pid.name
assert_equal '1.0', pid.version.to_s
- assert_equal 'testrepo', pid.repository.name
+ assert_equal 'testrepo', pid.repository_name
pid2 = a.shift
assert_kind_of PackageID, pid2
assert_equal pid.name, pid2.name
assert_equal '2.0', pid2.version.to_s
- assert_equal pid.repository.name, pid2.repository.name
+ assert_equal pid.repository_name, pid2.repository_name
a = db.query(PackageDepSpec.new('>=foo/bar-27',PackageDepSpecParseMode::Permissive), InstallState::InstallableOnly, QueryOrder::Whatever)
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 0e7e755..4f98841 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -224,11 +224,11 @@ namespace
* Our Repository.
*/
VALUE
- package_id_repository(VALUE self)
+ package_id_repository_name(VALUE self)
{
tr1::shared_ptr<const PackageID> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const PackageID>, self_ptr);
- return repository_to_value((*self_ptr)->repository());
+ return rb_str_new2(stringify((*self_ptr)->repository()->name()).c_str());
}
/*
@@ -415,7 +415,7 @@ namespace
rb_define_method(c_package_id, "name", RUBY_FUNC_CAST((&BaseValue<QualifiedPackageName,PackageID,&PackageID::name>::fetch)), 0);
rb_define_method(c_package_id, "version", RUBY_FUNC_CAST(&package_id_version), 0);
rb_define_method(c_package_id, "slot", RUBY_FUNC_CAST((&BaseValue<SlotName,PackageID,&PackageID::slot>::fetch)), 0);
- rb_define_method(c_package_id, "repository", RUBY_FUNC_CAST(&package_id_repository), 0);
+ rb_define_method(c_package_id, "repository_name", RUBY_FUNC_CAST(&package_id_repository_name), 0);
rb_define_method(c_package_id, "==", RUBY_FUNC_CAST(&package_id_equal), 1);
rb_define_method(c_package_id, "keywords_key", RUBY_FUNC_CAST((&KeyValue<MetadataSetKey<KeywordNameSet>,&PackageID::keywords_key>::fetch)), 0);
rb_define_method(c_package_id, "use_key", RUBY_FUNC_CAST((&KeyValue<MetadataSetKey<UseFlagNameSet>,&PackageID::use_key>::fetch)), 0);
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index 6f76a09..2431faa 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -104,7 +104,7 @@ module Paludis
end
def test_members
- [:name, :version, :slot, :repository, :==, :keywords_key,
+ [:name, :version, :slot, :repository_name, :==, :keywords_key,
:use_key, :iuse_key, :inherited_key, :short_description_key,
:long_description_key, :contents_key, :installed_time_key,
:source_origin_key, :binary_origin_key].each do |method|
@@ -136,9 +136,9 @@ module Paludis
assert_equal VersionSpec.new('1.0'), pid_testrepo.version
end
- def test_repository
- assert_kind_of Repository, pid_testrepo.repository
- assert_equal 'testrepo', pid_testrepo.repository.name
+ def test_repository_name
+ assert_kind_of String, pid_testrepo.repository_name
+ assert_equal 'testrepo', pid_testrepo.repository_name
end
def test_slot
@@ -201,9 +201,7 @@ module Paludis
class TestCase_VDBRepo < Test::Unit::TestCase
include TestStuff
- def test_name
- pid_installed = env_vdb.package_database.fetch_repository("installed").package_ids("cat-one/pkg-one").first
- end
+
def test_name
assert_kind_of String, pid_installed.name
assert_equal 'cat-one/pkg-one', pid_installed.name
@@ -215,8 +213,8 @@ module Paludis
end
def test_repository
- assert_kind_of Repository, pid_installed.repository
- assert_equal 'installed', pid_installed.repository.name
+ assert_kind_of String, pid_installed.repository_name
+ assert_equal 'installed', pid_installed.repository_name
end
def test_slot
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index 5bd91bb..a102795 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -74,7 +74,7 @@ namespace paludis
/* constructors */
VALUE package_database_to_value(tr1::shared_ptr<PackageDatabase>);
- VALUE repository_to_value(tr1::shared_ptr<const Repository>);
+ VALUE repository_to_value(tr1::shared_ptr<Repository>);
VALUE version_spec_to_value(const VersionSpec &);
VALUE package_id_to_value(tr1::shared_ptr<const PackageID>);
#if CIARANM_REMOVED_THIS
@@ -93,7 +93,7 @@ namespace paludis
tr1::shared_ptr<NoConfigEnvironment> value_to_no_config_environment(VALUE v);
RepositoryEInterface::ProfilesDescLine value_to_profiles_desc_line(VALUE v);
Query value_to_query(VALUE v);
- tr1::shared_ptr<const Repository> value_to_repository(VALUE);
+ tr1::shared_ptr<Repository> value_to_repository(VALUE);
#ifdef ENABLE_RUBY_QA
QACheckProperties value_to_qa_check_properties(VALUE);
diff --git a/ruby/repository.cc b/ruby/repository.cc
index 24b0d84..987fd7a 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -1077,21 +1077,21 @@ VALUE repo_to_value(T_ m, VALUE * klass)
}
VALUE
-paludis::ruby::repository_to_value(tr1::shared_ptr<const Repository> m)
+paludis::ruby::repository_to_value(tr1::shared_ptr<Repository> m)
{
if (0 == m)
return Qnil;
else
- return repo_to_value<tr1::shared_ptr<const Repository> >(m, &c_repository);
+ return repo_to_value<tr1::shared_ptr<Repository> >(m, &c_repository);
}
-tr1::shared_ptr<const Repository>
+tr1::shared_ptr<Repository>
paludis::ruby::value_to_repository(VALUE v)
{
if (rb_obj_is_kind_of(v, c_repository))
{
- tr1::shared_ptr<const Repository> * v_ptr;
- Data_Get_Struct(v, tr1::shared_ptr<const Repository>, v_ptr);
+ tr1::shared_ptr<Repository> * v_ptr;
+ Data_Get_Struct(v, tr1::shared_ptr<Repository>, v_ptr);
return *v_ptr;
}
else