#include <set>
#include <string>
-#include "zypp/RelCompare.h"
#include "zypp/base/String.h"
#include "zypp/base/Iterator.h"
+#include "zypp/IdStringType.h"
+#include "zypp/RelCompare.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
public:
/** String representation of Arch. */
+ IdString idStr() const
+ { return IdString( asString() ); }
+ /** \overload */
const std::string & asString() const;
/** \overload */
- const std::string & string() const
- { return asString(); }
+ const char * c_str() const
+ { return asString().c_str(); }
/** Test for an empty Arch (this is "", not Arch_noarch). */
bool empty() const
#include <iostream>
#include <boost/mpl/int.hpp>
-#include "zypp/base/Logger.h"
+#include "zypp/base/Easy.h"
+#include "zypp/base/LogTools.h"
#include "zypp/base/Gettext.h"
#include "zypp/base/Exception.h"
#include "zypp/ZConfig.h"
#include "zypp/sat/detail/PoolImpl.h"
+#include "zypp/sat/Repo.h"
#include "zypp/Capability.h"
using std::endl;
::pool_free( _pool );
}
- ///////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
void PoolImpl::setDirty( const char * a1, const char * a2, const char * a3 )
{
}
}
+ ///////////////////////////////////////////////////////////////////
+
+ int PoolImpl::_addSolv( ::_Repo * repo_r, FILE * file_r )
+ {
+ setDirty(__FUNCTION__, repo_r->name );
+ int ret = ::repo_add_solv( repo_r , file_r );
+
+ if ( ret == 0 )
+ {
+ // Filter out unwanted archs
+ std::set<detail::IdType> sysids;
+ {
+ Arch::CompatSet sysarchs( Arch::compatSet( ZConfig::instance().systemArchitecture() ) );
+ for_( it, sysarchs.begin(), sysarchs.end() )
+ sysids.insert( it->idStr().id() );
+ // unfortunately satsolver treats src/nosrc as architecture:
+ sysids.insert( ARCH_SRC );
+ sysids.insert( ARCH_NOSRC );
+ }
+
+ detail::IdType blockBegin = 0;
+ unsigned blockSize = 0;
+ for ( detail::IdType i = repo_r->start; i < repo_r->end; ++i )
+ {
+ ::_Solvable * s( _pool->solvables + i );
+ if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
+ {
+ // Remember an unwanted arch entry:
+ if ( ! blockBegin )
+ blockBegin = i;
+ ++blockSize;
+ }
+ else if ( blockSize )
+ {
+ // Free remembered entries
+ ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*reuseids*/false );
+ blockBegin = blockSize = 0;
+ }
+ }
+ if ( blockSize )
+ {
+ // Free remembered entries
+ ::repo_free_solvable_block( repo_r, blockBegin, blockSize, /*reuseids*/false );
+ blockBegin = blockSize = 0;
+ }
+ }
+
+ return ret;
+ }
+
+
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
}
/** Adding solv file to a repo. */
- int _addSolv( ::_Repo * repo_r, FILE * file_r )
- {
- setDirty(__FUNCTION__, repo_r->name );
- return ::repo_add_solv( repo_r , file_r );
- }
+ int _addSolv( ::_Repo * repo_r, FILE * file_r );
+
/** Adding Solvables to a repo. */
detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r )
{