[zypp-commit] r5661 - /trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
Author: jkupec
Date: Mon Jun 4 14:06:08 2007
New Revision: 5661
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5661&view=rev
Log:
- suse:freshens added
- prerequires deps added
- some comments
Modified:
trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
Modified: trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc?rev=5661&r1=5660&r2=5661&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc (original)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc Mon Jun 4 14:06:08 2007
@@ -19,6 +19,7 @@
#include "zypp/TranslatedText.h"
#include "zypp/ByteCount.h"
+#include "zypp/parser/ParseException.h"
#include "zypp/parser/yum/FileReaderBaseImpl.h"
using namespace std;
@@ -38,6 +39,17 @@
// --------------------------------------------------------------------------
+ /*
+ * xpath and multiplicity of processed nodes are included in the code
+ * for convenience:
+ *
+ * // xpath: <xpath> (?|*|+)
+ *
+ * if multiplicity is ommited, then the node has multiplicity 'one'.
+ */
+
+ // --------------------------------------------------------------------------
+
bool FileReaderBase::BaseImpl::consumePackageNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr)
{
//DBG << "**node: " << reader_r->name() << " (" << reader_r->nodeType() << ") tagpath = " << _tagpath << endl;
@@ -228,33 +240,44 @@
{
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
- if (reader_r->name() == "rpm:entry")
+ // xpath: //format/*/rpm:entry | //format/suse-freshens/suse:entry (+)
+ if (reader_r->name() == "rpm:entry" | reader_r->name() == "suse:entry")
{
if (!_expect_rpm_entry)
- {
- // TODO make this a ParseException (once created/taken out of tagfile ns?)
- ZYPP_THROW(Exception("rpm:entry found when not expected"));
- }
+ ZYPP_THROW(ParseException("rpm:entry found when not expected"));
Edition edition(
reader_r->getAttribute("ver").asString(),
reader_r->getAttribute("rel").asString(),
reader_r->getAttribute("epoch").asString()
);
-
+
+ // read kind of resolvable this entry refers, default to Package
string kind_str = reader_r->getAttribute("kind").asString();
Resolvable::Kind kind;
if (kind_str.empty())
kind = ResTraits<Package>::kind;
else
kind = Resolvable::Kind(kind_str);
-
+
+ // Check whether this is actually a prerequires dependency.
+ // If so, it will be stored in deps_r as Dep::PREREQUIRES
+ // instead of Dep::REQUIRES (a prerequires can appear as part
+ // of requires dependencies only).
+ bool pre = false;
+ if (reader_r->getAttribute("pre").asString() == "1")
+ {
+ if (_dtype.inSwitch() != Dep::REQUIRES_e)
+ ZYPP_THROW(ParseException("pre=\"1\" found for non-requires dependency"));
+ pre = true;
+ }
/*
DBG << "got rpm:entry for " << _dtype << ": "
<< reader_r->getAttribute("name").asString()
<< " " << edition << " (" << kind << ")" << endl;
*/
- deps_r[_dtype].insert(
+ // insert the dependency into the list
+ deps_r[pre ? Dep::PREREQUIRES : _dtype].insert(
zypp::capability::parse(
kind,
reader_r->getAttribute("name").asString(),
@@ -262,65 +285,76 @@
edition
)
);
+
+ //! \todo check
participants (1)
-
jkupec@svn.opensuse.org