diff options
author | 2011-02-26 22:52:04 +0000 | |
---|---|---|
committer | 2011-02-26 22:52:04 +0000 | |
commit | 9338f116a900bb17271b947a528ba4c2e67cadde (patch) | |
tree | 65638d87f6c7bb85968aeeaddd6b7f8883592123 | |
parent | 48654c330e14db70c0a8b3736b77ea2738382edd (diff) | |
download | paludis-9338f116a900bb17271b947a528ba4c2e67cadde.tar.gz paludis-9338f116a900bb17271b947a528ba4c2e67cadde.tar.xz |
Remove RepositoryMaskInfo keys
-rw-r--r-- | doc/api/cplusplus/examples/example_metadata_key.cc | 26 | ||||
-rw-r--r-- | paludis/metadata_key.cc | 3 | ||||
-rw-r--r-- | paludis/metadata_key.hh | 1 | ||||
-rw-r--r-- | paludis/user_dep_spec.cc | 5 | ||||
-rw-r--r-- | python/additional_tests.cc | 7 | ||||
-rw-r--r-- | python/metadata_key.cc | 75 | ||||
-rwxr-xr-x | python/metadata_key_TEST.py | 19 | ||||
-rw-r--r-- | ruby/metadata_key.cc | 97 | ||||
-rw-r--r-- | ruby/paludis_ruby.hh | 1 | ||||
-rwxr-xr-x | src/clients/cave/cmd_display_resolution.cc | 8 | ||||
-rw-r--r-- | src/clients/cave/cmd_info.cc | 4 | ||||
-rw-r--r-- | src/clients/cave/cmd_match.cc | 4 | ||||
-rw-r--r-- | src/clients/cave/cmd_show.cc | 21 | ||||
-rw-r--r-- | src/clients/cave/format_plain_metadata_key.cc | 11 | ||||
-rw-r--r-- | src/clients/instruo/instruo.cc | 5 |
15 files changed, 2 insertions, 285 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc index 2493c2555..1d95145c1 100644 --- a/doc/api/cplusplus/examples/example_metadata_key.cc +++ b/doc/api/cplusplus/examples/example_metadata_key.cc @@ -116,32 +116,6 @@ namespace * it has its own examples. */ } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & key) - { - cout << indent << left << setw(30) << " Class:" << " " << - "MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> >" << endl; - - /* MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> >::value() - * can return a zero pointer. Other keys can't. */ - if (key.value()) - { - cout << indent << left << setw(30) << " Mask file:" << " " << key.value()->mask_file() << endl; - /* Comment looks best if it's outputted over multiple lines, - * as that's how it tends to be stored in package.mask. */ - cout << indent << left << setw(30) << " Comment:" << " "; - bool first(true); - for (Sequence<std::string>::ConstIterator i(key.value()->comment()->begin()), - i_end(key.value()->comment()->end()) ; - i != i_end ; ++i) - { - if (! first) - cout << indent << left << setw(30) << " ..." << " "; - cout << *i << endl; - first = false; - } - } - } - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & key) { cout << indent << left << setw(30) << " Class:" << " " << "MetadataSpecTreeKey<PlainTextSpecTree>" << endl; diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc index 70dccaf8f..3a8c15cc3 100644 --- a/paludis/metadata_key.cc +++ b/paludis/metadata_key.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2009, 2010, 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 @@ -91,6 +91,5 @@ template class MetadataValueKey<FSPath>; template class MetadataValueKey<SlotName>; template class MetadataValueKey<std::shared_ptr<const PackageID> >; template class MetadataValueKey<std::shared_ptr<const Contents> >; -template class MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> >; template class MetadataValueKey<std::shared_ptr<const Choices> >; diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh index a8d2c3b25..3a88d2705 100644 --- a/paludis/metadata_key.hh +++ b/paludis/metadata_key.hh @@ -107,7 +107,6 @@ namespace paludis MetadataValueKey<SlotName>, MetadataValueKey<std::shared_ptr<const PackageID> >, MetadataValueKey<std::shared_ptr<const Contents> >, - MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> >, MetadataValueKey<std::shared_ptr<const Choices> >, MetadataTimeKey, MetadataSectionKey diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index b19cafa77..3ab3f7520 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -577,11 +577,6 @@ namespace return false; } - bool visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > &) const - { - return false; - } - bool visit(const MetadataValueKey<std::shared_ptr<const Contents> > & s) const { switch (op) diff --git a/python/additional_tests.cc b/python/additional_tests.cc index 89d4958b4..b3ca31633 100644 --- a/python/additional_tests.cc +++ b/python/additional_tests.cc @@ -181,12 +181,6 @@ namespace metadata_key m.value(); } - void test_metadata_repository_mask_info_key(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & m) - { - test_metadata_key(m); - m.value(); - } - template <typename C_> void test_metadata_set_key(const MetadataCollectionKey<C_> & m) { @@ -234,7 +228,6 @@ void expose_additional_tests() bp::def("test_metadata_time_key", &metadata_key::test_metadata_time_key); bp::def("test_metadata_contents_key", &metadata_key::test_metadata_contents_key); bp::def("test_metadata_choices_key", &metadata_key::test_metadata_choices_key); - bp::def("test_metadata_repository_mask_info_key", &metadata_key::test_metadata_repository_mask_info_key); bp::def("test_metadata_keyword_name_set_key", &metadata_key::test_metadata_set_key<KeywordNameSet>); bp::def("test_metadata_string_set_key", &metadata_key::test_metadata_set_key<Set<std::string> >); bp::def("test_metadata_license_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<LicenseSpecTree>); diff --git a/python/metadata_key.cc b/python/metadata_key.cc index 98b43e771..6d2aa5710 100644 --- a/python/metadata_key.cc +++ b/python/metadata_key.cc @@ -85,11 +85,6 @@ class MetadataKeySptrToPythonVisitor obj = bp::object(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Choices> > >(_m_ptr)); } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & k) - { - obj = bp::object(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > >(_m_ptr)); - } - void visit(const MetadataValueKey<FSPath> & k) { obj = bp::object(std::static_pointer_cast<const MetadataValueKey<FSPath> >(_m_ptr)); @@ -576,52 +571,6 @@ struct MetadataFSPathKeyWrapper : } }; -struct MetadataRepositoryMaskInfoKeyWrapper : - MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > , - bp::wrapper<MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > > -{ - virtual const std::shared_ptr<const RepositoryMaskInfo> value() const - PALUDIS_ATTRIBUTE((warn_unused_result)) - { - Lock l(get_mutex()); - - if (bp::override f = get_override("value")) - return f(); - else - throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "value"); - } - - virtual const std::string raw_name() const - { - Lock l(get_mutex()); - - if (bp::override f = get_override("raw_name")) - return f(); - else - throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "raw_name"); - } - - virtual const std::string human_name() const - { - Lock l(get_mutex()); - - if (bp::override f = get_override("human_name")) - return f(); - else - throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "human_name"); - } - - virtual MetadataKeyType type() const - { - Lock l(get_mutex()); - - if (bp::override f = get_override("type")) - return f(); - else - throw PythonMethodNotImplemented("MetadataRepositoryMaskInfoKey", "type"); - } -}; - template <typename C_> struct MetadataCollectionKeyWrapper : MetadataCollectionKey<C_>, @@ -1276,30 +1225,6 @@ void expose_metadata_key() /** - * MetadataRepositoryMaskInfoKey - */ - bp::register_ptr_to_python<std::shared_ptr<const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > > >(); - bp::implicitly_convertible<std::shared_ptr<MetadataRepositoryMaskInfoKeyWrapper>, - std::shared_ptr<MetadataKey> >(); - bp::class_<MetadataRepositoryMaskInfoKeyWrapper, std::shared_ptr<MetadataRepositoryMaskInfoKeyWrapper>, - bp::bases<MetadataKey>, boost::noncopyable> - ( - "MetadataRepositoryMaskInfoKey", - "A MetadataRepositoryMaskInfoKey is a MetadataKey that holds\n" - "RepositoryMaskInfo as its value.\n\n" - - "This class can be subclassed in Python.", - bp::init<>( - "__init__()" - ) - ) - .def("value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > ::value), - "value() -> RepositoryMaskInfo\n" - "Fetch our value." - ) - ; - - /** * MetadataCollectionKeys */ class_set_key<KeywordNameSet>("KeywordNameIterable"); diff --git a/python/metadata_key_TEST.py b/python/metadata_key_TEST.py index 23c7dec0d..a13ed6b54 100755 --- a/python/metadata_key_TEST.py +++ b/python/metadata_key_TEST.py @@ -145,25 +145,6 @@ class TestCase_02_MetadataKeys_suclassing(unittest.TestCase): test_metadata_contents_key(TestKey()) - def test_05_repository_mask_info(self): - class TestKey(MetadataRepositoryMaskInfoKey): - def __init__(self): - MetadataRepositoryMaskInfoKey.__init__(self) - - def value(self): - return RepositoryMaskInfo(["comment"], "/foo", "") - - def raw_name(self): - return "raw" - - def human_name(self): - return "human" - - def type(self): - return MetadataKeyType.NORMAL - - test_metadata_repository_mask_info_key(TestKey()) - def test_06_keyword_name_iterable(self): class TestKey(MetadataKeywordNameIterableKey): def __init__(self): diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc index aeca66bb4..8c4b707b2 100644 --- a/ruby/metadata_key.cc +++ b/ruby/metadata_key.cc @@ -42,7 +42,6 @@ namespace static VALUE c_metadata_time_key; static VALUE c_metadata_contents_key; static VALUE c_metadata_choices_key; - static VALUE c_metadata_repository_mask_info_key; static VALUE c_metadata_keyword_name_set_key; static VALUE c_metadata_string_set_key; static VALUE c_metadata_string_string_map_key; @@ -58,7 +57,6 @@ namespace static VALUE c_metadata_dependency_spec_tree_key; static VALUE c_metadata_plain_text_spec_tree_key; static VALUE c_metadata_required_use_spec_tree_key; - static VALUE c_repository_mask_info; static VALUE c_metadata_section_key; /* @@ -166,12 +164,6 @@ namespace new std::shared_ptr<const MetadataKey>(mm)); } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > &) - { - value = Data_Wrap_Struct(c_metadata_repository_mask_info_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free, - new std::shared_ptr<const MetadataKey>(mm)); - } - void visit(const MetadataCollectionKey<KeywordNameSet> &) { value = Data_Wrap_Struct(c_metadata_keyword_name_set_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free, @@ -416,29 +408,6 @@ namespace /* * call-seq: - * value -> RepositoryMaskInfo - * - * Our Value. - * */ - VALUE - metadata_repository_mask_info_key_value(VALUE self) - { - try - { - std::shared_ptr<const MetadataKey> * self_ptr; - Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - if ((std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > >(*self_ptr))->value()) - return repository_mask_info_to_value(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > >(*self_ptr)->value()); - return Qnil; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - - /* - * call-seq: * value -> Choices * * Our Value. @@ -627,38 +596,6 @@ namespace /* * call-seq: - * mask_file -> String - * - * Filename where the key was defined. - */ - VALUE - repository_mask_info_mask_file(VALUE self) - { - std::shared_ptr<const RepositoryMaskInfo> * ptr; - Data_Get_Struct(self, std::shared_ptr<const RepositoryMaskInfo>, ptr); - return rb_str_new2(stringify((**ptr).mask_file()).c_str()); - } - - /* - * call-seq: - * comment -> Array - * - * Array of lines explaining the mask. - */ - VALUE - repository_mask_info_comment(VALUE self) - { - std::shared_ptr<const RepositoryMaskInfo> * ptr; - Data_Get_Struct(self, std::shared_ptr<const RepositoryMaskInfo>, ptr); - VALUE result(rb_ary_new()); - for (Sequence<std::string>::ConstIterator it((**ptr).comment()->begin()), - it_end((**ptr).comment()->end()); it_end != it; ++it) - rb_ary_push(result, rb_str_new2(it->c_str())); - return result; - } - - /* - * call-seq: * each_metadata {|key| block } -> Nil * * Our metadata. @@ -775,14 +712,6 @@ namespace rb_define_method(c_metadata_choices_key, "value", RUBY_FUNC_CAST(&metadata_choices_key_value), 0); /* - * Document-class: Paludis::MetadataRepositoryMaskInfoKey - * - * Metadata class for RepositoryMaskInfo. - */ - c_metadata_repository_mask_info_key = rb_define_class_under(paludis_module(), "MetadataRepositoryMaskInfoKey", c_metadata_key); - rb_define_method(c_metadata_repository_mask_info_key, "value", RUBY_FUNC_CAST(&metadata_repository_mask_info_key_value), 0); - - /* * Document-class: Paludis::MetadataKeywordNameSetKey * * Metadata class for keywords. @@ -909,32 +838,6 @@ namespace rb_define_const(c_metadata_key_type, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l)); // cc_enum_special<paludis/metadata_key-se.hh, MetadataKeyType, c_metadata_key_type> - - /* - * Document-class: Paludis::RepositoryMaskInfo - * - * Information about a RepositoryMask. - */ - c_repository_mask_info = rb_define_class_under(paludis_module(), "RepositoryMaskInfo", rb_cObject); - rb_funcall(c_repository_mask_info, rb_intern("private_class_method"), 1, rb_str_new2("new")); - rb_define_method(c_repository_mask_info, "mask_file", RUBY_FUNC_CAST(&repository_mask_info_mask_file), 0); - rb_define_method(c_repository_mask_info, "comment", RUBY_FUNC_CAST(&repository_mask_info_comment), 0); - } -} - -VALUE -paludis::ruby::repository_mask_info_to_value(std::shared_ptr<const RepositoryMaskInfo> m) -{ - std::shared_ptr<const RepositoryMaskInfo> * m_ptr(0); - try - { - m_ptr = new std::shared_ptr<const RepositoryMaskInfo>(m); - return Data_Wrap_Struct(c_repository_mask_info, 0, &Common<std::shared_ptr<const RepositoryMaskInfo> >::free, m_ptr); - } - catch (const std::exception & e) - { - delete m_ptr; - exception_to_ruby_exception(e); } } diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh index fe7fbd102..b8d3a9450 100644 --- a/ruby/paludis_ruby.hh +++ b/ruby/paludis_ruby.hh @@ -86,7 +86,6 @@ namespace paludis VALUE package_id_to_value(std::shared_ptr<const PackageID>); VALUE qualified_package_name_to_value(const QualifiedPackageName &); VALUE contents_to_value(std::shared_ptr<const Contents>); - VALUE repository_mask_info_to_value(std::shared_ptr<const RepositoryMaskInfo>); VALUE metadata_key_to_value(std::shared_ptr<const MetadataKey> m); VALUE fetch_action_failure_to_value(const FetchActionFailure &); VALUE generator_to_value(const Generator &); diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc index f76b8fcdb..e41400adb 100755 --- a/src/clients/cave/cmd_display_resolution.cc +++ b/src/clients/cave/cmd_display_resolution.cc @@ -921,14 +921,6 @@ namespace cout << fuc(fs_mask_by_valueless(), fv<'i'>(indent), fv<'k'>(k.human_name())); } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & k) - { - cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()->mask_file()))); - for (Sequence<std::string>::ConstIterator l(k.value()->comment()->begin()), l_end(k.value()->comment()->end()) ; - l != l_end ; ++l) - cout << fuc(fs_mask_by_repo_line(), fv<'i'>(indent), fv<'s'>(*l)); - } - void visit(const MetadataValueKey<FSPath> & k) { cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.value()))); diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc index a106add3d..bd72650d7 100644 --- a/src/clients/cave/cmd_info.cc +++ b/src/clients/cave/cmd_info.cc @@ -281,10 +281,6 @@ namespace { } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > &) - { - } - void visit(const MetadataTimeKey & k) { cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(pretty_print_time(k.value().seconds()))); diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc index c4e272378..d2c22fb75 100644 --- a/src/clients/cave/cmd_match.cc +++ b/src/clients/cave/cmd_match.cc @@ -282,10 +282,6 @@ namespace texts.push_back(stringify((*i)->name_with_prefix())); } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > &) - { - } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) { } diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc index db633ded7..3cf5550f2 100644 --- a/src/clients/cave/cmd_show.cc +++ b/src/clients/cave/cmd_show.cc @@ -979,27 +979,6 @@ namespace } } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & k) - { - if (k.value()) - { - out << fuc( - (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), - fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(stringify(k.value()->mask_file())), - fv<'i'>(std::string(indent, ' ')), - fv<'b'>(important ? "true" : ""), - fv<'p'>("") - ); - for (Sequence<std::string>::ConstIterator i(k.value()->comment()->begin()), i_end(k.value()->comment()->end()) ; - i != i_end ; ++i) - out << fuc(fs_metadata_continued_value(), - fv<'v'>(*i), - fv<'i'>("") - ); - } - } - void visit(const MetadataTimeKey & k) { out << fuc( diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc index 5897710e0..6845df5ca 100644 --- a/src/clients/cave/format_plain_metadata_key.cc +++ b/src/clients/cave/format_plain_metadata_key.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh + * Copyright (c) 2008, 2009, 2010, 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 @@ -45,15 +45,6 @@ namespace s << k.value().seconds(); } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & k) - { - if (k.value()) - { - const std::shared_ptr<const Sequence<std::string> > c(k.value()->comment()); - s << join(c->begin(), c->end(), " ") << " " << k.value()->mask_file(); - } - } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) { s << "<unprintable>"; diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc index 387a40892..3e291bbe9 100644 --- a/src/clients/instruo/instruo.cc +++ b/src/clients/instruo/instruo.cc @@ -102,11 +102,6 @@ namespace const FSPath & PALUDIS_ATTRIBUTE((unused)) c(k.value()); } - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & k) - { - const std::shared_ptr<const RepositoryMaskInfo> & PALUDIS_ATTRIBUTE((unused)) i(k.value()); - } - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) { const std::shared_ptr<const PlainTextSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); |