#include <zypp/parser/LibXMLHelper.h>
#include <zypp/base/Logger.h>
#include <zypp/parser/yum/schemanames.h>
-
+#include <zypp/ZYppFactory.h>
using namespace std;
namespace zypp {
YUMPrimaryParser::YUMPrimaryParser(istream &is, const string& baseUrl)
: XMLNodeIterator<YUMPrimaryData_Ptr>(is, baseUrl,PRIMARYSCHEMA)
+ , _zypp_architecture( getZYpp()->architecture() )
{
if (is.fail()) {
ERR << "Bad stream" << endl;
}
YUMPrimaryParser::YUMPrimaryParser()
+ : _zypp_architecture( getZYpp()->architecture() )
{ }
YUMPrimaryParser::YUMPrimaryParser(YUMPrimaryData_Ptr& entry)
: XMLNodeIterator<YUMPrimaryData_Ptr>(entry)
+ , _zypp_architecture( getZYpp()->architecture() )
{ }
for (xmlNodePtr child = dataNode->children;
child != 0;
- child = child->next) {
+ child = child->next)
+ {
if (_helper.isElement(child)) {
string name = _helper.name(child);
if (name == "name") {
}
else if (name == "arch") {
dataPtr->arch = _helper.content(child);
+ try {
+ if (!Arch(dataPtr->arch).compatibleWith( _zypp_architecture )) {
+ dataPtr = NULL; // skip <package>, incompatible architecture
+ break;
+ }
+ }
+ catch( const Exception & excpt_r ) {
+ ZYPP_CAUGHT( excpt_r );
+ DBG << "Skipping malformed " << dataPtr->arch << endl;
+ dataPtr = NULL;
+ break;
+ }
}
else if (name == "version") {
dataPtr->epoch = _helper.attribute(child,"epoch");
YUMPrimaryParser::parseFormatNode(YUMPrimaryData_Ptr dataPtr,
xmlNodePtr formatNode)
{
+ if (dataPtr == NULL) return; // skipping
xml_assert(formatNode);
dataPtr->installOnly = false;
for (xmlNodePtr child = formatNode->children;
!prim.atEnd();
++prim)
{
- MIL << "found package "<< (*prim)->name << std::endl;
+ if (*prim == NULL) continue; // incompatible arch detected during parsing
+
+// MIL << "found package "<< (*prim)->name << std::endl;
Arch arch;
if (!(*prim)->arch.empty())
);
ImplAndPackage iap = { impl, p };
_package_impl[nvra] = iap;
- MIL << "inserting package "<< p->name() << std::endl;
+// MIL << "inserting package "<< p->name() << std::endl;
_store.insert (p);
}
if (prim.errorStatus())