Author: jkupec Date: Wed Sep 3 14:52:00 2008 New Revision: 10919 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10919&view=rev Log: - skip repositories with non-matching target distro when reading repoindex Modified: trunk/libzypp/zypp/parser/RepoindexFileReader.cc Modified: trunk/libzypp/zypp/parser/RepoindexFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/RepoindexFileReader.cc?rev=10919&r1=10918&r2=10919&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/RepoindexFileReader.cc (original) +++ trunk/libzypp/zypp/parser/RepoindexFileReader.cc Wed Sep 3 14:52:00 2008 @@ -14,13 +14,15 @@ #include "zypp/base/String.h" #include "zypp/base/Logger.h" #include "zypp/base/Gettext.h" - -#include "zypp/RepoInfo.h" - #include "zypp/Pathname.h" + #include "zypp/parser/xml/Reader.h" #include "zypp/parser/ParseException.h" +#include "zypp/RepoInfo.h" +#include "zypp/Target.h" +#include "zypp/ZYppFactory.h" + #include "zypp/parser/RepoindexFileReader.h" @@ -59,15 +61,18 @@ private: /** Function for processing collected data. Passed-in through constructor. */ ProcessResource _callback; + string _target_distro; }; /////////////////////////////////////////////////////////////////////// RepoindexFileReader::Impl::Impl( const Pathname &repoindex_file, const ProcessResource & callback) : _callback(callback) + , _target_distro(getZYpp()->target()->targetDistribution()) { Reader reader( repoindex_file ); MIL << "Reading " << repoindex_file << endl; + MIL << "Target distro: '" << _target_distro << "'" << endl; reader.foreachNode( bind( &RepoindexFileReader::Impl::consumeNode, this, _1 ) ); } @@ -98,6 +103,19 @@ if ( reader_r->name() == "repo" ) { XmlString s; + + // skip repositories with unknown or not matching target distribution + s = reader_r->getAttribute("distro_target"); + if (!s.get() || _target_distro != s.asString()) + { + MIL + << "Skipping repository meant for '" + << (s.get() ? s.asString() : "(not specified)") + << "' distribution (current distro is '" << _target_distro << "')." + << endl; + return true; + } + RepoInfo info; // url and/or path -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org