[zypp-commit] r8422 - in /branches/tmp/ma/jump_sat/libzypp/zypp: Edition.cc IdString.h IdStringType.h sat/Pool.cc sat/Pool.h sat/Repo.cc sat/Repo.h sat/Solvable.cc sat/detail/PoolImpl.cc sat/detail/PoolImpl.h
Author: mlandres Date: Thu Jan 31 14:00:43 2008 New Revision: 8422 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8422&view=rev Log: Workaround ZConfig access causing ZYppLock creation. Modified: branches/tmp/ma/jump_sat/libzypp/zypp/Edition.cc branches/tmp/ma/jump_sat/libzypp/zypp/IdString.h branches/tmp/ma/jump_sat/libzypp/zypp/IdStringType.h branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.cc branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.h branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.cc branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.h branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.cc branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.h Modified: branches/tmp/ma/jump_sat/libzypp/zypp/Edition.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/Edition.cc?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/Edition.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/Edition.cc Thu Jan 31 14:00:43 2008 @@ -16,7 +16,7 @@ #include "zypp/base/String.h" #include "zypp/Edition.h" -#include "zypp/sat/Pool.h" +#include "zypp/sat/detail/PoolImpl.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -113,14 +113,14 @@ int Edition::_doCompare( const char * lhs, const char * rhs ) { if ( lhs == rhs ) return 0; - if ( lhs && rhs ) return ::evrcmp_str( sat::Pool::instance().get(), lhs, rhs, EVRCMP_COMPARE ); + if ( lhs && rhs ) return ::evrcmp_str( myPool().getPool(), lhs, rhs, EVRCMP_COMPARE ); return( lhs ? 1 : -1 ); } int Edition::_doMatch( const char * lhs, const char * rhs ) { if ( lhs == rhs ) return 0; - if ( lhs && rhs ) return ::evrcmp_str( sat::Pool::instance().get(), lhs, rhs, EVRCMP_MATCH ); + if ( lhs && rhs ) return ::evrcmp_str( myPool().getPool(), lhs, rhs, EVRCMP_MATCH ); return( lhs ? 1 : -1 ); } Modified: branches/tmp/ma/jump_sat/libzypp/zypp/IdString.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/IdString.h?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/IdString.h (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/IdString.h Thu Jan 31 14:00:43 2008 @@ -35,8 +35,8 @@ * While comparison differs between \ref IdString::Null and \ref IdString::Empty * ( \c NULL and \c "" ), both are represented by an empty string \c "". */ - class IdString: protected sat::detail::PoolMember, - private base::SafeBool<IdString> + class IdString : protected sat::detail::PoolMember, + private base::SafeBool<IdString> { public: /** Default ctor, empty string. */ Modified: branches/tmp/ma/jump_sat/libzypp/zypp/IdStringType.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/IdStringType.h?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/IdStringType.h (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/IdStringType.h Thu Jan 31 14:00:43 2008 @@ -82,7 +82,8 @@ * \ingroup g_CRTP */ template <class Derived> - class IdStringType : private base::SafeBool<Derived> + class IdStringType : protected sat::detail::PoolMember, + private base::SafeBool<Derived> { typedef typename base::SafeBool<Derived>::bool_type bool_type; Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.cc?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.cc Thu Jan 31 14:00:43 2008 @@ -43,12 +43,12 @@ ::_Pool * Pool::get() const { return myPool().getPool(); } + Pool::size_type Pool::capacity() const + { return myPool()->nsolvables; } + const SerialNumber & Pool::serial() const { return myPool().serial(); } - void Pool::setDirty() - { return myPool().setDirty(); } - void Pool::prepare() { return myPool().prepare(); } @@ -101,7 +101,7 @@ Repo ret( reposFind( name_r ) ); if ( ret ) return ret; - return Repo( myPool().createRepo( name_r ) ); + return Repo( myPool()._createRepo( name_r ) ); } Repo Pool::reposFind( const std::string & name_r ) const @@ -136,7 +136,8 @@ */ std::ostream & operator<<( std::ostream & str, const Pool & obj ) { - return str << "sat::pool(" << obj.serial() << "){" + return str << "sat::pool(" << obj.serial() << ")[" + << obj.capacity() << "]{" << obj.reposSize() << "repos|" << obj.solvablesSize() << "slov}"; } Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.h?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.h (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Pool.h Thu Jan 31 14:00:43 2008 @@ -54,13 +54,13 @@ {} public: - /** */ - const SerialNumber & serial() const; + /** Internal array size for stats only. */ + size_type capacity() const; - /** Invalidate housekeeping data (e.g. whatprovides). */ - void setDirty(); + /** Housekeeping data serial number. */ + const SerialNumber & serial() const; - /** Update housekeeping data (e.g. whatprovides). */ + /** Update housekeeping data if necessary (e.g. whatprovides). */ void prepare(); public: Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.cc?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.cc Thu Jan 31 14:00:43 2008 @@ -55,7 +55,8 @@ std::string Repo::name() const { NO_REPO_RETURN( std::string() ); - if ( ! _repo->name ) return std::string(); + if ( ! _repo->name ) + return std::string(); return _repo->name; } @@ -93,7 +94,8 @@ void Repo::eraseFromPool() { - myPool().deleteRepo( _id ); + NO_REPO_RETURN(); + myPool()._deleteRepo( _repo ); _id = detail::noRepoId; } @@ -108,22 +110,13 @@ ZYPP_THROW( Exception( _("Can't read solv-file: ")+file_r.asString() ) ); } - myPool().setDirty(); - ::repo_add_solv( _repo, file ); - } - - detail::SolvableIdType Repo::addSolvable() - { - NO_REPO_THROW( Exception( _("Can't add solvables to norepo.") ) ); - myPool().setDirty(); - return ::repo_add_solvable( _repo ); + myPool()._addSolv( _repo, file ); } detail::SolvableIdType Repo::addSolvables( unsigned count_r ) { NO_REPO_THROW( Exception( _("Can't add solvables to norepo.") ) ); - myPool().setDirty(); - return ::repo_add_solvable_block( _repo, count_r ); + return myPool()._addSolvables( _repo, count_r ); } /****************************************************************** Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.h?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.h (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Repo.h Thu Jan 31 14:00:43 2008 @@ -84,16 +84,22 @@ struct EraseFromPool; public: + /** \name Repo content manipulating methods. + * \todo maybe a separate Repo/Solvable content manip interface + * provided by the pool. + */ + //@{ /** Load \ref Solvables from a solv-file. * \throws Exception if loading the solv-file fails. */ void addSolv( const Pathname & file_r ); - /** Add a new empt \ref Solvable to this \ref Repo. */ - detail::SolvableIdType addSolvable(); - /** Add \c count_r new empty \ref Solvable to this \ref Repo. */ detail::SolvableIdType addSolvables( unsigned count_r ); + /** \overload Add only one new \ref Solvable. */ + detail::SolvableIdType addSolvable() + { return addSolvables( 1 ); } + //@} public: /** Expert backdoor. */ Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/Solvable.cc Thu Jan 31 14:00:43 2008 @@ -211,9 +211,10 @@ { if ( ! obj ) return str << "sat::solvable()"; -#warning SWITCH TO IDENT INSTEAD OF KIND:NAME after tests + return str << "sat::solvable(" << obj.id() << "|" - << obj.kind() << ':' << obj.name() << '-' << obj.edition() << '.' << obj.arch() << "){" + << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident() + << '-' << obj.edition() << '.' << obj.arch() << "){" << obj.repo().name() << "}"; } Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.cc?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.cc Thu Jan 31 14:00:43 2008 @@ -23,6 +23,9 @@ using std::endl; +#undef ZYPP_BASE_LOGGER_LOGGROUP +#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::satpool" + // /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// @@ -86,7 +89,7 @@ ::pool_setdebugcallback( _pool, logSat, NULL ); // set pool architecture - ::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() ); + //::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() ); } /////////////////////////////////////////////////////////////////// @@ -99,6 +102,28 @@ ::pool_free( _pool ); } + void PoolImpl::setDirty( const char * a1, const char * a2, const char * a3 ) + { + if ( a1 ) + { + if ( a3 ) DBG << a1 << " " << a2 << " " << a3 << endl; + else if ( a2 ) DBG << a1 << " " << a2 << endl; + else DBG << a1 << endl; + } + _serial.setDirty(); + } + + void PoolImpl::prepare() + { + if ( _serial.dirty() ) + { + // sat solver claims to handle this on it's own: + ::pool_setarch( _pool, ZConfig::instance().systemArchitecture().asString().c_str() ); + ::pool_createwhatprovides( _pool ); + _serial.serial(); + } + } + ///////////////////////////////////////////////////////////////// } // namespace detail /////////////////////////////////////////////////////////////////// Modified: branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.h?rev=8422&r1=8421&r2=8422&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.h (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/detail/PoolImpl.h Thu Jan 31 14:00:43 2008 @@ -58,44 +58,48 @@ const SerialNumber & serial() const { return _serial; } - /** Invalidate housekeeping data (e.g. whatprovides). - */ - void setDirty() - { _serial.setDirty(); } /** Update housekeeping data (e.g. whatprovides). * \todo actually requires a watcher. */ - void prepare() - { - if ( _serial.dirty() ) - { - // sat solver claims to handle this on it's own: - //::pool_createwhatprovides( _pool ); - _serial.serial(); - } - } + void prepare(); + + private: + /** Invalidate housekeeping data (e.g. whatprovides). + */ + void setDirty( const char * a1 = 0, const char * a2 = 0, const char * a3 = 0 ); public: /** \name Actions invalidating housekeeping data. - */ + * + * All methods expect valid arguments being passed. + */ //@{ /** Creating a new repo named \a name_r. */ - RepoIdType createRepo( const std::string & name_r ) + RepoIdType _createRepo( const std::string & name_r ) { - setDirty(); + setDirty(__FUNCTION__, name_r.c_str() ); return ::repo_create( _pool, name_r.c_str() ); } /** Creating a new repo named \a name_r. */ - void deleteRepo( RepoIdType id_r ) + void _deleteRepo( ::_Repo * repo_r ) { - ::_Repo * todel( getRepo( id_r ) ); - if ( todel ) - { - setDirty(); - ::repo_free( todel, /*reuseids*/false ); - } + setDirty(__FUNCTION__, repo_r->name ); + ::repo_free( repo_r, /*reuseids*/false ); + } + + /** Adding solv file to a repo. */ + void _addSolv( ::_Repo * repo_r, FILE * file_r ) + { + setDirty(__FUNCTION__, repo_r->name ); + ::repo_add_solv( repo_r , file_r ); + } + /** Adding Solvables to a repo. */ + detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r ) + { + setDirty(__FUNCTION__, repo_r->name ); + return ::repo_add_solvable_block( repo_r, count_r ); } //@} @@ -155,6 +159,7 @@ ::_Pool * _pool; /** Serial number. */ SerialNumber _serial; + }; /////////////////////////////////////////////////////////////////// @@ -167,4 +172,5 @@ ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// +#define POOL_SETDIRTY #endif // ZYPP_SAT_DETAIL_POOLIMPL_H -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
mlandres@svn.opensuse.org