diff options
author | 2011-09-14 09:28:43 +0100 | |
---|---|---|
committer | 2011-09-14 09:57:40 +0100 | |
commit | 12fdd07da80b04724dce37b1a5d87215be245999 (patch) | |
tree | 59fb331a7c475541dfa6eb1ad1e56329d1da9e63 /paludis | |
parent | cabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e (diff) | |
download | paludis-12fdd07da80b04724dce37b1a5d87215be245999.tar.gz paludis-12fdd07da80b04724dce37b1a5d87215be245999.tar.xz |
Use Maintainer for metadata.xml
Diffstat (limited to 'paludis')
-rw-r--r-- | paludis/repositories/e/ebuild_id.cc | 2 | ||||
-rw-r--r-- | paludis/repositories/e/metadata_xml.hh | 3 | ||||
-rw-r--r-- | paludis/repositories/e/xml_things.cc | 36 |
3 files changed, 23 insertions, 18 deletions
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc index 5ced8bcd4..579065594 100644 --- a/paludis/repositories/e/ebuild_id.cc +++ b/paludis/repositories/e/ebuild_id.cc @@ -459,7 +459,7 @@ EbuildID::need_xml_keys_added() const if (! m->herds()->empty()) add_metadata_key(std::make_shared<LiteralMetadataStringSequenceKey>("herds", "Herds", mkt_normal, m->herds())); if (! m->maintainers()->empty()) - add_metadata_key(std::make_shared<LiteralMetadataStringSequenceKey>("maintainers", "Maintainers", mkt_normal, m->maintainers())); + add_metadata_key(std::make_shared<LiteralMetadataMaintainersKey>("maintainers", "Maintainers", mkt_normal, m->maintainers())); } } } diff --git a/paludis/repositories/e/metadata_xml.hh b/paludis/repositories/e/metadata_xml.hh index dba9a1e3d..3652669f8 100644 --- a/paludis/repositories/e/metadata_xml.hh +++ b/paludis/repositories/e/metadata_xml.hh @@ -28,6 +28,7 @@ #include <paludis/util/map-fwd.hh> #include <paludis/util/fs_path-fwd.hh> #include <paludis/choice-fwd.hh> +#include <paludis/maintainer-fwd.hh> #include <memory> namespace paludis @@ -46,7 +47,7 @@ namespace paludis { NamedValue<n::herds, std::shared_ptr<Sequence<std::string> > > herds; NamedValue<n::long_description, std::string> long_description; - NamedValue<n::maintainers, std::shared_ptr<Sequence<std::string> > > maintainers; + NamedValue<n::maintainers, std::shared_ptr<Maintainers> > maintainers; NamedValue<n::uses, std::shared_ptr<Map<ChoiceNameWithPrefix, std::string> > > uses; }; diff --git a/paludis/repositories/e/xml_things.cc b/paludis/repositories/e/xml_things.cc index 614488b83..6d75383cc 100644 --- a/paludis/repositories/e/xml_things.cc +++ b/paludis/repositories/e/xml_things.cc @@ -24,6 +24,7 @@ #include <paludis/util/map.hh> #include <paludis/util/tokeniser.hh> #include <paludis/choice.hh> +#include <paludis/maintainer.hh> #include <set> #include <libxml/tree.h> @@ -287,7 +288,7 @@ paludis_xml_things_create_metadata_xml_from_xml_file(const FSPath & filename) make_named_values<erepository::MetadataXML>( n::herds() = std::make_shared<Sequence<std::string>>(), n::long_description() = "", - n::maintainers() = std::make_shared<Sequence<std::string>>(), + n::maintainers() = std::make_shared<Maintainers>(), n::uses() = std::make_shared<Map<ChoiceNameWithPrefix, std::string>>() ))); @@ -318,13 +319,19 @@ paludis_xml_things_create_metadata_xml_from_xml_file(const FSPath & filename) for (int i = 0 ; i != maintainer_object->nodesetval->nodeNr ; ++i) { - std::string name, email; + Maintainer maintainer(make_named_values<Maintainer>( + n::author() = "", + n::description() = "", + n::email() = "" + )); sub_context->node = maintainer_object->nodesetval->nodeTab[i]; std::shared_ptr<xmlXPathObject> name_object(manage_libxml_ptr(xmlXPathEvalExpression(stupid_libxml_string("./name[position()=1]"), sub_context.get()), xmlXPathFreeObject)), email_object(manage_libxml_ptr(xmlXPathEvalExpression(stupid_libxml_string("./email[position()=1]"), + sub_context.get()), xmlXPathFreeObject)), + description_object(manage_libxml_ptr(xmlXPathEvalExpression(stupid_libxml_string("./description[position()=1]"), sub_context.get()), xmlXPathFreeObject)); if (name_object->nodesetval->nodeNr) @@ -333,7 +340,7 @@ paludis_xml_things_create_metadata_xml_from_xml_file(const FSPath & filename) std::shared_ptr<xmlXPathObject> text_object(manage_libxml_ptr( xmlXPathEvalExpression(stupid_libxml_string("descendant::text()"), text_context.get()), xmlXPathFreeObject)); - name = extract_children_text(text_object); + maintainer.author() = extract_children_text(text_object); } if (email_object->nodesetval->nodeNr) @@ -342,23 +349,20 @@ paludis_xml_things_create_metadata_xml_from_xml_file(const FSPath & filename) std::shared_ptr<xmlXPathObject> text_object(manage_libxml_ptr( xmlXPathEvalExpression(stupid_libxml_string("descendant::text()"), text_context.get()), xmlXPathFreeObject)); - email = extract_children_text(text_object); + maintainer.email() = extract_children_text(text_object); } - if ((! name.empty()) || (! email.empty())) + if (description_object->nodesetval->nodeNr) { - std::string p; - if (! name.empty()) - { - p = name; - if (! email.empty()) - p = p + " <" + email + ">"; - } - else - p = email; - - result->maintainers()->push_back(p); + text_context->node = description_object->nodesetval->nodeTab[0]; + std::shared_ptr<xmlXPathObject> text_object(manage_libxml_ptr( + xmlXPathEvalExpression(stupid_libxml_string("descendant::text()"), + text_context.get()), xmlXPathFreeObject)); + maintainer.description() = extract_children_text(text_object); } + + if ((! maintainer.email().empty()) || (! maintainer.author().empty())) + result->maintainers()->push_back(maintainer); } for (int i = 0 ; i != use_object->nodesetval->nodeNr ; ++i) |