From 1c3e4a1741b836b7c2900fb0381abb78a514320c Mon Sep 17 00:00:00 2001 From: Jiri Srain Date: Tue, 14 Mar 2006 19:22:46 +0000 Subject: [PATCH] added license to confirm to YUM metadata grammar, parser, and source --- zypp/parser/yum/YUMOtherParser.cc | 6 +++++- zypp/parser/yum/YUMParserData.cc | 6 +++++- zypp/parser/yum/YUMParserData.h | 2 ++ zypp/parser/yum/YUMPatchParser.cc | 4 ++++ zypp/parser/yum/schema/other.rnc | 1 + zypp/parser/yum/schema/other.rng | 5 +++++ zypp/parser/yum/schema/patch.rnc | 2 +- zypp/parser/yum/schema/patch.rng | 5 +++++ zypp/parser/yum/schema/suse-primary.rng | 3 +-- zypp/source/yum/YUMPackageImpl.cc | 4 +++- 10 files changed, 32 insertions(+), 6 deletions(-) diff --git a/zypp/parser/yum/YUMOtherParser.cc b/zypp/parser/yum/YUMOtherParser.cc index 2030f5d..c7a69c8 100644 --- a/zypp/parser/yum/YUMOtherParser.cc +++ b/zypp/parser/yum/YUMOtherParser.cc @@ -90,7 +90,11 @@ namespace zypp { _helper.attribute(child,"date"), _helper.content(child))); } - else { + else if (name == "license_to_confirm") + { + dataPtr->license_to_confirm.setText(_helper.content(child), Locale(_helper.attribute(child,"lang"))); + } + else { WAR << "YUM contains the unknown element <" << name << "> " << _helper.positionInfo(child) << ", skipping" << endl; } diff --git a/zypp/parser/yum/YUMParserData.cc b/zypp/parser/yum/YUMParserData.cc index afa0288..8c7e8c5 100644 --- a/zypp/parser/yum/YUMParserData.cc +++ b/zypp/parser/yum/YUMParserData.cc @@ -364,7 +364,9 @@ namespace zypp { << "package: " << data.name << " " << data.epoch << "-" << data.ver << "-" << data.rel << endl << "Changelog:" << endl - << data.changelog << endl; + << data.changelog << endl + << "License to confirm:" << endl + << data.license_to_confirm << endl; return out; } @@ -519,6 +521,8 @@ namespace zypp { << " sizeArchive: '" << data.sizeArchive << "'" << endl << " location: '" << data.location << "'" << endl << " license: '" << data.license << "'" << endl + << " license to confirm:" << endl + << data.license_to_confirm << endl << " vendor: '" << data.vendor << "'" << endl << " group: '" << data.group << "'" << endl << " buildhost: '" << data.buildhost << "'" << endl diff --git a/zypp/parser/yum/YUMParserData.h b/zypp/parser/yum/YUMParserData.h index 000a503..f963951 100644 --- a/zypp/parser/yum/YUMParserData.h +++ b/zypp/parser/yum/YUMParserData.h @@ -233,6 +233,7 @@ namespace zypp { std::string sizeArchive; std::string location; std::string license; + TranslatedText license_to_confirm; std::string vendor; std::string group; std::string buildhost; @@ -388,6 +389,7 @@ namespace zypp { std::string ver; std::string rel; std::list changelog; + TranslatedText license_to_confirm; }; /* ** YUMPatchData not yet finalized **/ diff --git a/zypp/parser/yum/YUMPatchParser.cc b/zypp/parser/yum/YUMPatchParser.cc index 458c218..7c0f690 100644 --- a/zypp/parser/yum/YUMPatchParser.cc +++ b/zypp/parser/yum/YUMPatchParser.cc @@ -453,6 +453,10 @@ XXX << "parsePackageNode(" << name << ")" << endl; { parsePkgFilesNode (&*package, child); } + else if (name == "license_to_confirm") + { + package->license_to_confirm.setText(_helper.content(child), Locale(_helper.attribute(child,"lang"))); + } else { WAR << "YUM contains the unknown element <" << name << "> " diff --git a/zypp/parser/yum/schema/other.rnc b/zypp/parser/yum/schema/other.rnc index 4882e9d..d23d64b 100644 --- a/zypp/parser/yum/schema/other.rnc +++ b/zypp/parser/yum/schema/other.rnc @@ -31,6 +31,7 @@ element otherdata { attribute date { xsd:integer }, text }*, + element license_to_confirm { localized-string }*, empty }+, empty diff --git a/zypp/parser/yum/schema/other.rng b/zypp/parser/yum/schema/other.rng index 13dff99..908da7b 100644 --- a/zypp/parser/yum/schema/other.rng +++ b/zypp/parser/yum/schema/other.rng @@ -41,6 +41,11 @@ + + + + + diff --git a/zypp/parser/yum/schema/patch.rnc b/zypp/parser/yum/schema/patch.rnc index f2f4693..aa2ceeb 100644 --- a/zypp/parser/yum/schema/patch.rnc +++ b/zypp/parser/yum/schema/patch.rnc @@ -8,7 +8,7 @@ include "suse-primary.rnc" { element-summary = element summary { localized-string }+ element-description = element description { localized-string }+ # packages in patches have an additional rpmfiles element - element-package = element yum:package { package, element-pkgfiles } + element-package = element yum:package { package, element-pkgfiles, element license_to_confirm { localized-string }+ } # names in dependencies can include a "kind". Should not be used for packages. attribute-name = attribute kind { "package" | "patch" | "script" | "message" | "product" }?, diff --git a/zypp/parser/yum/schema/patch.rng b/zypp/parser/yum/schema/patch.rng index dfb7444..0472ddf 100644 --- a/zypp/parser/yum/schema/patch.rng +++ b/zypp/parser/yum/schema/patch.rng @@ -24,6 +24,11 @@ + + + + + diff --git a/zypp/parser/yum/schema/suse-primary.rng b/zypp/parser/yum/schema/suse-primary.rng index 53ceaee..abed319 100644 --- a/zypp/parser/yum/schema/suse-primary.rng +++ b/zypp/parser/yum/schema/suse-primary.rng @@ -1,7 +1,6 @@ - - + diff --git a/zypp/source/yum/YUMPackageImpl.cc b/zypp/source/yum/YUMPackageImpl.cc index e8e9ecc..e6a0095 100644 --- a/zypp/source/yum/YUMPackageImpl.cc +++ b/zypp/source/yum/YUMPackageImpl.cc @@ -73,6 +73,7 @@ namespace zypp #endif { _description.setText(parsed.description); + _license_to_confirm = other.license_to_confirm.asString(); for (std::list::const_iterator it = filelist.files.begin(); it != filelist.files.end(); it++) @@ -105,7 +106,7 @@ namespace zypp _group(parsed.group), _changelog(), // TODO _type(parsed.type), - _license_to_confirm(), // TODO add to metadata + _license_to_confirm(), _authors(parsed.authors), _keywords( parsed.keywords), _mediaid(strtol(parsed.media.c_str(), 0, 10)), @@ -127,6 +128,7 @@ namespace zypp #endif { _description.setText(parsed.description); + _license_to_confirm = parsed.license_to_confirm.asString(); for (std::list::const_iterator it = parsed.files.begin(); it != parsed.files.end(); it++) -- 2.7.4