Author: matz
Date: Sun Oct 21 17:46:45 2007
New Revision: 7592
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7592&view=rev
Log:
With Capability being Id based we can use that type as return type for
Capability::index (as usual for only the basename in case it's a full
relation). That means the CapHash in Pool can be Id based (instead of
being a std::map on string, which is _much_ faster.
Modified:
branches/use-solv/libzypp/zypp/CapFactory.cc
branches/use-solv/libzypp/zypp/CapFactory.h
branches/use-solv/libzypp/zypp/CapFilters.h
branches/use-solv/libzypp/zypp/CapMatchHelper.h
branches/use-solv/libzypp/zypp/Capability.cc
branches/use-solv/libzypp/zypp/Capability.h
branches/use-solv/libzypp/zypp/ResPool.cc
branches/use-solv/libzypp/zypp/ResPool.h
branches/use-solv/libzypp/zypp/detail/PatternImplIf.cc
branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc
branches/use-solv/libzypp/zypp/detail/SelectionImplIf.cc
branches/use-solv/libzypp/zypp/pool/PoolImpl.cc
branches/use-solv/libzypp/zypp/pool/PoolImpl.h
branches/use-solv/libzypp/zypp/pool/PoolTraits.h
branches/use-solv/libzypp/zypp/solver/detail/QueueItemRequire.cc
branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc
branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc
branches/use-solv/libzypp/zypp/ui/PatternExpander.cc
branches/use-solv/libzypp/zypp/ui/UserWantedPackages.cc
Modified: branches/use-solv/libzypp/zypp/CapFactory.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapFactory.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapFactory.cc (original)
+++ branches/use-solv/libzypp/zypp/CapFactory.cc Sun Oct 21 17:46:45 2007
@@ -196,11 +196,6 @@
}
#endif
- Capability CapFactory::fromId (Id id)
- {
- return Capability (id);
- }
-
#if 0
///////////////////////////////////////////////////////////////////
//
Modified: branches/use-solv/libzypp/zypp/CapFactory.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapFactory.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapFactory.h (original)
+++ branches/use-solv/libzypp/zypp/CapFactory.h Sun Oct 21 17:46:45 2007
@@ -55,7 +55,10 @@
* \throw EXCEPTION on null capability
*/
//Capability fromImpl( capability::CapabilityImpl::Ptr impl ) const;
- Capability fromId (Id id);
+ Capability fromId (Id id)
+ {
+ return Capability (id);
+ }
#if 0
/** Parse Capability from string providing Resolvable::Kind.
Modified: branches/use-solv/libzypp/zypp/CapFilters.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapFilters.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapFilters.h (original)
+++ branches/use-solv/libzypp/zypp/CapFilters.h Sun Oct 21 17:46:45 2007
@@ -16,6 +16,8 @@
#include "zypp/Capability.h"
#include "zypp/ResObject.h"
+#include "pool.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -59,13 +61,13 @@
return c.index() == _index;
}
- ByIndex( const std::string & index_r )
+ ByIndex( Id index_r )
: _index( index_r )
{}
ByIndex( const Capability & cap_r )
: _index( cap_r.index() )
{}
- std::string _index;
+ Id _index;
};
/** */
Modified: branches/use-solv/libzypp/zypp/CapMatchHelper.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/CapMatchHelper.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/CapMatchHelper.h (original)
+++ branches/use-solv/libzypp/zypp/CapMatchHelper.h Sun Oct 21 17:46:45 2007
@@ -16,6 +16,8 @@
#include "zypp/base/Function.h"
#include "zypp/ResPool.h"
+#include "pool.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -54,7 +56,6 @@
const Capability & lhs_r,
function action_r )
{
- std::string index( lhs_r.index() );
return invokeOnEach( begin_r, end_r,
MatchesCapability( lhs_r ), // filter
action_r );
@@ -92,7 +93,7 @@
const Capability & lhs_r,
function action_r )
{
- std::string index( lhs_r.index() );
+ Id index( lhs_r.index() );
return invokeOnEach( pool_r.byCapabilityIndexBegin( index, dep_r ),
pool_r.byCapabilityIndexEnd( index, dep_r ),
MatchesCapability( lhs_r ), // filter
Modified: branches/use-solv/libzypp/zypp/Capability.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/Capability.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/Capability.cc (original)
+++ branches/use-solv/libzypp/zypp/Capability.cc Sun Oct 21 17:46:45 2007
@@ -66,7 +66,12 @@
std::string Capability::asString() const
{ return dep2str (the_pool, id); /*_pimpl->asString();*/ }
- std::string Capability::index() const
+ Id Capability::index() const
+ {
+ return (ISRELDEP (id) ? GETRELDEP (the_pool, id)->name : id);
+ }
+
+ std::string Capability::index_as_string() const
{ return id2str (the_pool, id); /*_pimpl->index();*/ }
// Rel Capability::op() const
Modified: branches/use-solv/libzypp/zypp/Capability.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/Capability.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/Capability.h (original)
+++ branches/use-solv/libzypp/zypp/Capability.h Sun Oct 21 17:46:45 2007
@@ -119,7 +119,9 @@
/** accessors needed by solver/zmd */
/** Deprecated */
- std::string index() const;
+ Id index() const;
+
+ std::string index_as_string() const;
private:
/*typedef capability::CapabilityImpl Impl;
Modified: branches/use-solv/libzypp/zypp/ResPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/ResPool.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/ResPool.cc (original)
+++ branches/use-solv/libzypp/zypp/ResPool.cc Sun Oct 21 17:46:45 2007
@@ -82,10 +82,10 @@
ResPool::byName_iterator ResPool::byNameEnd( const std::string & name_r ) const
{ return _pimpl->_namehash.end( name_r ); }
- ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexBegin( const std::string & index_r, Dep depType_r ) const
+ ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexBegin( Id index_r, Dep depType_r ) const
{ return _pimpl->_caphash.begin( index_r, depType_r ); }
- ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const
+ ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexEnd( Id index_r, Dep depType_r ) const
{ return _pimpl->_caphash.end( index_r, depType_r ); }
ResPool::size_type ResPool::knownRepositoriesSize() const
Modified: branches/use-solv/libzypp/zypp/ResPool.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/ResPool.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/ResPool.h (original)
+++ branches/use-solv/libzypp/zypp/ResPool.h Sun Oct 21 17:46:45 2007
@@ -113,9 +113,9 @@
* one Capability with index \a index_r in dependency \a depType_r.
*/
//@{
- byCapabilityIndex_iterator byCapabilityIndexBegin( const std::string & index_r, Dep depType_r ) const;
+ byCapabilityIndex_iterator byCapabilityIndexBegin( Id index_r, Dep depType_r ) const;
- byCapabilityIndex_iterator byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const;
+ byCapabilityIndex_iterator byCapabilityIndexEnd( Id index_r, Dep depType_r ) const;
//@}
public:
Modified: branches/use-solv/libzypp/zypp/detail/PatternImplIf.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/detail/PatternImplIf.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/detail/PatternImplIf.cc (original)
+++ branches/use-solv/libzypp/zypp/detail/PatternImplIf.cc Sun Oct 21 17:46:45 2007
@@ -44,7 +44,7 @@
if (isKindcapability::NamedCap( *it )
&& it->refers() == ResTraitszypp::Package::kind )
{
- out.insert( it->index() );
+ out.insert( it->index_as_string() );
}
}
}
Modified: branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc (original)
+++ branches/use-solv/libzypp/zypp/detail/ResolvableImpl.cc Sun Oct 21 17:46:45 2007
@@ -35,7 +35,7 @@
{
bool operator()( const Capability & cap_r ) const
{
- return cap_r.index().substr( 0, 7 ) == "rpmlib(";
+ return cap_r.index_as_string().substr( 0, 7 ) == "rpmlib(";
}
};
@@ -285,9 +285,14 @@
.parse( _kind, _name, Rel::EQ, _edition ) );
#endif
+ // XXX
+ // with SOLV the rpmlib(...) deps don't take up much resources,
+ // just leave them in, they're costly to remove
+#if 0
// Filter 'rpmlib(...)' requirements (refill from nvrad_r)
filterUnwantedReq( nvrad_r[Dep::PREREQUIRES], _deps[Dep::PREREQUIRES] );
filterUnwantedReq( nvrad_r[Dep::REQUIRES], _deps[Dep::REQUIRES] );
+#endif
// check for kernel(xxx) and rewrite them to kernel(flavor:xxx)
if ( _kind == ResTraits<Package>::kind )
@@ -295,9 +300,13 @@
//rewriteKernelDeps( _deps );
}
+ // XXX
+ // With SOLV requires include prerequires already
+#if 0
// assert all prerequires are in requires too
_deps[Dep::REQUIRES].insert( _deps[Dep::PREREQUIRES].begin(),
_deps[Dep::PREREQUIRES].end() );
+#endif
if ( _arch.empty() )
dumpOn( WAR << "Has empty Arch: " ) << std::endl;
Modified: branches/use-solv/libzypp/zypp/detail/SelectionImplIf.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/detail/SelectionImplIf.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/detail/SelectionImplIf.cc (original)
+++ branches/use-solv/libzypp/zypp/detail/SelectionImplIf.cc Sun Oct 21 17:46:45 2007
@@ -43,7 +43,7 @@
if (isKindcapability::NamedCap( *it )
&& it->refers() == ResTraitszypp::Package::kind )
{
- out.insert( it->index() );
+ out.insert( it->index_as_string() );
}
}
}
Modified: branches/use-solv/libzypp/zypp/pool/PoolImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/pool/PoolImpl.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/pool/PoolImpl.cc (original)
+++ branches/use-solv/libzypp/zypp/pool/PoolImpl.cc Sun Oct 21 17:46:45 2007
@@ -171,7 +171,7 @@
}
// CapItemStoreT, index -> CapItemContainerT
- const CapHash::CapItemContainerT & CapHash::capItemContainer( const CapItemStoreT & cis, const std::string & tag_r ) const
+ const CapHash::CapItemContainerT & CapHash::capItemContainer( const CapItemStoreT & cis, Id tag_r ) const
{ static CapItemContainerT captemcontainer;
CapItemStoreT::const_iterator it = cis.find( tag_r );
if (it == cis.end()) {
Modified: branches/use-solv/libzypp/zypp/pool/PoolImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/pool/PoolImpl.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/pool/PoolImpl.h (original)
+++ branches/use-solv/libzypp/zypp/pool/PoolImpl.h Sun Oct 21 17:46:45 2007
@@ -125,7 +125,7 @@
const CapItemStoreT & capItemStore ( Dep cap_r ) const;
// CapItemStoreT, index -> CapItemContainerT
- const CapItemContainerT & capItemContainer( const CapItemStoreT & cis, const std::string & tag_r ) const;
+ const CapItemContainerT & capItemContainer( const CapItemStoreT & cis, Id tag_r ) const;
public:
@@ -144,19 +144,19 @@
{ return _store.size(); }
/** */
- iterator begin( const std::string & tag_r, Dep cap_r )
+ iterator begin( Id tag_r, Dep cap_r )
{ return _store[cap_r][tag_r].begin(); }
/** */
- const_iterator begin( const std::string & tag_r, Dep cap_r ) const
+ const_iterator begin( Id tag_r, Dep cap_r ) const
{ const CapItemStoreT & capitemstore = capItemStore( cap_r );
const CapItemContainerT & capcontainer = capItemContainer ( capitemstore, tag_r );
return capcontainer.begin(); }
/** */
- iterator end( const std::string & tag_r, Dep cap_r )
+ iterator end( Id tag_r, Dep cap_r )
{ return _store[cap_r][tag_r].begin(); }
/** */
- const_iterator end( const std::string & tag_r, Dep cap_r ) const
+ const_iterator end( Id tag_r, Dep cap_r ) const
{ const CapItemStoreT & capitemstore = capItemStore( cap_r );
const CapItemContainerT & capcontainer = capItemContainer ( capitemstore, tag_r );
return capcontainer.end(); }
Modified: branches/use-solv/libzypp/zypp/pool/PoolTraits.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/pool/PoolTraits.h?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/pool/PoolTraits.h (original)
+++ branches/use-solv/libzypp/zypp/pool/PoolTraits.h Sun Oct 21 17:46:45 2007
@@ -81,7 +81,7 @@
// internal organization
typedef std::listzypp::CapAndItem CapItemContainerT; // (why,who) pairs
- typedef std::mapstd::string,CapItemContainerT CapItemStoreT; // capability.index -> (why,who) pairs
+ typedef std::map CapItemStoreT; // capability.index -> (why,who) pairs
typedef std::map DepCapItemContainerT; // Dep -> (capability.index -> (why,who) pairs)
typedef CapItemContainerT::iterator capitemiterator;
Modified: branches/use-solv/libzypp/zypp/solver/detail/QueueItemRequire.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/QueueItemRequire.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/QueueItemRequire.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/QueueItemRequire.cc Sun Oct 21 17:46:45 2007
@@ -610,7 +610,7 @@
for (CapSet::const_iterator cit = freshens.begin(); cit != freshens.end(); ++cit) {
if (cit->refers() == ResTraits<Language>::kind) {
- string loc = cit->index();
+ string loc = cit->index_as_string();
MIL << "Look for language fallback " << loc << ":" << item << endl;
if (requested_locales.find( Locale( loc ) ) != requested_locales.end()) {
MIL << "Locale '" << loc << "' is requested" << endl;
Modified: branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/Resolver.cc Sun Oct 21 17:46:45 2007
@@ -36,11 +36,15 @@
#include "zypp/solver/detail/ResolverInfoNeededBy.h"
#include "zypp/capability/FilesystemCap.h"
+#include "pool.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
+
+ extern Pool *the_pool;
+
namespace zypp_detail
{ /////////////////////////////////////////////////////////////////
Arch defaultArchitecture();
@@ -925,8 +929,10 @@
// Checking if we have to make additional establish concerning filesystem capabilities
FileSystemEstablishItem establish(*this);
Dep dep( Dep::SUPPLEMENTS);
- invokeOnEach( pool().byCapabilityIndexBegin( "filesystem()", dep ), // begin()
- pool().byCapabilityIndexEnd( "filesystem()", dep ), // end()
+ Id fsid = str2id (the_pool, "filesystem()", 0);
+ if (fsid)
+ invokeOnEach( pool().byCapabilityIndexBegin( fsid, dep ), // begin()
+ pool().byCapabilityIndexEnd( fsid, dep ), // end()
functor::functorRef( establish ) );
// create initial_queue
Modified: branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc (original)
+++ branches/use-solv/libzypp/zypp/solver/detail/ResolverUpgrade.cc Sun Oct 21 17:46:45 2007
@@ -62,10 +62,15 @@
#include "zypp/Target.h"
+#include "pool.h"
+
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
+
+ extern Pool *the_pool;
+
namespace solver
{ /////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
@@ -606,11 +611,13 @@
FindProviders info(installed);
- invokeOnEach( _pool.byCapabilityIndexBegin( installed->name(), dep ),
- _pool.byCapabilityIndexEnd( installed->name(), dep ),
- functor::chain( resfilter::ByCaIUninstalled(),
- resfilter::ByCapMatch( installedCap ) ) ,
- functor::functorRef(info) );
+ Id nameid = str2id (the_pool, installed->name().c_str(), 0);
+ if (nameid)
+ invokeOnEach( _pool.byCapabilityIndexBegin( nameid, dep ),
+ _pool.byCapabilityIndexEnd( nameid, dep ),
+ functor::chain( resfilter::ByCaIUninstalled(),
+ resfilter::ByCapMatch( installedCap ) ) ,
+ functor::functorRef(info) );
int num_providers = info.providers.size();
@@ -864,7 +871,7 @@
for (CapSet::const_iterator cit = freshens.begin(); cit != freshens.end(); ++cit) {
if (cit->refers() == ResTraits<Language>::kind) {
- string loc = cit->index();
+ string loc = cit->index_as_string();
MIL << "Look for language fallback " << loc << ":" << item << endl;
if (requested_locales.find( Locale( loc ) ) != requested_locales.end()) {
MIL << "Locale '" << loc << "' is requested" << endl;
Modified: branches/use-solv/libzypp/zypp/ui/PatternExpander.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/ui/PatternExpander.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/ui/PatternExpander.cc (original)
+++ branches/use-solv/libzypp/zypp/ui/PatternExpander.cc Sun Oct 21 17:46:45 2007
@@ -134,7 +134,7 @@
/** Return true if Capability \c extends_r is provided by Pattern. */
bool providedBy( const Pattern::constPtr & pat_r, const Capability & extends_r )
{
- std::string index( extends_r.index() );
+ Id index( extends_r.index() );
return( find_if( _pool.byCapabilityIndexBegin( index, Dep::PROVIDES ),
_pool.byCapabilityIndexEnd( index, Dep::PROVIDES ),
bind( &Impl::providedByFilter, this, pat_r, extends_r, _1 ) )
Modified: branches/use-solv/libzypp/zypp/ui/UserWantedPackages.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/use-solv/libzypp/zypp/ui/UserWantedPackages.cc?rev=7592&r1=7591&r2=7592&view=diff
==============================================================================
--- branches/use-solv/libzypp/zypp/ui/UserWantedPackages.cc (original)
+++ branches/use-solv/libzypp/zypp/ui/UserWantedPackages.cc Sun Oct 21 17:46:45 2007
@@ -184,7 +184,7 @@
cap_it != freshens.end();
++cap_it )
{
- if ( contains( wantedLanguages, (*cap_it).index() ) )
+ if ( contains( wantedLanguages, (*cap_it).index_as_string() ) )
pkgNames.insert( obj->name() );
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org